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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 mov(esp, ebp); | 983 mov(esp, ebp); |
984 pop(ebp); | 984 pop(ebp); |
985 | 985 |
986 LeaveExitFrameEpilogue(restore_context); | 986 LeaveExitFrameEpilogue(restore_context); |
987 } | 987 } |
988 | 988 |
989 | 989 |
990 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, | 990 void MacroAssembler::PushTryHandler(StackHandler::Kind kind, |
991 int handler_index) { | 991 int handler_index) { |
992 // Adjust this code if not the case. | 992 // Adjust this code if not the case. |
993 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 993 STATIC_ASSERT(StackHandlerConstants::kSize == 3 * kPointerSize); |
994 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); | 994 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0); |
995 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); | 995 STATIC_ASSERT(StackHandlerConstants::kStateOffset == 1 * kPointerSize); |
996 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); | 996 STATIC_ASSERT(StackHandlerConstants::kContextOffset == 2 * kPointerSize); |
997 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 3 * kPointerSize); | |
998 | 997 |
999 // We will build up the handler from the bottom by pushing on the stack. | 998 // We will build up the handler from the bottom by pushing on the stack. |
1000 // First push the frame pointer and context. | 999 // First push the context. |
1001 if (kind == StackHandler::JS_ENTRY) { | 1000 if (kind == StackHandler::JS_ENTRY) { |
1002 // The frame pointer does not point to a JS frame so we save NULL for | |
1003 // ebp. We expect the code throwing an exception to check ebp before | |
1004 // dereferencing it to restore the context. | |
1005 push(Immediate(0)); // NULL frame pointer. | |
1006 push(Immediate(Smi::FromInt(0))); // No context. | 1001 push(Immediate(Smi::FromInt(0))); // No context. |
1007 } else { | 1002 } else { |
1008 push(ebp); | |
1009 push(esi); | 1003 push(esi); |
1010 } | 1004 } |
1011 // Push the state. | 1005 // Push the state. |
1012 unsigned state = | 1006 unsigned state = |
1013 StackHandler::IndexField::encode(handler_index) | | 1007 StackHandler::IndexField::encode(handler_index) | |
1014 StackHandler::KindField::encode(kind); | 1008 StackHandler::KindField::encode(kind); |
1015 push(Immediate(state)); | 1009 push(Immediate(state)); |
1016 | 1010 |
1017 // Link the current handler as the next handler. | 1011 // Link the current handler as the next handler. |
1018 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); | 1012 ExternalReference handler_address(Isolate::kHandlerAddress, isolate()); |
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 if (mag.shift > 0) sar(edx, mag.shift); | 3106 if (mag.shift > 0) sar(edx, mag.shift); |
3113 mov(eax, dividend); | 3107 mov(eax, dividend); |
3114 shr(eax, 31); | 3108 shr(eax, 31); |
3115 add(edx, eax); | 3109 add(edx, eax); |
3116 } | 3110 } |
3117 | 3111 |
3118 | 3112 |
3119 } } // namespace v8::internal | 3113 } } // namespace v8::internal |
3120 | 3114 |
3121 #endif // V8_TARGET_ARCH_X87 | 3115 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |