| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 bool LCodeGen::GenerateCode() { | 44 bool LCodeGen::GenerateCode() { |
| 45 LPhase phase("Z_Code generation", chunk()); | 45 LPhase phase("Z_Code generation", chunk()); |
| 46 DCHECK(is_unused()); | 46 DCHECK(is_unused()); |
| 47 status_ = GENERATING; | 47 status_ = GENERATING; |
| 48 | 48 |
| 49 // Open a frame scope to indicate that there is a frame on the stack. The | 49 // Open a frame scope to indicate that there is a frame on the stack. The |
| 50 // NONE indicates that the scope shouldn't actually generate code to set up | 50 // NONE indicates that the scope shouldn't actually generate code to set up |
| 51 // the frame (that is done in GeneratePrologue). | 51 // the frame (that is done in GeneratePrologue). |
| 52 FrameScope frame_scope(masm_, StackFrame::NONE); | 52 FrameScope frame_scope(masm_, StackFrame::NONE); |
| 53 | 53 |
| 54 return GeneratePrologue() && | 54 return GeneratePrologue() && GenerateBody() && GenerateDeferredCode() && |
| 55 GenerateBody() && | 55 GenerateJumpTable() && GenerateSafepointTable(); |
| 56 GenerateDeferredCode() && | |
| 57 GenerateDeoptJumpTable() && | |
| 58 GenerateSafepointTable(); | |
| 59 } | 56 } |
| 60 | 57 |
| 61 | 58 |
| 62 void LCodeGen::FinishCode(Handle<Code> code) { | 59 void LCodeGen::FinishCode(Handle<Code> code) { |
| 63 DCHECK(is_done()); | 60 DCHECK(is_done()); |
| 64 code->set_stack_slots(GetStackSlotCount()); | 61 code->set_stack_slots(GetStackSlotCount()); |
| 65 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 62 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 66 if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code); | 63 if (code->is_optimized_code()) RegisterWeakObjectsInOptimizedCode(code); |
| 67 PopulateDeoptimizationData(code); | 64 PopulateDeoptimizationData(code); |
| 68 } | 65 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 __ jmp(code->exit()); | 292 __ jmp(code->exit()); |
| 296 } | 293 } |
| 297 } | 294 } |
| 298 // Deferred code is the last part of the instruction sequence. Mark | 295 // Deferred code is the last part of the instruction sequence. Mark |
| 299 // the generated code as done unless we bailed out. | 296 // the generated code as done unless we bailed out. |
| 300 if (!is_aborted()) status_ = DONE; | 297 if (!is_aborted()) status_ = DONE; |
| 301 return !is_aborted(); | 298 return !is_aborted(); |
| 302 } | 299 } |
| 303 | 300 |
| 304 | 301 |
| 305 bool LCodeGen::GenerateDeoptJumpTable() { | 302 bool LCodeGen::GenerateJumpTable() { |
| 306 if (deopt_jump_table_.length() > 0) { | 303 if (deopt_jump_table_.length() > 0) { |
| 307 Comment(";;; -------------------- Jump table --------------------"); | 304 Comment(";;; -------------------- Jump table --------------------"); |
| 308 } | 305 } |
| 309 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); | 306 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); |
| 310 Label table_start; | 307 Label table_start; |
| 311 __ bind(&table_start); | 308 __ bind(&table_start); |
| 312 Label needs_frame; | 309 Label needs_frame; |
| 313 for (int i = 0; i < deopt_jump_table_.length(); i++) { | 310 for (int i = 0; i < deopt_jump_table_.length(); i++) { |
| 314 __ bind(&deopt_jump_table_[i].label); | 311 __ bind(&deopt_jump_table_[i].label); |
| 315 Address entry = deopt_jump_table_[i].address; | 312 Address entry = deopt_jump_table_[i].address; |
| 316 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; | 313 Deoptimizer::BailoutType type = deopt_jump_table_[i].bailout_type; |
| 317 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); | 314 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); |
| 318 if (id == Deoptimizer::kNotDeoptimizationEntry) { | 315 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); |
| 319 Comment(";;; jump table entry %d.", i); | 316 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); |
| 320 } else { | |
| 321 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); | |
| 322 } | |
| 323 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); | 317 __ li(t9, Operand(ExternalReference::ForDeoptEntry(entry))); |
| 324 if (deopt_jump_table_[i].needs_frame) { | 318 if (deopt_jump_table_[i].needs_frame) { |
| 325 DCHECK(!info()->saves_caller_doubles()); | 319 DCHECK(!info()->saves_caller_doubles()); |
| 326 if (needs_frame.is_bound()) { | 320 if (needs_frame.is_bound()) { |
| 327 __ Branch(&needs_frame); | 321 __ Branch(&needs_frame); |
| 328 } else { | 322 } else { |
| 329 __ bind(&needs_frame); | 323 __ bind(&needs_frame); |
| 330 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); | 324 __ MultiPush(cp.bit() | fp.bit() | ra.bit()); |
| 331 // This variant of deopt can only be used with stubs. Since we don't | 325 // This variant of deopt can only be used with stubs. Since we don't |
| 332 // have a function pointer to install in the stack frame that we're | 326 // have a function pointer to install in the stack frame that we're |
| (...skipping 5618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5951 __ li(at, scope_info); | 5945 __ li(at, scope_info); |
| 5952 __ Push(at, ToRegister(instr->function())); | 5946 __ Push(at, ToRegister(instr->function())); |
| 5953 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5947 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5954 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5948 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5955 } | 5949 } |
| 5956 | 5950 |
| 5957 | 5951 |
| 5958 #undef __ | 5952 #undef __ |
| 5959 | 5953 |
| 5960 } } // namespace v8::internal | 5954 } } // namespace v8::internal |
| OLD | NEW |