Commit ebdeedf4 authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[torque] Dehandlify torque generated initializers

Bug: v8:11263
Change-Id: I4d7d614666ff846740e1bfc1146bd82f08f6a739
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3420830Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78834}
parent 9cbe9774
......@@ -4765,21 +4765,22 @@ void ImplementationVisitor::GenerateClassDefinitions(
factory_impl << ");\n";
factory_impl << " Map map = factory()->read_only_roots()."
<< SnakeifyString(type->name()) << "_map();";
factory_impl << " HeapObject result =\n";
factory_impl << " HeapObject raw_object =\n";
factory_impl << " factory()->AllocateRawWithImmortalMap(size, "
"allocation_type, map);\n";
factory_impl << " " << type->UnhandlifiedCppTypeName()
<< " result = " << type->UnhandlifiedCppTypeName()
<< "::cast(raw_object);\n";
factory_impl << " DisallowGarbageCollection no_gc;";
factory_impl << " WriteBarrierMode write_barrier_mode =\n"
<< " allocation_type == AllocationType::kYoung\n"
<< " ? SKIP_WRITE_BARRIER : UPDATE_WRITE_BARRIER;\n"
<< " USE(write_barrier_mode);\n";
factory_impl << " " << type->HandlifiedCppTypeName()
<< " result_handle(" << type->name()
<< "::cast(result), factory()->isolate());\n";
for (const Field& f : type->ComputeAllFields()) {
if (f.name_and_type.name == "map") continue;
if (!f.index) {
factory_impl << " result_handle->TorqueGeneratedClass::set_"
factory_impl << " result.TorqueGeneratedClass::set_"
<< SnakeifyString(f.name_and_type.name) << "(";
if (f.name_and_type.type->IsSubtypeOf(
TypeOracle::GetTaggedType()) &&
......@@ -4793,7 +4794,7 @@ void ImplementationVisitor::GenerateClassDefinitions(
}
}
factory_impl << " return result_handle;\n";
factory_impl << " return handle(result, factory()->isolate());\n";
factory_impl << "}\n\n";
factory_impl << "template EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) "
......
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