| 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 2964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2975 | 2975 |
| 2976 | 2976 |
| 2977 Operand MacroAssembler::SafepointRegisterSlot(Register reg) { | 2977 Operand MacroAssembler::SafepointRegisterSlot(Register reg) { |
| 2978 return Operand(rsp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); | 2978 return Operand(rsp, SafepointRegisterStackIndex(reg.code()) * kPointerSize); |
| 2979 } | 2979 } |
| 2980 | 2980 |
| 2981 | 2981 |
| 2982 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 2982 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
| 2983 int handler_index) { | 2983 int handler_index) { |
| 2984 // Adjust this code if not the case. | 2984 // Adjust this code if not the case. |
| 2985 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize + | 2985 STATIC_ASSERT(StackHandlerConstants::kSize == 3 * kPointerSize + |
| 2986 kFPOnStackSize); | 2986 kFPOnStackSize); |
| 2987 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 2987 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
| 2988 STATIC_ASSERT(StackHandlerConstants::kCodeOffset == 1 * kPointerSize); | 2988 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); |
| 2989 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 2 * kPointerSize); | 2989 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); |
| 2990 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 3 * kPointerSize); | 2990 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); |
| 2991 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 4 * kPointerSize); | |
| 2992 | 2991 |
| 2993 // We will build up the handler from the bottom by pushing on the stack. | 2992 // We will build up the handler from the bottom by pushing on the stack. |
| 2994 // First push the frame pointer and context. | 2993 // First push the frame pointer and context. |
| 2995 if (kind == StackHandler::JS_ENTRY) { | 2994 if (kind == StackHandler::JS_ENTRY) { |
| 2996 // The frame pointer does not point to a JS frame so we save NULL for | 2995 // The frame pointer does not point to a JS frame so we save NULL for |
| 2997 // rbp. We expect the code throwing an exception to check rbp before | 2996 // rbp. We expect the code throwing an exception to check rbp before |
| 2998 // dereferencing it to restore the context. | 2997 // dereferencing it to restore the context. |
| 2999 pushq(Immediate(0)); // NULL frame pointer. | 2998 pushq(Immediate(0)); // NULL frame pointer. |
| 3000 Push(Smi::FromInt(0)); // No context. | 2999 Push(Smi::FromInt(0)); // No context. |
| 3001 } else { | 3000 } else { |
| 3002 pushq(rbp); | 3001 pushq(rbp); |
| 3003 Push(rsi); | 3002 Push(rsi); |
| 3004 } | 3003 } |
| 3005 | 3004 |
| 3006 // Push the state and the code object. | 3005 // Push the state. |
| 3007 unsigned state = | 3006 unsigned state = |
| 3008 StackHandler::IndexField::encode(handler_index) | | 3007 StackHandler::IndexField::encode(handler_index) | |
| 3009 StackHandler::KindField::encode(kind); | 3008 StackHandler::KindField::encode(kind); |
| 3010 Push(Immediate(state)); | 3009 Push(Immediate(state)); |
| 3011 Push(CodeObject()); | |
| 3012 | 3010 |
| 3013 // Link the current handler as the next handler. | 3011 // Link the current handler as the next handler. |
| 3014 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 3012 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
| 3015 Push(ExternalOperand(handler_address)); | 3013 Push(ExternalOperand(handler_address)); |
| 3016 // Set this new handler as the current one. | 3014 // Set this new handler as the current one. |
| 3017 movp(ExternalOperand(handler_address), rsp); | 3015 movp(ExternalOperand(handler_address), rsp); |
| 3018 } | 3016 } |
| 3019 | 3017 |
| 3020 | 3018 |
| 3021 void MacroAssembler::PopTryHandler() { | 3019 void MacroAssembler::PopTryHandler() { |
| (...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5088 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5086 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
| 5089 movl(rax, dividend); | 5087 movl(rax, dividend); |
| 5090 shrl(rax, Immediate(31)); | 5088 shrl(rax, Immediate(31)); |
| 5091 addl(rdx, rax); | 5089 addl(rdx, rax); |
| 5092 } | 5090 } |
| 5093 | 5091 |
| 5094 | 5092 |
| 5095 } } // namespace v8::internal | 5093 } } // namespace v8::internal |
| 5096 | 5094 |
| 5097 #endif // V8_TARGET_ARCH_X64 | 5095 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |