| 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/isolate.h" | 5 #include "src/isolate.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 code = frame->LookupCode(); | 1095 code = frame->LookupCode(); |
| 1096 handler_sp = handler->address() + StackHandlerConstants::kSize; | 1096 handler_sp = handler->address() + StackHandlerConstants::kSize; |
| 1097 offset = Smi::cast(code->handler_table()->get(0))->value(); | 1097 offset = Smi::cast(code->handler_table()->get(0))->value(); |
| 1098 break; | 1098 break; |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 // For optimized frames we perform a lookup in the handler table. | 1101 // For optimized frames we perform a lookup in the handler table. |
| 1102 if (frame->is_optimized() && catchable_by_js) { | 1102 if (frame->is_optimized() && catchable_by_js) { |
| 1103 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); | 1103 OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame); |
| 1104 int stack_slots = 0; // Will contain stack slot count of frame. | 1104 int stack_slots = 0; // Will contain stack slot count of frame. |
| 1105 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, NULL); | 1105 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, nullptr); |
| 1106 if (offset >= 0) { | 1106 if (offset >= 0) { |
| 1107 // Compute the stack pointer from the frame pointer. This ensures that | 1107 // Compute the stack pointer from the frame pointer. This ensures that |
| 1108 // argument slots on the stack are dropped as returning would. | 1108 // argument slots on the stack are dropped as returning would. |
| 1109 Address return_sp = frame->fp() - | 1109 Address return_sp = frame->fp() - |
| 1110 StandardFrameConstants::kFixedFrameSizeFromFp - | 1110 StandardFrameConstants::kFixedFrameSizeFromFp - |
| 1111 stack_slots * kPointerSize; | 1111 stack_slots * kPointerSize; |
| 1112 | 1112 |
| 1113 // Gather information from the frame. | 1113 // Gather information from the frame. |
| 1114 code = frame->LookupCode(); | 1114 code = frame->LookupCode(); |
| 1115 handler_sp = return_sp; | 1115 handler_sp = return_sp; |
| 1116 handler_fp = frame->fp(); | 1116 handler_fp = frame->fp(); |
| 1117 break; | 1117 break; |
| 1118 } | 1118 } |
| 1119 } | 1119 } |
| 1120 | 1120 |
| 1121 // For interpreted frame we perform a range lookup in the handler table. | 1121 // For interpreted frame we perform a range lookup in the handler table. |
| 1122 if (frame->is_interpreted() && catchable_by_js) { | 1122 if (frame->is_interpreted() && catchable_by_js) { |
| 1123 InterpretedFrame* js_frame = static_cast<InterpretedFrame*>(frame); | 1123 InterpretedFrame* js_frame = static_cast<InterpretedFrame*>(frame); |
| 1124 int stack_slots = 0; // Will contain stack slot count of frame. | 1124 int context_reg = 0; // Will contain register index holding context. |
| 1125 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, NULL); | 1125 offset = js_frame->LookupExceptionHandlerInTable(&context_reg, nullptr); |
| 1126 if (offset >= 0) { | 1126 if (offset >= 0) { |
| 1127 // Patch the bytecode offset in the interpreted frame to reflect the | 1127 // Patch the bytecode offset in the interpreted frame to reflect the |
| 1128 // position of the exception handler. The special builtin below will | 1128 // position of the exception handler. The special builtin below will |
| 1129 // take care of continuing to dispatch at that position. | 1129 // take care of continuing to dispatch at that position. Also restore |
| 1130 // the correct context for the handler from the interpreter register. |
| 1131 context = Context::cast(js_frame->GetInterpreterRegister(context_reg)); |
| 1130 js_frame->PatchBytecodeOffset(static_cast<int>(offset)); | 1132 js_frame->PatchBytecodeOffset(static_cast<int>(offset)); |
| 1131 offset = 0; | 1133 offset = 0; |
| 1132 | 1134 |
| 1133 // Gather information from the frame. | 1135 // Gather information from the frame. |
| 1134 code = *builtins()->InterpreterEnterBytecodeDispatch(); | 1136 code = *builtins()->InterpreterEnterBytecodeDispatch(); |
| 1135 handler_sp = frame->sp(); | 1137 handler_sp = frame->sp(); |
| 1136 handler_fp = frame->fp(); | 1138 handler_fp = frame->fp(); |
| 1137 break; | 1139 break; |
| 1138 } | 1140 } |
| 1139 } | 1141 } |
| 1140 | 1142 |
| 1141 // For JavaScript frames we perform a range lookup in the handler table. | 1143 // For JavaScript frames we perform a range lookup in the handler table. |
| 1142 if (frame->is_java_script() && catchable_by_js) { | 1144 if (frame->is_java_script() && catchable_by_js) { |
| 1143 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); | 1145 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); |
| 1144 int stack_slots = 0; // Will contain operand stack depth of handler. | 1146 int stack_depth = 0; // Will contain operand stack depth of handler. |
| 1145 offset = js_frame->LookupExceptionHandlerInTable(&stack_slots, NULL); | 1147 offset = js_frame->LookupExceptionHandlerInTable(&stack_depth, nullptr); |
| 1146 if (offset >= 0) { | 1148 if (offset >= 0) { |
| 1147 // Compute the stack pointer from the frame pointer. This ensures that | 1149 // Compute the stack pointer from the frame pointer. This ensures that |
| 1148 // operand stack slots are dropped for nested statements. Also restore | 1150 // operand stack slots are dropped for nested statements. Also restore |
| 1149 // correct context for the handler which is pushed within the try-block. | 1151 // correct context for the handler which is pushed within the try-block. |
| 1150 Address return_sp = frame->fp() - | 1152 Address return_sp = frame->fp() - |
| 1151 StandardFrameConstants::kFixedFrameSizeFromFp - | 1153 StandardFrameConstants::kFixedFrameSizeFromFp - |
| 1152 stack_slots * kPointerSize; | 1154 stack_depth * kPointerSize; |
| 1153 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); | 1155 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); |
| 1154 context = Context::cast(Memory::Object_at(return_sp - kPointerSize)); | 1156 context = Context::cast(Memory::Object_at(return_sp - kPointerSize)); |
| 1155 | 1157 |
| 1156 // Gather information from the frame. | 1158 // Gather information from the frame. |
| 1157 code = frame->LookupCode(); | 1159 code = frame->LookupCode(); |
| 1158 handler_sp = return_sp; | 1160 handler_sp = return_sp; |
| 1159 handler_fp = frame->fp(); | 1161 handler_fp = frame->fp(); |
| 1160 break; | 1162 break; |
| 1161 } | 1163 } |
| 1162 } | 1164 } |
| (...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2859 // Then check whether this scope intercepts. | 2861 // Then check whether this scope intercepts. |
| 2860 if ((flag & intercept_mask_)) { | 2862 if ((flag & intercept_mask_)) { |
| 2861 intercepted_flags_ |= flag; | 2863 intercepted_flags_ |= flag; |
| 2862 return true; | 2864 return true; |
| 2863 } | 2865 } |
| 2864 return false; | 2866 return false; |
| 2865 } | 2867 } |
| 2866 | 2868 |
| 2867 } // namespace internal | 2869 } // namespace internal |
| 2868 } // namespace v8 | 2870 } // namespace v8 |
| OLD | NEW |