Commit f28cc379 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

Fix SyntheticModule body descriptor

It was missing the name field.

Bug: chromium:1036641
Change-Id: I686a46adfccfd656422cddef340ded58b7a9c9b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2000135
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65748}
parent 2f820780
......@@ -80,8 +80,8 @@ class Module : public HeapObject {
static Handle<JSModuleNamespace> GetModuleNamespace(Isolate* isolate,
Handle<Module> module);
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(Struct::kHeaderSize,
// Layout description.
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_MODULE_FIELDS)
using BodyDescriptor =
......
......@@ -40,9 +40,9 @@ class SyntheticModule
Handle<String> export_name,
Handle<Object> export_value);
using BodyDescriptor = SubclassBodyDescriptor<
Module::BodyDescriptor,
FixedBodyDescriptor<kExportNamesOffset, kSize, kSize>>;
using BodyDescriptor =
SubclassBodyDescriptor<Module::BodyDescriptor,
FixedBodyDescriptor<kNameOffset, kSize, kSize>>;
private:
friend class Module;
......
......@@ -24015,6 +24015,34 @@ TEST(CreateSyntheticModuleGC) {
}
}
TEST(CreateSyntheticModuleGCName) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::Isolate::Scope iscope(isolate);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope cscope(context);
Local<Module> module;
{
v8::EscapableHandleScope inner_scope(isolate);
std::vector<v8::Local<v8::String>> export_names{v8_str("default")};
v8::Local<v8::String> module_name =
v8_str("CreateSyntheticModuleGCName-TestSyntheticModule");
module = inner_scope.Escape(v8::Module::CreateSyntheticModule(
isolate, module_name, export_names,
UnexpectedSyntheticModuleEvaluationStepsCallback));
}
CcTest::CollectAllGarbage();
#ifdef VERIFY_HEAP
i::Handle<i::HeapObject> i_module =
i::Handle<i::HeapObject>::cast(v8::Utils::OpenHandle(*module));
i_module->HeapObjectVerify(reinterpret_cast<i::Isolate*>(isolate));
#endif
}
TEST(SyntheticModuleSetExports) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment