OLD | NEW |
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/address-map.h" | 7 #include "src/address-map.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/pipeline.h" | 10 #include "src/compiler/pipeline.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 private: | 27 private: |
28 Label label_; | 28 Label label_; |
29 JumpTable* const next_; | 29 JumpTable* const next_; |
30 Label** const targets_; | 30 Label** const targets_; |
31 size_t const target_count_; | 31 size_t const target_count_; |
32 }; | 32 }; |
33 | 33 |
34 | 34 |
35 CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, | 35 CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, |
36 InstructionSequence* code, CompilationInfo* info) | 36 InstructionSequence* code, CompilationInfo* info) |
37 : frame_(frame), | 37 : frame_access_state_(new (code->zone()) FrameAccessState(frame)), |
38 linkage_(linkage), | 38 linkage_(linkage), |
39 code_(code), | 39 code_(code), |
40 info_(info), | 40 info_(info), |
41 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), | 41 labels_(zone()->NewArray<Label>(code->InstructionBlockCount())), |
42 current_block_(RpoNumber::Invalid()), | 42 current_block_(RpoNumber::Invalid()), |
43 current_source_position_(SourcePosition::Unknown()), | 43 current_source_position_(SourcePosition::Unknown()), |
44 masm_(info->isolate(), NULL, 0), | 44 masm_(info->isolate(), NULL, 0), |
45 resolver_(this), | 45 resolver_(this), |
46 safepoints_(code->zone()), | 46 safepoints_(code->zone()), |
47 handlers_(code->zone()), | 47 handlers_(code->zone()), |
48 deoptimization_states_(code->zone()), | 48 deoptimization_states_(code->zone()), |
49 deoptimization_literals_(code->zone()), | 49 deoptimization_literals_(code->zone()), |
50 inlined_function_count_(0), | 50 inlined_function_count_(0), |
51 translations_(code->zone()), | 51 translations_(code->zone()), |
52 last_lazy_deopt_pc_(0), | 52 last_lazy_deopt_pc_(0), |
53 jump_tables_(nullptr), | 53 jump_tables_(nullptr), |
54 ools_(nullptr), | 54 ools_(nullptr), |
55 osr_pc_offset_(-1), | 55 osr_pc_offset_(-1) { |
56 needs_frame_(frame->GetSpillSlotCount() > 0 || code->ContainsCall()) { | |
57 for (int i = 0; i < code->InstructionBlockCount(); ++i) { | 56 for (int i = 0; i < code->InstructionBlockCount(); ++i) { |
58 new (&labels_[i]) Label; | 57 new (&labels_[i]) Label; |
59 } | 58 } |
| 59 if (code->ContainsCall()) { |
| 60 frame->MarkNeedsFrame(); |
| 61 } |
60 } | 62 } |
61 | 63 |
62 | 64 |
63 Handle<Code> CodeGenerator::GenerateCode() { | 65 Handle<Code> CodeGenerator::GenerateCode() { |
64 CompilationInfo* info = this->info(); | 66 CompilationInfo* info = this->info(); |
65 | 67 |
66 // Open a frame scope to indicate that there is a frame on the stack. The | 68 // Open a frame scope to indicate that there is a frame on the stack. The |
67 // MANUAL indicates that the scope shouldn't actually generate code to set up | 69 // MANUAL indicates that the scope shouldn't actually generate code to set up |
68 // the frame (that is done in AssemblePrologue). | 70 // the frame (that is done in AssemblePrologue). |
69 FrameScope frame_scope(masm(), StackFrame::MANUAL); | 71 FrameScope frame_scope(masm(), StackFrame::MANUAL); |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { | 691 : frame_(gen->frame()), masm_(gen->masm()), next_(gen->ools_) { |
690 gen->ools_ = this; | 692 gen->ools_ = this; |
691 } | 693 } |
692 | 694 |
693 | 695 |
694 OutOfLineCode::~OutOfLineCode() {} | 696 OutOfLineCode::~OutOfLineCode() {} |
695 | 697 |
696 } // namespace compiler | 698 } // namespace compiler |
697 } // namespace internal | 699 } // namespace internal |
698 } // namespace v8 | 700 } // namespace v8 |
OLD | NEW |