[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,
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,

View File

@ -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);

View File

@ -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());

View File

@ -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(

View File

@ -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);