OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #if V8_TARGET_ARCH_S390 | 5 #if V8_TARGET_ARCH_S390 |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 __ LoadP(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2717 __ LoadP(ip, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2718 } | 2718 } |
2719 PushOperand(ip); | 2719 PushOperand(ip); |
2720 } | 2720 } |
2721 | 2721 |
2722 #undef __ | 2722 #undef __ |
2723 | 2723 |
2724 #if V8_TARGET_ARCH_S390X | 2724 #if V8_TARGET_ARCH_S390X |
2725 static const FourByteInstr kInterruptBranchInstruction = 0xA7A40011; | 2725 static const FourByteInstr kInterruptBranchInstruction = 0xA7A40011; |
2726 static const FourByteInstr kOSRBranchInstruction = 0xA7040011; | 2726 static const FourByteInstr kOSRBranchInstruction = 0xA7040011; |
2727 static const int16_t kBackEdgeBranchOffset = 0x11 * 2; | 2727 static const int16_t kBackEdgeBranchOffsetInHalfWords = 0x11; |
2728 #else | 2728 #else |
2729 static const FourByteInstr kInterruptBranchInstruction = 0xA7A4000D; | 2729 static const FourByteInstr kInterruptBranchInstruction = 0xA7A4000D; |
2730 static const FourByteInstr kOSRBranchInstruction = 0xA704000D; | 2730 static const FourByteInstr kOSRBranchInstruction = 0xA704000D; |
2731 static const int16_t kBackEdgeBranchOffset = 0xD * 2; | 2731 static const int16_t kBackEdgeBranchOffsetInHalfWords = 0xD; |
2732 #endif | 2732 #endif |
2733 | 2733 |
2734 void BackEdgeTable::PatchAt(Code* unoptimized_code, Address pc, | 2734 void BackEdgeTable::PatchAt(Code* unoptimized_code, Address pc, |
2735 BackEdgeState target_state, | 2735 BackEdgeState target_state, |
2736 Code* replacement_code) { | 2736 Code* replacement_code) { |
2737 Address call_address = Assembler::target_address_from_return_address(pc); | 2737 Address call_address = Assembler::target_address_from_return_address(pc); |
2738 Address branch_address = call_address - 4; | 2738 Address branch_address = call_address - 4; |
2739 Isolate* isolate = unoptimized_code->GetIsolate(); | 2739 Isolate* isolate = unoptimized_code->GetIsolate(); |
2740 CodePatcher patcher(isolate, branch_address, 4); | 2740 CodePatcher patcher(isolate, branch_address, 4); |
2741 | 2741 |
2742 switch (target_state) { | 2742 switch (target_state) { |
2743 case INTERRUPT: { | 2743 case INTERRUPT: { |
2744 // <decrement profiling counter> | 2744 // <decrement profiling counter> |
2745 // bge <ok> ;; patched to GE BRC | 2745 // bge <ok> ;; patched to GE BRC |
2746 // brasrl r14, <interrupt stub address> | 2746 // brasrl r14, <interrupt stub address> |
2747 // <reset profiling counter> | 2747 // <reset profiling counter> |
2748 // ok-label | 2748 // ok-label |
2749 patcher.masm()->brc(ge, Operand(kBackEdgeBranchOffset)); | 2749 patcher.masm()->brc(ge, Operand(kBackEdgeBranchOffsetInHalfWords)); |
2750 break; | 2750 break; |
2751 } | 2751 } |
2752 case ON_STACK_REPLACEMENT: | 2752 case ON_STACK_REPLACEMENT: |
2753 // <decrement profiling counter> | 2753 // <decrement profiling counter> |
2754 // brc 0x0, <ok> ;; patched to NOP BRC | 2754 // brc 0x0, <ok> ;; patched to NOP BRC |
2755 // brasrl r14, <interrupt stub address> | 2755 // brasrl r14, <interrupt stub address> |
2756 // <reset profiling counter> | 2756 // <reset profiling counter> |
2757 // ok-label ----- pc_after points here | 2757 // ok-label ----- pc_after points here |
2758 patcher.masm()->brc(CC_NOP, Operand(kBackEdgeBranchOffset)); | 2758 patcher.masm()->brc(CC_NOP, Operand(kBackEdgeBranchOffsetInHalfWords)); |
2759 break; | 2759 break; |
2760 } | 2760 } |
2761 | 2761 |
2762 // Replace the stack check address in the mov sequence with the | 2762 // Replace the stack check address in the mov sequence with the |
2763 // entry address of the replacement code. | 2763 // entry address of the replacement code. |
2764 Assembler::set_target_address_at(isolate, call_address, unoptimized_code, | 2764 Assembler::set_target_address_at(isolate, call_address, unoptimized_code, |
2765 replacement_code->entry()); | 2765 replacement_code->entry()); |
2766 | 2766 |
2767 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( | 2767 unoptimized_code->GetHeap()->incremental_marking()->RecordCodeTargetPatch( |
2768 unoptimized_code, call_address, replacement_code); | 2768 unoptimized_code, call_address, replacement_code); |
(...skipping 24 matching lines...) Expand all Loading... |
2793 DCHECK(kOSRBranchInstruction == br_instr); | 2793 DCHECK(kOSRBranchInstruction == br_instr); |
2794 | 2794 |
2795 DCHECK(interrupt_address == | 2795 DCHECK(interrupt_address == |
2796 isolate->builtins()->OnStackReplacement()->entry()); | 2796 isolate->builtins()->OnStackReplacement()->entry()); |
2797 return ON_STACK_REPLACEMENT; | 2797 return ON_STACK_REPLACEMENT; |
2798 } | 2798 } |
2799 | 2799 |
2800 } // namespace internal | 2800 } // namespace internal |
2801 } // namespace v8 | 2801 } // namespace v8 |
2802 #endif // V8_TARGET_ARCH_S390 | 2802 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |