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 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 } | 1262 } |
1263 handler_sp = return_sp; | 1263 handler_sp = return_sp; |
1264 handler_fp = frame->fp(); | 1264 handler_fp = frame->fp(); |
1265 break; | 1265 break; |
1266 } | 1266 } |
1267 } | 1267 } |
1268 | 1268 |
1269 // For interpreted frame we perform a range lookup in the handler table. | 1269 // For interpreted frame we perform a range lookup in the handler table. |
1270 if (frame->is_interpreted() && catchable_by_js) { | 1270 if (frame->is_interpreted() && catchable_by_js) { |
1271 InterpretedFrame* js_frame = static_cast<InterpretedFrame*>(frame); | 1271 InterpretedFrame* js_frame = static_cast<InterpretedFrame*>(frame); |
| 1272 int register_slots = js_frame->GetBytecodeArray()->register_count(); |
1272 int context_reg = 0; // Will contain register index holding context. | 1273 int context_reg = 0; // Will contain register index holding context. |
1273 offset = js_frame->LookupExceptionHandlerInTable(&context_reg, nullptr); | 1274 offset = js_frame->LookupExceptionHandlerInTable(&context_reg, nullptr); |
1274 if (offset >= 0) { | 1275 if (offset >= 0) { |
| 1276 // Compute the stack pointer from the frame pointer. This ensures that |
| 1277 // argument slots on the stack are dropped as returning would. |
| 1278 // Note: This is only needed for interpreted frames that have been |
| 1279 // materialized by the deoptimizer. If there is a handler frame |
| 1280 // in between then {frame->sp()} would already be correct. |
| 1281 Address return_sp = frame->fp() - |
| 1282 InterpreterFrameConstants::kFixedFrameSizeFromFp - |
| 1283 register_slots * kPointerSize; |
| 1284 |
1275 // Patch the bytecode offset in the interpreted frame to reflect the | 1285 // Patch the bytecode offset in the interpreted frame to reflect the |
1276 // position of the exception handler. The special builtin below will | 1286 // position of the exception handler. The special builtin below will |
1277 // take care of continuing to dispatch at that position. Also restore | 1287 // take care of continuing to dispatch at that position. Also restore |
1278 // the correct context for the handler from the interpreter register. | 1288 // the correct context for the handler from the interpreter register. |
1279 context = Context::cast(js_frame->ReadInterpreterRegister(context_reg)); | 1289 context = Context::cast(js_frame->ReadInterpreterRegister(context_reg)); |
1280 js_frame->PatchBytecodeOffset(static_cast<int>(offset)); | 1290 js_frame->PatchBytecodeOffset(static_cast<int>(offset)); |
1281 offset = 0; | 1291 offset = 0; |
1282 | 1292 |
1283 // Gather information from the frame. | 1293 // Gather information from the frame. |
1284 code = *builtins()->InterpreterEnterBytecodeDispatch(); | 1294 code = *builtins()->InterpreterEnterBytecodeDispatch(); |
1285 handler_sp = frame->sp(); | 1295 handler_sp = return_sp; |
1286 handler_fp = frame->fp(); | 1296 handler_fp = frame->fp(); |
1287 break; | 1297 break; |
1288 } | 1298 } |
1289 } | 1299 } |
1290 | 1300 |
1291 // For JavaScript frames we perform a range lookup in the handler table. | 1301 // For JavaScript frames we perform a range lookup in the handler table. |
1292 if (frame->is_java_script() && catchable_by_js) { | 1302 if (frame->is_java_script() && catchable_by_js) { |
1293 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); | 1303 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); |
1294 int stack_depth = 0; // Will contain operand stack depth of handler. | 1304 int stack_depth = 0; // Will contain operand stack depth of handler. |
1295 offset = js_frame->LookupExceptionHandlerInTable(&stack_depth, nullptr); | 1305 offset = js_frame->LookupExceptionHandlerInTable(&stack_depth, nullptr); |
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3503 // Then check whether this scope intercepts. | 3513 // Then check whether this scope intercepts. |
3504 if ((flag & intercept_mask_)) { | 3514 if ((flag & intercept_mask_)) { |
3505 intercepted_flags_ |= flag; | 3515 intercepted_flags_ |= flag; |
3506 return true; | 3516 return true; |
3507 } | 3517 } |
3508 return false; | 3518 return false; |
3509 } | 3519 } |
3510 | 3520 |
3511 } // namespace internal | 3521 } // namespace internal |
3512 } // namespace v8 | 3522 } // namespace v8 |
OLD | NEW |