OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 // Adjust the frame size, subsuming the unoptimized frame into the | 268 // Adjust the frame size, subsuming the unoptimized frame into the |
269 // optimized frame. | 269 // optimized frame. |
270 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); | 270 int slots = GetStackSlotCount() - graph()->osr()->UnoptimizedFrameSlots(); |
271 ASSERT(slots >= 0); | 271 ASSERT(slots >= 0); |
272 __ subq(rsp, Immediate(slots * kPointerSize)); | 272 __ subq(rsp, Immediate(slots * kPointerSize)); |
273 } | 273 } |
274 | 274 |
275 | 275 |
276 void LCodeGen::GenerateBodyInstructionPre(LInstruction* instr) { | 276 void LCodeGen::GenerateBodyInstructionPre(LInstruction* instr) { |
| 277 if (instr->IsCall()) { |
| 278 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
| 279 } |
277 if (!instr->IsLazyBailout() && !instr->IsGap()) { | 280 if (!instr->IsLazyBailout() && !instr->IsGap()) { |
278 safepoints_.BumpLastLazySafepointIndex(); | 281 safepoints_.BumpLastLazySafepointIndex(); |
279 } | 282 } |
280 } | 283 } |
281 | 284 |
282 | 285 |
283 bool LCodeGen::GenerateJumpTable() { | 286 bool LCodeGen::GenerateJumpTable() { |
284 Label needs_frame; | 287 Label needs_frame; |
285 if (jump_table_.length() > 0) { | 288 if (jump_table_.length() > 0) { |
286 Comment(";;; -------------------- Jump table --------------------"); | 289 Comment(";;; -------------------- Jump table --------------------"); |
(...skipping 5168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5455 if (current_pc < last_lazy_deopt_pc_ + space_needed) { | 5458 if (current_pc < last_lazy_deopt_pc_ + space_needed) { |
5456 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 5459 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
5457 __ Nop(padding_size); | 5460 __ Nop(padding_size); |
5458 } | 5461 } |
5459 } | 5462 } |
5460 last_lazy_deopt_pc_ = masm()->pc_offset(); | 5463 last_lazy_deopt_pc_ = masm()->pc_offset(); |
5461 } | 5464 } |
5462 | 5465 |
5463 | 5466 |
5464 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { | 5467 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { |
5465 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 5468 last_lazy_deopt_pc_ = masm()->pc_offset(); |
5466 ASSERT(instr->HasEnvironment()); | 5469 ASSERT(instr->HasEnvironment()); |
5467 LEnvironment* env = instr->environment(); | 5470 LEnvironment* env = instr->environment(); |
5468 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | 5471 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); |
5469 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | 5472 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); |
5470 } | 5473 } |
5471 | 5474 |
5472 | 5475 |
5473 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 5476 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
5474 Deoptimizer::BailoutType type = instr->hydrogen()->type(); | 5477 Deoptimizer::BailoutType type = instr->hydrogen()->type(); |
5475 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the | 5478 // TODO(danno): Stubs expect all deopts to be lazy for historical reasons (the |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5527 // Perform stack overflow check. | 5530 // Perform stack overflow check. |
5528 Label done; | 5531 Label done; |
5529 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 5532 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
5530 __ j(above_equal, &done, Label::kNear); | 5533 __ j(above_equal, &done, Label::kNear); |
5531 | 5534 |
5532 ASSERT(instr->context()->IsRegister()); | 5535 ASSERT(instr->context()->IsRegister()); |
5533 ASSERT(ToRegister(instr->context()).is(rsi)); | 5536 ASSERT(ToRegister(instr->context()).is(rsi)); |
5534 CallCode(isolate()->builtins()->StackCheck(), | 5537 CallCode(isolate()->builtins()->StackCheck(), |
5535 RelocInfo::CODE_TARGET, | 5538 RelocInfo::CODE_TARGET, |
5536 instr); | 5539 instr); |
5537 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | |
5538 __ bind(&done); | 5540 __ bind(&done); |
5539 RegisterEnvironmentForDeoptimization(env, Safepoint::kLazyDeopt); | |
5540 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); | |
5541 } else { | 5541 } else { |
5542 ASSERT(instr->hydrogen()->is_backwards_branch()); | 5542 ASSERT(instr->hydrogen()->is_backwards_branch()); |
5543 // Perform stack overflow check if this goto needs it before jumping. | 5543 // Perform stack overflow check if this goto needs it before jumping. |
5544 DeferredStackCheck* deferred_stack_check = | 5544 DeferredStackCheck* deferred_stack_check = |
5545 new(zone()) DeferredStackCheck(this, instr); | 5545 new(zone()) DeferredStackCheck(this, instr); |
5546 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 5546 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
5547 __ j(below, deferred_stack_check->entry()); | 5547 __ j(below, deferred_stack_check->entry()); |
5548 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); | 5548 EnsureSpaceForLazyDeopt(Deoptimizer::patch_size()); |
5549 __ bind(instr->done_label()); | 5549 __ bind(instr->done_label()); |
5550 deferred_stack_check->SetExit(instr->done_label()); | 5550 deferred_stack_check->SetExit(instr->done_label()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5659 FixedArray::kHeaderSize - kPointerSize)); | 5659 FixedArray::kHeaderSize - kPointerSize)); |
5660 __ bind(&done); | 5660 __ bind(&done); |
5661 } | 5661 } |
5662 | 5662 |
5663 | 5663 |
5664 #undef __ | 5664 #undef __ |
5665 | 5665 |
5666 } } // namespace v8::internal | 5666 } } // namespace v8::internal |
5667 | 5667 |
5668 #endif // V8_TARGET_ARCH_X64 | 5668 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |