| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a3b758d commit aa01ebd
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,7 +39,7 @@ | |||
| 39 | 39 | ||
| 40 | 40 | # Reset this number to 0 on major V8 upgrades. | |
| 41 | 41 | # Increment by one for each non-official patch applied to deps/v8. | |
| 42 | - 'v8_embedder_string': '-node.20', | ||
| 42 | + 'v8_embedder_string': '-node.21', | ||
| 43 | 43 | ||
| 44 | 44 | ##### V8 defaults for Node.js ##### | |
| 45 | 45 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3070,20 +3070,22 @@ Handle<SyntheticModule> Factory::NewSyntheticModule( | |||
| 3070 | 3070 | Handle<String> module_name, Handle<FixedArray> export_names, | |
| 3071 | 3071 | v8::Module::SyntheticModuleEvaluationSteps evaluation_steps) { | |
| 3072 | 3072 | ReadOnlyRoots roots(isolate()); | |
| 3073 | - Handle<SyntheticModule> module( | ||
| 3074 | - SyntheticModule::cast(New(synthetic_module_map(), AllocationType::kOld)), | ||
| 3075 | - isolate()); | ||
| 3073 | + | ||
| 3076 | 3074 | Handle<ObjectHashTable> exports = | |
| 3077 | 3075 | ObjectHashTable::New(isolate(), static_cast<int>(export_names->length())); | |
| 3078 | 3076 | Handle<Foreign> evaluation_steps_foreign = | |
| 3079 | 3077 | NewForeign(reinterpret_cast<i::Address>(evaluation_steps)); | |
| 3080 | - module->set_exports(*exports); | ||
| 3078 | + | ||
| 3079 | + Handle<SyntheticModule> module( | ||
| 3080 | + SyntheticModule::cast(New(synthetic_module_map(), AllocationType::kOld)), | ||
| 3081 | + isolate()); | ||
| 3081 | 3082 | module->set_hash(isolate()->GenerateIdentityHash(Smi::kMaxValue)); | |
| 3082 | 3083 | module->set_module_namespace(roots.undefined_value()); | |
| 3083 | 3084 | module->set_status(Module::kUninstantiated); | |
| 3084 | 3085 | module->set_exception(roots.the_hole_value()); | |
| 3085 | 3086 | module->set_name(*module_name); | |
| 3086 | 3087 | module->set_export_names(*export_names); | |
| 3088 | + module->set_exports(*exports); | ||
| 3087 | 3089 | module->set_evaluation_steps(*evaluation_steps_foreign); | |
| 3088 | 3090 | return module; | |
| 3089 | 3091 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23918,6 +23918,31 @@ TEST(CreateSyntheticModule) { | |||
| 23918 | 23918 | CHECK_EQ(i_module->status(), i::Module::kInstantiated); | |
| 23919 | 23919 | } | |
| 23920 | 23920 | ||
| 23921 | + TEST(CreateSyntheticModuleGC) { | ||
| 23922 | + // Try to make sure that CreateSyntheticModule() deals well with a GC | ||
| 23923 | + // happening during its execution. | ||
| 23924 | + i::FLAG_gc_interval = 10; | ||
| 23925 | + i::FLAG_inline_new = false; | ||
| 23926 | + | ||
| 23927 | + LocalContext env; | ||
| 23928 | + v8::Isolate* isolate = env->GetIsolate(); | ||
| 23929 | + v8::Isolate::Scope iscope(isolate); | ||
| 23930 | + v8::HandleScope scope(isolate); | ||
| 23931 | + v8::Local<v8::Context> context = v8::Context::New(isolate); | ||
| 23932 | + v8::Context::Scope cscope(context); | ||
| 23933 | + | ||
| 23934 | + std::vector<v8::Local<v8::String>> export_names{v8_str("default")}; | ||
| 23935 | + v8::Local<v8::String> module_name = | ||
| 23936 | + v8_str("CreateSyntheticModule-TestSyntheticModuleGC"); | ||
| 23937 | + | ||
| 23938 | + for (int i = 0; i < 200; i++) { | ||
| 23939 | + Local<Module> module = v8::Module::CreateSyntheticModule( | ||
| 23940 | + isolate, module_name, export_names, | ||
| 23941 | + UnexpectedSyntheticModuleEvaluationStepsCallback); | ||
| 23942 | + USE(module); | ||
| 23943 | + } | ||
| 23944 | + } | ||
| 23945 | + | ||
| 23921 | 23946 | TEST(SyntheticModuleSetExports) { | |
| 23922 | 23947 | LocalContext env; | |
| 23923 | 23948 | v8::Isolate* isolate = env->GetIsolate(); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments