Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: src/compiler/code-generator.cc

Issue 1156403002: [turbofan] Record SharedFunctionInfo of inlined functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/pipeline.h" 9 #include "src/compiler/pipeline.h"
10 10
(...skipping 27 matching lines...) Expand all
38 info_(info), 38 info_(info),
39 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), 39 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())),
40 current_block_(RpoNumber::Invalid()), 40 current_block_(RpoNumber::Invalid()),
41 current_source_position_(SourcePosition::Unknown()), 41 current_source_position_(SourcePosition::Unknown()),
42 masm_(info->isolate(), NULL, 0), 42 masm_(info->isolate(), NULL, 0),
43 resolver_(this), 43 resolver_(this),
44 safepoints_(code->zone()), 44 safepoints_(code->zone()),
45 handlers_(code->zone()), 45 handlers_(code->zone()),
46 deoptimization_states_(code->zone()), 46 deoptimization_states_(code->zone()),
47 deoptimization_literals_(code->zone()), 47 deoptimization_literals_(code->zone()),
48 inlined_function_count_(0),
48 translations_(code->zone()), 49 translations_(code->zone()),
49 last_lazy_deopt_pc_(0), 50 last_lazy_deopt_pc_(0),
50 jump_tables_(nullptr), 51 jump_tables_(nullptr),
51 ools_(nullptr), 52 ools_(nullptr),
52 osr_pc_offset_(-1), 53 osr_pc_offset_(-1),
53 needs_frame_(frame->GetSpillSlotCount() > 0 || code->ContainsCall()) { 54 needs_frame_(frame->GetSpillSlotCount() > 0 || code->ContainsCall()) {
54 for (int i = 0; i < code->InstructionBlockCount(); ++i) { 55 for (int i = 0; i < code->InstructionBlockCount(); ++i) {
55 new (&labels_[i]) Label; 56 new (&labels_[i]) Label;
56 } 57 }
57 } 58 }
58 59
59 60
60 Handle<Code> CodeGenerator::GenerateCode() { 61 Handle<Code> CodeGenerator::GenerateCode() {
61 CompilationInfo* info = this->info(); 62 CompilationInfo* info = this->info();
62 63
63 // Emit a code line info recording start event. 64 // Emit a code line info recording start event.
64 PositionsRecorder* recorder = masm()->positions_recorder(); 65 PositionsRecorder* recorder = masm()->positions_recorder();
65 LOG_CODE_EVENT(isolate(), CodeStartLinePosInfoRecordEvent(recorder)); 66 LOG_CODE_EVENT(isolate(), CodeStartLinePosInfoRecordEvent(recorder));
66 67
67 // Place function entry hook if requested to do so. 68 // Place function entry hook if requested to do so.
68 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { 69 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
69 ProfileEntryHookStub::MaybeCallEntryHook(masm()); 70 ProfileEntryHookStub::MaybeCallEntryHook(masm());
70 } 71 }
71 72
72 // Architecture-specific, linkage-specific prologue. 73 // Architecture-specific, linkage-specific prologue.
73 info->set_prologue_offset(masm()->pc_offset()); 74 info->set_prologue_offset(masm()->pc_offset());
74 AssemblePrologue(); 75 AssemblePrologue();
75 76
77 // Define deoptimization literals for all inlined functions.
78 DCHECK_EQ(0u, deoptimization_literals_.size());
79 for (auto frame_state_descriptor : code()->frame_state_descriptors()) {
80 Handle<SharedFunctionInfo> shared_info;
81 if (frame_state_descriptor->shared_info().ToHandle(&shared_info) &&
82 !shared_info.is_identical_to(info->shared_info())) {
83 DefineDeoptimizationLiteral(shared_info);
84 }
85 }
86 inlined_function_count_ = deoptimization_literals_.size();
87
76 // Assemble all non-deferred blocks, followed by deferred ones. 88 // Assemble all non-deferred blocks, followed by deferred ones.
77 for (int deferred = 0; deferred < 2; ++deferred) { 89 for (int deferred = 0; deferred < 2; ++deferred) {
78 for (auto const block : code()->instruction_blocks()) { 90 for (auto const block : code()->instruction_blocks()) {
79 if (block->IsDeferred() == (deferred == 0)) { 91 if (block->IsDeferred() == (deferred == 0)) {
80 continue; 92 continue;
81 } 93 }
82 // Align loop headers on 16-byte boundaries. 94 // Align loop headers on 16-byte boundaries.
83 if (block->IsLoopHeader()) masm()->Align(16); 95 if (block->IsLoopHeader()) masm()->Align(16);
84 // Bind a label for a block. 96 // Bind a label for a block.
85 current_block_ = block->rpo_number(); 97 current_block_ = block->rpo_number();
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 CompilationInfo* info = this->info(); 307 CompilationInfo* info = this->info();
296 int deopt_count = static_cast<int>(deoptimization_states_.size()); 308 int deopt_count = static_cast<int>(deoptimization_states_.size());
297 if (deopt_count == 0 && !info->is_osr()) return; 309 if (deopt_count == 0 && !info->is_osr()) return;
298 Handle<DeoptimizationInputData> data = 310 Handle<DeoptimizationInputData> data =
299 DeoptimizationInputData::New(isolate(), deopt_count, TENURED); 311 DeoptimizationInputData::New(isolate(), deopt_count, TENURED);
300 312
301 Handle<ByteArray> translation_array = 313 Handle<ByteArray> translation_array =
302 translations_.CreateByteArray(isolate()->factory()); 314 translations_.CreateByteArray(isolate()->factory());
303 315
304 data->SetTranslationByteArray(*translation_array); 316 data->SetTranslationByteArray(*translation_array);
305 data->SetInlinedFunctionCount(Smi::FromInt(0)); 317 data->SetInlinedFunctionCount(
318 Smi::FromInt(static_cast<int>(inlined_function_count_)));
306 data->SetOptimizationId(Smi::FromInt(info->optimization_id())); 319 data->SetOptimizationId(Smi::FromInt(info->optimization_id()));
307 // TODO(jarin) The following code was copied over from Lithium, not sure 320 // TODO(jarin) The following code was copied over from Lithium, not sure
308 // whether the scope or the IsOptimizing condition are really needed. 321 // whether the scope or the IsOptimizing condition are really needed.
309 if (info->IsOptimizing()) { 322 if (info->IsOptimizing()) {
310 // Reference to shared function info does not change between phases. 323 // Reference to shared function info does not change between phases.
311 AllowDeferredHandleDereference allow_handle_dereference; 324 AllowDeferredHandleDereference allow_handle_dereference;
312 data->SetSharedFunctionInfo(*info->shared_info()); 325 data->SetSharedFunctionInfo(*info->shared_info());
313 } else { 326 } else {
314 data->SetSharedFunctionInfo(Smi::FromInt(0)); 327 data->SetSharedFunctionInfo(Smi::FromInt(0));
315 } 328 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 : masm_(gen->masm()), next_(gen->ools_) { 677 : masm_(gen->masm()), next_(gen->ools_) {
665 gen->ools_ = this; 678 gen->ools_ = this;
666 } 679 }
667 680
668 681
669 OutOfLineCode::~OutOfLineCode() {} 682 OutOfLineCode::~OutOfLineCode() {}
670 683
671 } // namespace compiler 684 } // namespace compiler
672 } // namespace internal 685 } // namespace internal
673 } // namespace v8 686 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/code-generator.h ('k') | src/compiler/common-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698