Commit 778fe893 authored by ahaas's avatar ahaas Committed by Commit bot

Reland of [turbofan] Do not use the self reference for turbofan functions

This CL is just a rebase of the original CL
(https://codereview.chromium.org/2150523002).

The reason for reverting was: Dependency of the roll unblocking revert
https://codereview.chromium.org/2147883003/.

Original message:
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=bmeurer@chromium.org

Review-Url: https://codereview.chromium.org/2151493002
Cr-Commit-Position: refs/heads/master@{#37744}
parent 8aaa91ef
......@@ -109,9 +109,9 @@ void CodeGenerator::MakeCodePrologue(CompilationInfo* info, const char* kind) {
#endif // DEBUG
}
Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
CompilationInfo* info) {
CompilationInfo* info,
Handle<Object> self_reference) {
Isolate* isolate = info->isolate();
// Allocate and install the code.
......@@ -121,11 +121,9 @@ Handle<Code> CodeGenerator::MakeCodeEpilogue(MacroAssembler* masm,
Code::ExtractKindFromFlags(flags) == Code::OPTIMIZED_FUNCTION ||
info->IsStub();
masm->GetCode(&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,
......
......@@ -78,7 +78,8 @@ class CodeGenerator {
// Allocate and install the code.
static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
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,8 @@ Handle<Code> CodeGenerator::GenerateCode() {
safepoints()->Emit(masm(), frame()->GetTotalFrameSlotCount());
Handle<Code> result =
v8::internal::CodeGenerator::MakeCodeEpilogue(masm(), info);
Handle<Code> result = v8::internal::CodeGenerator::MakeCodeEpilogue(
masm(), info, Handle<Object>());
result->set_is_turbofanned(true);
result->set_stack_slots(frame()->GetTotalFrameSlotCount());
result->set_safepoint_table_offset(safepoints()->GetCodeOffset());
......
......@@ -457,7 +457,8 @@ Handle<Code> LChunk::Codegen() {
if (generator.GenerateCode()) {
generator.CheckEnvironmentUsage();
CodeGenerator::MakeCodePrologue(info(), "optimized");
Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&assembler, info());
Handle<Code> code = CodeGenerator::MakeCodeEpilogue(&assembler, 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, info);
Handle<Code> code =
CodeGenerator::MakeCodeEpilogue(&masm, 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