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 == 3 * kPointerSize + | 2985 STATIC_ASSERT(StackHandlerConstants::kSize == 3 * kPointerSize); |
2986 kFPOnStackSize); | |
2987 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 2986 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
2988 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); | 2987 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); |
2989 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); | 2988 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); |
2990 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); | |
2991 | 2989 |
2992 // We will build up the handler from the bottom by pushing on the stack. | 2990 // We will build up the handler from the bottom by pushing on the stack. |
2993 // First push the frame pointer and context. | 2991 // First push the context. |
2994 if (kind == StackHandler::JS_ENTRY) { | 2992 if (kind == StackHandler::JS_ENTRY) { |
2995 // The frame pointer does not point to a JS frame so we save NULL for | |
2996 // rbp. We expect the code throwing an exception to check rbp before | |
2997 // dereferencing it to restore the context. | |
2998 pushq(Immediate(0)); // NULL frame pointer. | |
2999 Push(Smi::FromInt(0)); // No context. | 2993 Push(Smi::FromInt(0)); // No context. |
3000 } else { | 2994 } else { |
3001 pushq(rbp); | |
3002 Push(rsi); | 2995 Push(rsi); |
3003 } | 2996 } |
3004 | 2997 |
3005 // Push the state. | 2998 // Push the state. |
3006 unsigned state = | 2999 unsigned state = |
3007 StackHandler::IndexField::encode(handler_index) | | 3000 StackHandler::IndexField::encode(handler_index) | |
3008 StackHandler::KindField::encode(kind); | 3001 StackHandler::KindField::encode(kind); |
3009 Push(Immediate(state)); | 3002 Push(Immediate(state)); |
3010 | 3003 |
3011 // Link the current handler as the next handler. | 3004 // Link the current handler as the next handler. |
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5086 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); | 5079 if (mag.shift > 0) sarl(rdx, Immediate(mag.shift)); |
5087 movl(rax, dividend); | 5080 movl(rax, dividend); |
5088 shrl(rax, Immediate(31)); | 5081 shrl(rax, Immediate(31)); |
5089 addl(rdx, rax); | 5082 addl(rdx, rax); |
5090 } | 5083 } |
5091 | 5084 |
5092 | 5085 |
5093 } } // namespace v8::internal | 5086 } } // namespace v8::internal |
5094 | 5087 |
5095 #endif // V8_TARGET_ARCH_X64 | 5088 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |