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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 2983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2994 void MacroAssembler::LoadFromSafepointRegisterSlot(Register dst, Register src) { | 2994 void MacroAssembler::LoadFromSafepointRegisterSlot(Register dst, Register src) { |
2995 movp(dst, SafepointRegisterSlot(src)); | 2995 movp(dst, SafepointRegisterSlot(src)); |
2996 } | 2996 } |
2997 | 2997 |
2998 | 2998 |
2999 Operand MacroAssembler::SafepointRegisterSlot(Register reg) { | 2999 Operand MacroAssembler::SafepointRegisterSlot(Register reg) { |
3000 return Operand(rsp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 3000 return Operand(rsp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
3001 } | 3001 } |
3002 | 3002 |
3003 | 3003 |
3004 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 3004 void MacroAssembler::PushStackHandler() { |
3005 int handler_index) { | |
3006 // Adjust this code if not the case. | 3005 // Adjust this code if not the case. |
3007 STATIC_ASSERT(StackHandlerConstants::kSize == 3 * kPointerSize); | 3006 STATIC_ASSERT(StackHandlerConstants::kSize == 1 * kPointerSize); |
3008 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 3007 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
3009 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); | |
3010 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); | |
3011 | |
3012 // We will build up the handler from the bottom by pushing on the stack. | |
3013 // First push the context. | |
3014 if (kind == StackHandler::JS_ENTRY) { | |
3015 Push(Smi::FromInt(0)); // No context. | |
3016 } else { | |
3017 Push(rsi); | |
3018 } | |
3019 | |
3020 // Push the index. | |
3021 Push(Immediate(handler_index)); | |
3022 | 3008 |
3023 // Link the current handler as the next handler. | 3009 // Link the current handler as the next handler. |
3024 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 3010 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
3025 Push(ExternalOperand(handler_address)); | 3011 Push(ExternalOperand(handler_address)); |
| 3012 |
3026 // Set this new handler as the current one. | 3013 // Set this new handler as the current one. |
3027 movp(ExternalOperand(handler_address), rsp); | 3014 movp(ExternalOperand(handler_address), rsp); |
3028 } | 3015 } |
3029 | 3016 |
3030 | 3017 |
3031 void MacroAssembler::PopTryHandler() { | 3018 void MacroAssembler::PopStackHandler() { |
3032 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 3019 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
3033 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 3020 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
3034 Pop(ExternalOperand(handler_address)); | 3021 Pop(ExternalOperand(handler_address)); |
3035 addp(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize)); | 3022 addp(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize)); |
3036 } | 3023 } |
3037 | 3024 |
3038 | 3025 |
3039 void MacroAssembler::Ret() { | 3026 void MacroAssembler::Ret() { |
3040 ret(0); | 3027 ret(0); |
3041 } | 3028 } |
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5098 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5085 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
5099 movl(rax, dividend); | 5086 movl(rax, dividend); |
5100 shrl(rax, Immediate(31)); | 5087 shrl(rax, Immediate(31)); |
5101 addl(rdx, rax); | 5088 addl(rdx, rax); |
5102 } | 5089 } |
5103 | 5090 |
5104 | 5091 |
5105 } } // namespace v8::internal | 5092 } } // namespace v8::internal |
5106 | 5093 |
5107 #endif // V8_TARGET_ARCH_X64 | 5094 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |