[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}
This commit is contained in:
ahaas 2016-07-13 06:51:58 -07:00 committed by Commit bot
parent bc7f4e7a5d
commit 49ef529b3a
5 changed files with 15 additions and 13 deletions

View File

@ -120,7 +120,8 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm, Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
EhFrameWriter* eh_frame_writer, EhFrameWriter* eh_frame_writer,
CompilationInfo* info) { CompilationInfo* info,
Handle<Object> self_reference) {
Isolate* isolate = info->isolate(); Isolate* isolate = info->isolate();
// Allocate and install the code. // Allocate and install the code.
@ -131,11 +132,9 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
info->IsStub(); info->IsStub();
masm->GetCode(&desc); masm->GetCode(&desc);
if (eh_frame_writer) eh_frame_writer->GetEhFrame(&desc); if (eh_frame_writer) eh_frame_writer->GetEhFrame(&desc);
Handle<Code> code = Handle<Code> code = isolate->factory()->NewCode(
isolate->factory()->NewCode(desc, flags, masm->CodeObject(), desc, flags, self_reference, false, is_crankshafted,
false, is_crankshafted, info->prologue_offset(), info->is_debug() && !is_crankshafted);
info->prologue_offset(),
info->is_debug() && !is_crankshafted);
isolate->counters()->total_compiled_code_size()->Increment( isolate->counters()->total_compiled_code_size()->Increment(
code->instruction_size()); code->instruction_size());
isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted, isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted,

View File

@ -79,7 +79,8 @@ class CodeGenerator {
// Allocate and install the code. // Allocate and install the code.
static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm, static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
EhFrameWriter* unwinding, EhFrameWriter* unwinding,
CompilationInfo* info); CompilationInfo* info,
Handle<Object> self_reference);
// Print the code after compiling it. // Print the code after compiling it.
static void PrintCode(Handle<Code> code, CompilationInfo* info); static void PrintCode(Handle<Code> code, CompilationInfo* info);

View File

@ -41,7 +41,7 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage,
labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), labels_(zone()->NewArray<Label>(code->InstructionBlockCount())),
current_block_(RpoNumber::Invalid()), current_block_(RpoNumber::Invalid()),
current_source_position_(SourcePosition::Unknown()), current_source_position_(SourcePosition::Unknown()),
masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kYes), masm_(info->isolate(), nullptr, 0, CodeObjectRequired::kNo),
resolver_(this), resolver_(this),
safepoints_(code->zone()), safepoints_(code->zone()),
handlers_(code->zone()), handlers_(code->zone()),
@ -203,8 +203,9 @@ Handle<Code> CodeGenerator::GenerateCode() {
safepoints()->Emit(masm(), frame()->GetTotalFrameSlotCount()); safepoints()->Emit(masm(), frame()->GetTotalFrameSlotCount());
Handle<Code> result = // Turbofan does not use the self reference.
v8::internal::CodeGenerator::MakeCodeEpilogue(masm(), nullptr, info); Handle<Code> result = v8::internal::CodeGenerator::MakeCodeEpilogue(
masm(), nullptr, info, Handle<Object>());
result->set_is_turbofanned(true); result->set_is_turbofanned(true);
result->set_stack_slots(frame()->GetTotalFrameSlotCount()); result->set_stack_slots(frame()->GetTotalFrameSlotCount());
result->set_safepoint_table_offset(safepoints()->GetCodeOffset()); result->set_safepoint_table_offset(safepoints()->GetCodeOffset());

View File

@ -457,8 +457,8 @@ Handle<Code> LChunk::Codegen() {
if (generator.GenerateCode()) { if (generator.GenerateCode()) {
generator.CheckEnvironmentUsage(); generator.CheckEnvironmentUsage();
CodeGenerator::MakeCodePrologue(info(), "optimized"); CodeGenerator::MakeCodePrologue(info(), "optimized");
Handle<Code> code = Handle<Code> code = CodeGenerator::MakeCodeEpilogue(
CodeGenerator::MakeCodeEpilogue(&assembler, nullptr, info()); &assembler, nullptr, info(), assembler.CodeObject());
generator.FinishCode(code); generator.FinishCode(code);
CommitDependencies(code); CommitDependencies(code);
generator.source_position_table_builder()->EndJitLogging( generator.source_position_table_builder()->EndJitLogging(

View File

@ -54,7 +54,8 @@ bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
} }
unsigned table_offset = cgen.EmitBackEdgeTable(); 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.PopulateDeoptimizationData(code);
cgen.PopulateTypeFeedbackInfo(code); cgen.PopulateTypeFeedbackInfo(code);
cgen.PopulateHandlerTable(code); cgen.PopulateHandlerTable(code);