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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/compiler/code-generator.h" | 6 #include "src/compiler/code-generator.h" |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 FrameAccessState* state, | 552 FrameAccessState* state, |
553 int new_slot_above_sp, | 553 int new_slot_above_sp, |
554 bool allow_shrinkage = true) { | 554 bool allow_shrinkage = true) { |
555 int current_sp_offset = state->GetSPToFPSlotCount() + | 555 int current_sp_offset = state->GetSPToFPSlotCount() + |
556 StandardFrameConstants::kFixedSlotCountAboveFp; | 556 StandardFrameConstants::kFixedSlotCountAboveFp; |
557 int stack_slot_delta = new_slot_above_sp - current_sp_offset; | 557 int stack_slot_delta = new_slot_above_sp - current_sp_offset; |
558 if (stack_slot_delta > 0) { | 558 if (stack_slot_delta > 0) { |
559 masm->Subu(sp, sp, stack_slot_delta * kPointerSize); | 559 masm->Subu(sp, sp, stack_slot_delta * kPointerSize); |
560 state->IncreaseSPDelta(stack_slot_delta); | 560 state->IncreaseSPDelta(stack_slot_delta); |
561 } else if (allow_shrinkage && stack_slot_delta < 0) { | 561 } else if (allow_shrinkage && stack_slot_delta < 0) { |
562 masm->Addu(sp, sp, stack_slot_delta * kPointerSize); | 562 masm->Addu(sp, sp, -stack_slot_delta * kPointerSize); |
563 state->IncreaseSPDelta(stack_slot_delta); | 563 state->IncreaseSPDelta(stack_slot_delta); |
564 } | 564 } |
565 } | 565 } |
566 | 566 |
567 } // namespace | 567 } // namespace |
568 | 568 |
569 void CodeGenerator::AssembleTailCallBeforeGap(Instruction* instr, | 569 void CodeGenerator::AssembleTailCallBeforeGap(Instruction* instr, |
570 int first_unused_stack_slot) { | 570 int first_unused_stack_slot) { |
571 AdjustStackPointerForTailCall(masm(), frame_access_state(), | 571 AdjustStackPointerForTailCall(masm(), frame_access_state(), |
572 first_unused_stack_slot, false); | 572 first_unused_stack_slot, false); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 __ Jump(at); | 613 __ Jump(at); |
614 } | 614 } |
615 frame_access_state()->ClearSPDelta(); | 615 frame_access_state()->ClearSPDelta(); |
616 frame_access_state()->SetFrameAccessToDefault(); | 616 frame_access_state()->SetFrameAccessToDefault(); |
617 break; | 617 break; |
618 } | 618 } |
619 case kArchTailCallAddress: { | 619 case kArchTailCallAddress: { |
620 CHECK(!instr->InputAt(0)->IsImmediate()); | 620 CHECK(!instr->InputAt(0)->IsImmediate()); |
621 __ Jump(i.InputRegister(0)); | 621 __ Jump(i.InputRegister(0)); |
622 frame_access_state()->ClearSPDelta(); | 622 frame_access_state()->ClearSPDelta(); |
| 623 frame_access_state()->SetFrameAccessToDefault(); |
623 break; | 624 break; |
624 } | 625 } |
625 case kArchCallJSFunction: { | 626 case kArchCallJSFunction: { |
626 EnsureSpaceForLazyDeopt(); | 627 EnsureSpaceForLazyDeopt(); |
627 Register func = i.InputRegister(0); | 628 Register func = i.InputRegister(0); |
628 if (FLAG_debug_code) { | 629 if (FLAG_debug_code) { |
629 // Check the function's context matches the context argument. | 630 // Check the function's context matches the context argument. |
630 __ lw(kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset)); | 631 __ lw(kScratchReg, FieldMemOperand(func, JSFunction::kContextOffset)); |
631 __ Assert(eq, kWrongFunctionContext, cp, Operand(kScratchReg)); | 632 __ Assert(eq, kWrongFunctionContext, cp, Operand(kScratchReg)); |
632 } | 633 } |
(...skipping 15 matching lines...) Expand all Loading... |
648 } | 649 } |
649 | 650 |
650 if (arch_opcode == kArchTailCallJSFunctionFromJSFunction) { | 651 if (arch_opcode == kArchTailCallJSFunctionFromJSFunction) { |
651 AssemblePopArgumentsAdaptorFrame(kJavaScriptCallArgCountRegister, | 652 AssemblePopArgumentsAdaptorFrame(kJavaScriptCallArgCountRegister, |
652 i.TempRegister(0), i.TempRegister(1), | 653 i.TempRegister(0), i.TempRegister(1), |
653 i.TempRegister(2)); | 654 i.TempRegister(2)); |
654 } | 655 } |
655 __ lw(at, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 656 __ lw(at, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
656 __ Jump(at); | 657 __ Jump(at); |
657 frame_access_state()->ClearSPDelta(); | 658 frame_access_state()->ClearSPDelta(); |
658 frame_access_state()->SetFrameAccessToDefault(); | |
659 break; | 659 break; |
660 } | 660 } |
661 case kArchPrepareCallCFunction: { | 661 case kArchPrepareCallCFunction: { |
662 int const num_parameters = MiscField::decode(instr->opcode()); | 662 int const num_parameters = MiscField::decode(instr->opcode()); |
663 __ PrepareCallCFunction(num_parameters, kScratchReg); | 663 __ PrepareCallCFunction(num_parameters, kScratchReg); |
664 // Frame alignment requires using FP-relative frame addressing. | 664 // Frame alignment requires using FP-relative frame addressing. |
665 frame_access_state()->SetFrameAccessToFP(); | 665 frame_access_state()->SetFrameAccessToFP(); |
666 break; | 666 break; |
667 } | 667 } |
668 case kArchPrepareTailCall: | 668 case kArchPrepareTailCall: |
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2125 padding_size -= v8::internal::Assembler::kInstrSize; | 2125 padding_size -= v8::internal::Assembler::kInstrSize; |
2126 } | 2126 } |
2127 } | 2127 } |
2128 } | 2128 } |
2129 | 2129 |
2130 #undef __ | 2130 #undef __ |
2131 | 2131 |
2132 } // namespace compiler | 2132 } // namespace compiler |
2133 } // namespace internal | 2133 } // namespace internal |
2134 } // namespace v8 | 2134 } // namespace v8 |
OLD | NEW |