Commit 49ef529b authored by ahaas's avatar ahaas Committed by Commit bot

[turbofan] Do not use the self reference for turbofan functions.

The self reference requires the allocation of a handle in the macro
assembler, which is not possible if we instantiate the macro assembler
in a worker thread.

R=mstarzinger@chromium.org, bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/2150523002
Cr-Commit-Position: refs/heads/master@{#37713}
parent bc7f4e7a
......@@ -120,7 +120,8 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
EhFrameWriter* eh_frame_writer,
CompilationInfo* info) {
CompilationInfo* info,
Handle<Object> self_reference) {
Isolate* isolate = info->isolate();
// Allocate and install the code.
......@@ -131,11 +132,9 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
info->IsStub();
masm->GetCode(&desc);
if (eh_frame_writer) eh_frame_writer->GetEhFrame(&desc);
Handle<Code> code =
isolate->factory()->NewCode(desc, flags, masm->CodeObject(),
false, is_crankshafted,
info->prologue_offset(),
info->is_debug() && !is_crankshafted);
Handle<Code> code = isolate->factory()->NewCode(
desc, flags, self_reference, false, is_crankshafted,
info->prologue_offset(), info->is_debug() && !is_crankshafted);
isolate->counters()->total_compiled_code_size()->Increment(
code->instruction_size());
isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted,
......
......@@ -79,7 +79,8 @@ class CodeGenerator {
// Allocate and install the code.
static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
EhFrameWriter* unwinding,
CompilationInfo* info);
CompilationInfo* info,
Handle<Object> self_reference);
// Print the code after compiling it.
static void PrintCode(Handle<Code> code, CompilationInfo* info);
......
......@@ -41,7 +41,7 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
labels_(zone()->NewArray<Label>(code->InstructionBlockCount())),
current_block_(RpoNumber::Invalid()),
current_source_position_(SourcePosition::Unknown()),
masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kYes),
masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kNo),
resolver_(this),
safepoints_(code->zone()),
handlers_(code->zone()),
......@@ -203,8 +203,9 @@ Handle<Code> CodeGenerator::GenerateCode() {
safepoints()->Emit(masm(), frame()->GetTotalFrameSlotCount());
Handle<Code> result =
v8::internal::CodeGenerator::MakeCodeEpilogue(masm(), nullptr, info);
// Turbofan does not use the self reference.
Handle<Code> result = v8::internal::CodeGenerator::MakeCodeEpilogue(
masm(), nullptr, info, Handle<Object>());
result->set_is_turbofanned(true);
result->set_stack_slots(frame()->GetTotalFrameSlotCount());
result->set_safepoint_table_offset(safepoints()->GetCodeOffset());
......
......@@ -457,8 +457,8 @@ Handle<Code> LChunk::Codegen() {
if (generator.GenerateCode()) {
generator.CheckEnvironmentUsage();
CodeGenerator::MakeCodePrologue(info(), "optimized");
Handle<Code> code =
CodeGenerator::MakeCodeEpilogue(&assembler, nullptr, info());
Handle<Code> code = CodeGenerator::MakeCodeEpilogue(
&assembler, nullptr, info(), assembler.CodeObject());
generator.FinishCode(code);
CommitDependencies(code);
generator.source_position_table_builder()->EndJitLogging(
......
......@@ -54,7 +54,8 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
}
unsigned table_offset = cgen.EmitBackEdgeTable();
Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&masm, nullptr, info);
Handle<Code> code =
CodeGenerator::MakeCodeEpilogue(&masm, nullptr, info, masm.CodeObject());
cgen.PopulateDeoptimizationData(code);
cgen.PopulateTypeFeedbackInfo(code);
cgen.PopulateHandlerTable(code);
......
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