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/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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 masm()->RecordComment("-- Out of line code --"); | 77 masm()->RecordComment("-- Out of line code --"); |
78 for (OutOfLineCode* ool = ools_; ool; ool = ool->next()) { | 78 for (OutOfLineCode* ool = ools_; ool; ool = ool->next()) { |
79 masm()->bind(ool->entry()); | 79 masm()->bind(ool->entry()); |
80 ool->Generate(); | 80 ool->Generate(); |
81 masm()->jmp(ool->exit()); | 81 masm()->jmp(ool->exit()); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 FinishCode(masm()); | 85 FinishCode(masm()); |
86 | 86 |
87 // Ensure there is space for lazy deopt. | 87 // Ensure there is space for lazy deoptimization in the code. |
88 if (!info->IsStub()) { | 88 if (!info->IsStub()) { |
89 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); | 89 int target_offset = masm()->pc_offset() + Deoptimizer::patch_size(); |
90 while (masm()->pc_offset() < target_offset) { | 90 while (masm()->pc_offset() < target_offset) { |
91 masm()->nop(); | 91 masm()->nop(); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 safepoints()->Emit(masm(), frame()->GetSpillSlotCount()); | 95 safepoints()->Emit(masm(), frame()->GetSpillSlotCount()); |
96 | 96 |
97 // TODO(titzer): what are the right code flags here? | 97 // TODO(titzer): what are the right code flags here? |
98 Code::Kind kind = Code::STUB; | 98 Code::Kind kind = Code::STUB; |
99 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { | 99 if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) { |
100 kind = Code::OPTIMIZED_FUNCTION; | 100 kind = Code::OPTIMIZED_FUNCTION; |
101 } | 101 } |
102 Handle<Code> result = v8::internal::CodeGenerator::MakeCodeEpilogue( | 102 Handle<Code> result = v8::internal::CodeGenerator::MakeCodeEpilogue( |
103 masm(), Code::ComputeFlags(kind), info); | 103 masm(), Code::ComputeFlags(kind), info); |
104 result->set_is_turbofanned(true); | 104 result->set_is_turbofanned(true); |
105 result->set_stack_slots(frame()->GetSpillSlotCount()); | 105 result->set_stack_slots(frame()->GetSpillSlotCount()); |
106 result->set_safepoint_table_offset(safepoints()->GetCodeOffset()); | 106 result->set_safepoint_table_offset(safepoints()->GetCodeOffset()); |
107 | 107 |
108 PopulateDeoptimizationData(result); | 108 PopulateDeoptimizationData(result); |
109 | 109 |
110 EnsureRelocSpaceForLazyDeopt(result); | 110 // Ensure there is space for lazy deoptimization in the relocation info. |
| 111 if (!info->IsStub()) { |
| 112 Deoptimizer::EnsureRelocSpaceForLazyDeoptimization(result); |
| 113 } |
111 | 114 |
112 // Emit a code line info recording stop event. | 115 // Emit a code line info recording stop event. |
113 void* line_info = recorder->DetachJITHandlerData(); | 116 void* line_info = recorder->DetachJITHandlerData(); |
114 LOG_CODE_EVENT(isolate(), CodeEndLinePosInfoRecordEvent(*result, line_info)); | 117 LOG_CODE_EVENT(isolate(), CodeEndLinePosInfoRecordEvent(*result, line_info)); |
115 | 118 |
116 return result; | 119 return result; |
117 } | 120 } |
118 | 121 |
119 | 122 |
120 bool CodeGenerator::IsNextInAssemblyOrder(BasicBlock::RpoNumber block) const { | 123 bool CodeGenerator::IsNextInAssemblyOrder(BasicBlock::RpoNumber block) const { |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 : masm_(gen->masm()), next_(gen->ools_) { | 576 : masm_(gen->masm()), next_(gen->ools_) { |
574 gen->ools_ = this; | 577 gen->ools_ = this; |
575 } | 578 } |
576 | 579 |
577 | 580 |
578 OutOfLineCode::~OutOfLineCode() {} | 581 OutOfLineCode::~OutOfLineCode() {} |
579 | 582 |
580 } // namespace compiler | 583 } // namespace compiler |
581 } // namespace internal | 584 } // namespace internal |
582 } // namespace v8 | 585 } // namespace v8 |
OLD | NEW |