| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 bool LCodeGen::GenerateCode() { | 43 bool LCodeGen::GenerateCode() { |
| 44 LPhase phase("Z_Code generation", chunk()); | 44 LPhase phase("Z_Code generation", chunk()); |
| 45 DCHECK(is_unused()); | 45 DCHECK(is_unused()); |
| 46 status_ = GENERATING; | 46 status_ = GENERATING; |
| 47 | 47 |
| 48 // Open a frame scope to indicate that there is a frame on the stack. The | 48 // Open a frame scope to indicate that there is a frame on the stack. The |
| 49 // NONE indicates that the scope shouldn't actually generate code to set up | 49 // NONE indicates that the scope shouldn't actually generate code to set up |
| 50 // the frame (that is done in GeneratePrologue). | 50 // the frame (that is done in GeneratePrologue). |
| 51 FrameScope frame_scope(masm_, StackFrame::NONE); | 51 FrameScope frame_scope(masm_, StackFrame::NONE); |
| 52 | 52 |
| 53 return GeneratePrologue() && GenerateBody() && GenerateDeferredCode() && | 53 bool rc = GeneratePrologue() && GenerateBody() && GenerateDeferredCode() && |
| 54 GenerateJumpTable() && GenerateSafepointTable(); | 54 GenerateJumpTable() && GenerateSafepointTable(); |
| 55 #ifdef DEBUG |
| 56 if (!rc) { |
| 57 // Avoid DCHECK(!is_linked()) failure in ~Label() |
| 58 masm()->EmitConstantPool(); |
| 59 } |
| 60 #endif |
| 61 return rc; |
| 55 } | 62 } |
| 56 | 63 |
| 57 | 64 |
| 58 void LCodeGen::FinishCode(Handle<Code> code) { | 65 void LCodeGen::FinishCode(Handle<Code> code) { |
| 59 DCHECK(is_done()); | 66 DCHECK(is_done()); |
| 60 code->set_stack_slots(GetStackSlotCount()); | 67 code->set_stack_slots(GetStackSlotCount()); |
| 61 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); | 68 code->set_safepoint_table_offset(safepoints_.GetCodeOffset()); |
| 62 PopulateDeoptimizationData(code); | 69 PopulateDeoptimizationData(code); |
| 63 } | 70 } |
| 64 | 71 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 DCHECK(info()->IsStub()); | 373 DCHECK(info()->IsStub()); |
| 367 RestoreCallerDoubles(); | 374 RestoreCallerDoubles(); |
| 368 } | 375 } |
| 369 | 376 |
| 370 // Add the base address to the offset previously loaded in entry_offset. | 377 // Add the base address to the offset previously loaded in entry_offset. |
| 371 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(base))); | 378 __ mov(ip, Operand(ExternalReference::ForDeoptEntry(base))); |
| 372 __ add(ip, entry_offset, ip); | 379 __ add(ip, entry_offset, ip); |
| 373 __ Jump(ip); | 380 __ Jump(ip); |
| 374 } | 381 } |
| 375 | 382 |
| 383 masm()->EmitConstantPool(); |
| 384 |
| 376 // The deoptimization jump table is the last part of the instruction | 385 // The deoptimization jump table is the last part of the instruction |
| 377 // sequence. Mark the generated code as done unless we bailed out. | 386 // sequence. Mark the generated code as done unless we bailed out. |
| 378 if (!is_aborted()) status_ = DONE; | 387 if (!is_aborted()) status_ = DONE; |
| 379 return !is_aborted(); | 388 return !is_aborted(); |
| 380 } | 389 } |
| 381 | 390 |
| 382 | 391 |
| 383 bool LCodeGen::GenerateSafepointTable() { | 392 bool LCodeGen::GenerateSafepointTable() { |
| 384 DCHECK(is_done()); | 393 DCHECK(is_done()); |
| 385 safepoints_.Emit(masm(), GetStackSlotCount()); | 394 safepoints_.Emit(masm(), GetStackSlotCount()); |
| (...skipping 5828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6214 __ Push(scope_info); | 6223 __ Push(scope_info); |
| 6215 __ push(ToRegister(instr->function())); | 6224 __ push(ToRegister(instr->function())); |
| 6216 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6225 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6217 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6226 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6218 } | 6227 } |
| 6219 | 6228 |
| 6220 | 6229 |
| 6221 #undef __ | 6230 #undef __ |
| 6222 } | 6231 } |
| 6223 } // namespace v8::internal | 6232 } // namespace v8::internal |
| OLD | NEW |