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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 offset = 0; | 1291 offset = 0; |
1292 | 1292 |
1293 // Gather information from the frame. | 1293 // Gather information from the frame. |
1294 code = *builtins()->InterpreterEnterBytecodeDispatch(); | 1294 code = *builtins()->InterpreterEnterBytecodeDispatch(); |
1295 handler_sp = return_sp; | 1295 handler_sp = return_sp; |
1296 handler_fp = frame->fp(); | 1296 handler_fp = frame->fp(); |
1297 break; | 1297 break; |
1298 } | 1298 } |
1299 } | 1299 } |
1300 | 1300 |
1301 // For JavaScript frames we perform a range lookup in the handler table. | 1301 // For JavaScript frames we are guaranteed not to find a handler. |
1302 if (frame->is_java_script() && catchable_by_js) { | 1302 if (frame->is_java_script() && catchable_by_js) { |
1303 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); | 1303 JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame); |
1304 int stack_depth = 0; // Will contain operand stack depth of handler. | 1304 offset = js_frame->LookupExceptionHandlerInTable(nullptr, nullptr); |
1305 offset = js_frame->LookupExceptionHandlerInTable(&stack_depth, nullptr); | 1305 CHECK_EQ(-1, offset); |
1306 if (offset >= 0) { | |
1307 // Compute the stack pointer from the frame pointer. This ensures that | |
1308 // operand stack slots are dropped for nested statements. Also restore | |
1309 // correct context for the handler which is pushed within the try-block. | |
1310 Address return_sp = frame->fp() - | |
1311 StandardFrameConstants::kFixedFrameSizeFromFp - | |
1312 stack_depth * kPointerSize; | |
1313 STATIC_ASSERT(TryBlockConstant::kElementCount == 1); | |
1314 context = Context::cast(Memory::Object_at(return_sp - kPointerSize)); | |
1315 | |
1316 // Gather information from the frame. | |
1317 code = frame->LookupCode(); | |
1318 handler_sp = return_sp; | |
1319 handler_fp = frame->fp(); | |
1320 break; | |
1321 } | |
1322 } | 1306 } |
1323 | 1307 |
1324 RemoveMaterializedObjectsOnUnwind(frame); | 1308 RemoveMaterializedObjectsOnUnwind(frame); |
1325 } | 1309 } |
1326 | 1310 |
1327 // Handler must exist. | 1311 // Handler must exist. |
1328 CHECK(code != nullptr); | 1312 CHECK(code != nullptr); |
1329 | 1313 |
1330 // Store information to be consumed by the CEntryStub. | 1314 // Store information to be consumed by the CEntryStub. |
1331 thread_local_top()->pending_handler_context_ = context; | 1315 thread_local_top()->pending_handler_context_ = context; |
(...skipping 18 matching lines...) Expand all Loading... |
1350 List<FrameSummary> summaries; | 1334 List<FrameSummary> summaries; |
1351 frame->Summarize(&summaries); | 1335 frame->Summarize(&summaries); |
1352 for (const FrameSummary& summary : summaries) { | 1336 for (const FrameSummary& summary : summaries) { |
1353 Handle<AbstractCode> code = summary.abstract_code(); | 1337 Handle<AbstractCode> code = summary.abstract_code(); |
1354 if (code->kind() == AbstractCode::OPTIMIZED_FUNCTION) { | 1338 if (code->kind() == AbstractCode::OPTIMIZED_FUNCTION) { |
1355 DCHECK(summary.function()->shared()->asm_function()); | 1339 DCHECK(summary.function()->shared()->asm_function()); |
1356 DCHECK(!FLAG_turbo_asm_deoptimization); | 1340 DCHECK(!FLAG_turbo_asm_deoptimization); |
1357 // asm code cannot contain try-catch. | 1341 // asm code cannot contain try-catch. |
1358 continue; | 1342 continue; |
1359 } | 1343 } |
| 1344 // Must have been constructed from a bytecode array. |
| 1345 CHECK_EQ(AbstractCode::INTERPRETED_FUNCTION, code->kind()); |
1360 int code_offset = summary.code_offset(); | 1346 int code_offset = summary.code_offset(); |
1361 int index = | 1347 int index = code->GetBytecodeArray()->LookupRangeInHandlerTable( |
1362 code->LookupRangeInHandlerTable(code_offset, nullptr, &prediction); | 1348 code_offset, nullptr, &prediction); |
1363 if (index <= 0) continue; | 1349 if (index <= 0) continue; |
1364 if (prediction == HandlerTable::UNCAUGHT) continue; | 1350 if (prediction == HandlerTable::UNCAUGHT) continue; |
1365 return prediction; | 1351 return prediction; |
1366 } | 1352 } |
1367 } | 1353 } |
1368 } else if (frame->LookupExceptionHandlerInTable(nullptr, &prediction) > 0) { | 1354 } else if (frame->LookupExceptionHandlerInTable(nullptr, &prediction) > 0) { |
1369 return prediction; | 1355 return prediction; |
1370 } | 1356 } |
1371 return HandlerTable::UNCAUGHT; | 1357 return HandlerTable::UNCAUGHT; |
1372 } | 1358 } |
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3513 // Then check whether this scope intercepts. | 3499 // Then check whether this scope intercepts. |
3514 if ((flag & intercept_mask_)) { | 3500 if ((flag & intercept_mask_)) { |
3515 intercepted_flags_ |= flag; | 3501 intercepted_flags_ |= flag; |
3516 return true; | 3502 return true; |
3517 } | 3503 } |
3518 return false; | 3504 return false; |
3519 } | 3505 } |
3520 | 3506 |
3521 } // namespace internal | 3507 } // namespace internal |
3522 } // namespace v8 | 3508 } // namespace v8 |
OLD | NEW |