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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 elements->set(cursor++, *offset); | 426 elements->set(cursor++, *offset); |
427 frames_seen++; | 427 frames_seen++; |
428 } | 428 } |
429 } break; | 429 } break; |
430 | 430 |
431 case StackFrame::WASM: { | 431 case StackFrame::WASM: { |
432 WasmFrame* wasm_frame = WasmFrame::cast(frame); | 432 WasmFrame* wasm_frame = WasmFrame::cast(frame); |
433 Code* code = wasm_frame->unchecked_code(); | 433 Code* code = wasm_frame->unchecked_code(); |
434 Handle<AbstractCode> abstract_code = | 434 Handle<AbstractCode> abstract_code = |
435 Handle<AbstractCode>(AbstractCode::cast(code)); | 435 Handle<AbstractCode>(AbstractCode::cast(code)); |
436 Handle<JSFunction> fun = factory()->NewFunction( | 436 int offset = |
437 factory()->NewStringFromAsciiChecked("<WASM>")); | 437 static_cast<int>(wasm_frame->pc() - code->instruction_start()); |
438 elements = MaybeGrow(this, elements, cursor, cursor + 4); | 438 elements = MaybeGrow(this, elements, cursor, cursor + 4); |
439 // TODO(jfb) Pass module object. | 439 elements->set(cursor++, wasm_frame->wasm_obj()); |
440 elements->set(cursor++, *factory()->undefined_value()); | 440 elements->set(cursor++, Smi::FromInt(wasm_frame->function_index())); |
441 elements->set(cursor++, *fun); | |
442 elements->set(cursor++, *abstract_code); | 441 elements->set(cursor++, *abstract_code); |
443 elements->set(cursor++, Internals::IntToSmi(0)); | 442 elements->set(cursor++, Smi::FromInt(offset)); |
444 frames_seen++; | 443 frames_seen++; |
445 } break; | 444 } break; |
446 | 445 |
447 default: | 446 default: |
448 break; | 447 break; |
449 } | 448 } |
450 } | 449 } |
451 elements->set(0, Smi::FromInt(sloppy_frames)); | 450 elements->set(0, Smi::FromInt(sloppy_frames)); |
452 elements->Shrink(cursor); | 451 elements->Shrink(cursor); |
453 Handle<JSArray> result = factory()->NewJSArrayWithElements(elements); | 452 Handle<JSArray> result = factory()->NewJSArrayWithElements(elements); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 if (options & StackTrace::kIsEval) { | 534 if (options & StackTrace::kIsEval) { |
536 eval_key_ = | 535 eval_key_ = |
537 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval")); | 536 factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("isEval")); |
538 } | 537 } |
539 if (options & StackTrace::kIsConstructor) { | 538 if (options & StackTrace::kIsConstructor) { |
540 constructor_key_ = factory()->InternalizeOneByteString( | 539 constructor_key_ = factory()->InternalizeOneByteString( |
541 STATIC_CHAR_VECTOR("isConstructor")); | 540 STATIC_CHAR_VECTOR("isConstructor")); |
542 } | 541 } |
543 } | 542 } |
544 | 543 |
| 544 Handle<JSObject> NewStackFrameObject(FrameSummary& summ) { |
| 545 int position = summ.abstract_code()->SourcePosition(summ.code_offset()); |
| 546 return NewStackFrameObject(summ.function(), position, |
| 547 summ.is_constructor()); |
| 548 } |
| 549 |
545 Handle<JSObject> NewStackFrameObject(Handle<JSFunction> fun, int position, | 550 Handle<JSObject> NewStackFrameObject(Handle<JSFunction> fun, int position, |
546 bool is_constructor) { | 551 bool is_constructor) { |
547 Handle<JSObject> stack_frame = | 552 Handle<JSObject> stack_frame = |
548 factory()->NewJSObject(isolate_->object_function()); | 553 factory()->NewJSObject(isolate_->object_function()); |
| 554 Handle<Script> script(Script::cast(fun->shared()->script())); |
549 | 555 |
550 // TODO(clemensh): this can be changed to a DCHECK once also WASM frames | 556 if (!line_key_.is_null()) { |
551 // define a script | 557 int script_line_offset = script->line_offset(); |
552 if (!fun->shared()->script()->IsUndefined()) { | 558 int line_number = Script::GetLineNumber(script, position); |
553 Handle<Script> script(Script::cast(fun->shared()->script())); | 559 // line_number is already shifted by the script_line_offset. |
554 | 560 int relative_line_number = line_number - script_line_offset; |
555 if (!line_key_.is_null()) { | 561 if (!column_key_.is_null() && relative_line_number >= 0) { |
556 int script_line_offset = script->line_offset(); | 562 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); |
557 int line_number = Script::GetLineNumber(script, position); | 563 int start = |
558 // line_number is already shifted by the script_line_offset. | 564 (relative_line_number == 0) |
559 int relative_line_number = line_number - script_line_offset; | 565 ? 0 |
560 if (!column_key_.is_null() && relative_line_number >= 0) { | 566 : Smi::cast(line_ends->get(relative_line_number - 1))->value() + |
561 Handle<FixedArray> line_ends(FixedArray::cast(script->line_ends())); | 567 1; |
562 int start = (relative_line_number == 0) | 568 int column_offset = position - start; |
563 ? 0 | 569 if (relative_line_number == 0) { |
564 : Smi::cast(line_ends->get(relative_line_number - 1)) | 570 // For the case where the code is on the same line as the script tag. |
565 ->value() + | 571 column_offset += script->column_offset(); |
566 1; | |
567 int column_offset = position - start; | |
568 if (relative_line_number == 0) { | |
569 // For the case where the code is on the same line as the script | |
570 // tag. | |
571 column_offset += script->column_offset(); | |
572 } | |
573 JSObject::AddProperty( | |
574 stack_frame, column_key_, | |
575 handle(Smi::FromInt(column_offset + 1), isolate_), NONE); | |
576 } | 572 } |
577 JSObject::AddProperty(stack_frame, line_key_, | 573 JSObject::AddProperty(stack_frame, column_key_, |
578 handle(Smi::FromInt(line_number + 1), isolate_), | 574 handle(Smi::FromInt(column_offset + 1), isolate_), |
579 NONE); | 575 NONE); |
580 } | 576 } |
| 577 JSObject::AddProperty(stack_frame, line_key_, |
| 578 handle(Smi::FromInt(line_number + 1), isolate_), |
| 579 NONE); |
| 580 } |
581 | 581 |
582 if (!script_id_key_.is_null()) { | 582 if (!script_id_key_.is_null()) { |
583 JSObject::AddProperty(stack_frame, script_id_key_, | 583 JSObject::AddProperty(stack_frame, script_id_key_, |
584 handle(Smi::FromInt(script->id()), isolate_), | 584 handle(Smi::FromInt(script->id()), isolate_), NONE); |
585 NONE); | 585 } |
586 } | |
587 | 586 |
588 if (!script_name_key_.is_null()) { | 587 if (!script_name_key_.is_null()) { |
589 JSObject::AddProperty(stack_frame, script_name_key_, | 588 JSObject::AddProperty(stack_frame, script_name_key_, |
590 handle(script->name(), isolate_), NONE); | 589 handle(script->name(), isolate_), NONE); |
591 } | 590 } |
592 | 591 |
593 if (!script_name_or_source_url_key_.is_null()) { | 592 if (!script_name_or_source_url_key_.is_null()) { |
594 Handle<Object> result = Script::GetNameOrSourceURL(script); | 593 Handle<Object> result = Script::GetNameOrSourceURL(script); |
595 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, | 594 JSObject::AddProperty(stack_frame, script_name_or_source_url_key_, result, |
596 result, NONE); | 595 NONE); |
597 } | 596 } |
598 | 597 |
599 if (!eval_key_.is_null()) { | 598 if (!eval_key_.is_null()) { |
600 Handle<Object> is_eval = factory()->ToBoolean( | 599 Handle<Object> is_eval = factory()->ToBoolean( |
601 script->compilation_type() == Script::COMPILATION_TYPE_EVAL); | 600 script->compilation_type() == Script::COMPILATION_TYPE_EVAL); |
602 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE); | 601 JSObject::AddProperty(stack_frame, eval_key_, is_eval, NONE); |
603 } | |
604 } | 602 } |
605 | 603 |
606 if (!function_key_.is_null()) { | 604 if (!function_key_.is_null()) { |
607 Handle<Object> fun_name = JSFunction::GetDebugName(fun); | 605 Handle<Object> fun_name = JSFunction::GetDebugName(fun); |
608 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); | 606 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); |
609 } | 607 } |
610 | 608 |
611 if (!constructor_key_.is_null()) { | 609 if (!constructor_key_.is_null()) { |
612 Handle<Object> is_constructor_obj = factory()->ToBoolean(is_constructor); | 610 Handle<Object> is_constructor_obj = factory()->ToBoolean(is_constructor); |
613 JSObject::AddProperty(stack_frame, constructor_key_, is_constructor_obj, | 611 JSObject::AddProperty(stack_frame, constructor_key_, is_constructor_obj, |
614 NONE); | 612 NONE); |
615 } | 613 } |
| 614 return stack_frame; |
| 615 } |
| 616 |
| 617 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { |
| 618 Handle<JSObject> stack_frame = |
| 619 factory()->NewJSObject(isolate_->object_function()); |
| 620 |
| 621 if (!function_key_.is_null()) { |
| 622 Handle<Object> fun_name = handle(frame->function_name(), isolate_); |
| 623 if (fun_name->IsUndefined()) |
| 624 fun_name = isolate_->factory()->InternalizeUtf8String( |
| 625 Vector<const char>("<WASM>")); |
| 626 JSObject::AddProperty(stack_frame, function_key_, fun_name, NONE); |
| 627 } |
| 628 // Encode the function index as line number. |
| 629 if (!line_key_.is_null()) { |
| 630 JSObject::AddProperty( |
| 631 stack_frame, line_key_, |
| 632 isolate_->factory()->NewNumberFromInt(frame->function_index()), NONE); |
| 633 } |
| 634 // Encode the byte offset as column. |
| 635 if (!column_key_.is_null()) { |
| 636 Code* code = frame->LookupCode(); |
| 637 int offset = static_cast<int>(frame->pc() - code->instruction_start()); |
| 638 int position = code->SourcePosition(offset); |
| 639 JSObject::AddProperty(stack_frame, column_key_, |
| 640 isolate_->factory()->NewNumberFromInt(position), |
| 641 NONE); |
| 642 } |
616 | 643 |
617 return stack_frame; | 644 return stack_frame; |
618 } | 645 } |
619 | 646 |
620 private: | 647 private: |
621 inline Factory* factory() { return isolate_->factory(); } | 648 inline Factory* factory() { return isolate_->factory(); } |
622 | 649 |
623 Isolate* isolate_; | 650 Isolate* isolate_; |
624 Handle<String> column_key_; | 651 Handle<String> column_key_; |
625 Handle<String> line_key_; | 652 Handle<String> line_key_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 } | 711 } |
685 | 712 |
686 | 713 |
687 Handle<JSArray> Isolate::CaptureCurrentStackTrace( | 714 Handle<JSArray> Isolate::CaptureCurrentStackTrace( |
688 int frame_limit, StackTrace::StackTraceOptions options) { | 715 int frame_limit, StackTrace::StackTraceOptions options) { |
689 CaptureStackTraceHelper helper(this, options); | 716 CaptureStackTraceHelper helper(this, options); |
690 | 717 |
691 // Ensure no negative values. | 718 // Ensure no negative values. |
692 int limit = Max(frame_limit, 0); | 719 int limit = Max(frame_limit, 0); |
693 Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit); | 720 Handle<JSArray> stack_trace = factory()->NewJSArray(frame_limit); |
| 721 Handle<FixedArray> stack_trace_elems( |
| 722 FixedArray::cast(stack_trace->elements()), this); |
694 | 723 |
695 StackTraceFrameIterator it(this); | |
696 int frames_seen = 0; | 724 int frames_seen = 0; |
697 while (!it.done() && (frames_seen < limit)) { | 725 for (StackTraceFrameIterator it(this); !it.done() && (frames_seen < limit); |
| 726 it.Advance()) { |
698 StandardFrame* frame = it.frame(); | 727 StandardFrame* frame = it.frame(); |
699 // Set initial size to the maximum inlining level + 1 for the outermost | 728 if (frame->is_java_script()) { |
700 // function. | 729 // Set initial size to the maximum inlining level + 1 for the outermost |
701 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | 730 // function. |
702 frame->Summarize(&frames); | 731 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
703 for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { | 732 JavaScriptFrame::cast(frame)->Summarize(&frames); |
704 Handle<JSFunction> fun = frames[i].function(); | 733 for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { |
705 // Filter frames from other security contexts. | 734 Handle<JSFunction> fun = frames[i].function(); |
706 if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) && | 735 // Filter frames from other security contexts. |
707 !this->context()->HasSameSecurityTokenAs(fun->context())) continue; | 736 if (!(options & StackTrace::kExposeFramesAcrossSecurityOrigins) && |
708 int position = | 737 !this->context()->HasSameSecurityTokenAs(fun->context())) |
709 frames[i].abstract_code()->SourcePosition(frames[i].code_offset()); | 738 continue; |
710 Handle<JSObject> stack_frame = | 739 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(frames[i]); |
711 helper.NewStackFrameObject(fun, position, frames[i].is_constructor()); | 740 stack_trace_elems->set(frames_seen, *new_frame_obj); |
712 | 741 frames_seen++; |
713 FixedArray::cast(stack_trace->elements())->set(frames_seen, *stack_frame); | 742 } |
| 743 } else { |
| 744 WasmFrame* wasm_frame = WasmFrame::cast(frame); |
| 745 Handle<JSObject> new_frame_obj = helper.NewStackFrameObject(wasm_frame); |
| 746 stack_trace_elems->set(frames_seen, *new_frame_obj); |
714 frames_seen++; | 747 frames_seen++; |
715 } | 748 } |
716 it.Advance(); | |
717 } | 749 } |
718 | 750 |
719 stack_trace->set_length(Smi::FromInt(frames_seen)); | 751 stack_trace->set_length(Smi::FromInt(frames_seen)); |
720 return stack_trace; | 752 return stack_trace; |
721 } | 753 } |
722 | 754 |
723 | 755 |
724 void Isolate::PrintStack(FILE* out, PrintStackMode mode) { | 756 void Isolate::PrintStack(FILE* out, PrintStackMode mode) { |
725 if (stack_trace_nesting_level_ == 0) { | 757 if (stack_trace_nesting_level_ == 0) { |
726 stack_trace_nesting_level_++; | 758 stack_trace_nesting_level_++; |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 StackTraceFrameIterator it(this); | 1357 StackTraceFrameIterator it(this); |
1326 while (!it.done()) { | 1358 while (!it.done()) { |
1327 HandleScope scope(this); | 1359 HandleScope scope(this); |
1328 // Find code position if recorded in relocation info. | 1360 // Find code position if recorded in relocation info. |
1329 StandardFrame* frame = it.frame(); | 1361 StandardFrame* frame = it.frame(); |
1330 int pos; | 1362 int pos; |
1331 if (frame->is_interpreted()) { | 1363 if (frame->is_interpreted()) { |
1332 InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame); | 1364 InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame); |
1333 pos = iframe->GetBytecodeArray()->SourcePosition( | 1365 pos = iframe->GetBytecodeArray()->SourcePosition( |
1334 iframe->GetBytecodeOffset()); | 1366 iframe->GetBytecodeOffset()); |
1335 } else { | 1367 } else if (frame->is_java_script()) { |
1336 Code* code = frame->LookupCode(); | 1368 Code* code = frame->LookupCode(); |
1337 int offset = static_cast<int>(frame->pc() - code->instruction_start()); | 1369 int offset = static_cast<int>(frame->pc() - code->instruction_start()); |
1338 pos = frame->LookupCode()->SourcePosition(offset); | 1370 pos = frame->LookupCode()->SourcePosition(offset); |
| 1371 } else { |
| 1372 DCHECK(frame->is_wasm()); |
| 1373 // TODO(clemensh): include wasm frames here |
| 1374 continue; |
1339 } | 1375 } |
| 1376 JavaScriptFrame* js_frame = JavaScriptFrame::cast(frame); |
1340 Handle<Object> pos_obj(Smi::FromInt(pos), this); | 1377 Handle<Object> pos_obj(Smi::FromInt(pos), this); |
1341 // Fetch function and receiver. | 1378 // Fetch function and receiver. |
1342 Handle<JSFunction> fun(frame->function()); | 1379 Handle<JSFunction> fun(js_frame->function()); |
1343 Handle<Object> recv(frame->receiver(), this); | 1380 Handle<Object> recv(js_frame->receiver(), this); |
1344 // Advance to the next JavaScript frame and determine if the | 1381 // Advance to the next JavaScript frame and determine if the |
1345 // current frame is the top-level frame. | 1382 // current frame is the top-level frame. |
1346 it.Advance(); | 1383 it.Advance(); |
1347 Handle<Object> is_top_level = factory()->ToBoolean(it.done()); | 1384 Handle<Object> is_top_level = factory()->ToBoolean(it.done()); |
1348 // Generate and print stack trace line. | 1385 // Generate and print stack trace line. |
1349 Handle<String> line = | 1386 Handle<String> line = |
1350 Execution::GetStackTraceLine(recv, fun, pos_obj, is_top_level); | 1387 Execution::GetStackTraceLine(recv, fun, pos_obj, is_top_level); |
1351 if (line->length() > 0) { | 1388 if (line->length() > 0) { |
1352 line->PrintOn(out); | 1389 line->PrintOn(out); |
1353 PrintF(out, "\n"); | 1390 PrintF(out, "\n"); |
1354 } | 1391 } |
1355 } | 1392 } |
1356 } | 1393 } |
1357 | 1394 |
1358 | |
1359 bool Isolate::ComputeLocation(MessageLocation* target) { | 1395 bool Isolate::ComputeLocation(MessageLocation* target) { |
1360 StackTraceFrameIterator it(this); | 1396 StackTraceFrameIterator it(this); |
1361 if (!it.done()) { | 1397 if (it.done()) return false; |
1362 StandardFrame* frame = it.frame(); | 1398 StandardFrame* frame = it.frame(); |
1363 JSFunction* fun = frame->function(); | 1399 // TODO(clemensh): handle wasm frames |
1364 Object* script = fun->shared()->script(); | 1400 if (!frame->is_java_script()) return false; |
1365 if (script->IsScript() && | 1401 JSFunction* fun = JavaScriptFrame::cast(frame)->function(); |
1366 !(Script::cast(script)->source()->IsUndefined())) { | 1402 Object* script = fun->shared()->script(); |
1367 Handle<Script> casted_script(Script::cast(script)); | 1403 if (!script->IsScript() || (Script::cast(script)->source()->IsUndefined())) { |
1368 // Compute the location from the function and the relocation info of the | 1404 return false; |
1369 // baseline code. For optimized code this will use the deoptimization | |
1370 // information to get canonical location information. | |
1371 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); | |
1372 frame->Summarize(&frames); | |
1373 FrameSummary& summary = frames.last(); | |
1374 int pos = summary.abstract_code()->SourcePosition(summary.code_offset()); | |
1375 *target = MessageLocation(casted_script, pos, pos + 1, handle(fun)); | |
1376 return true; | |
1377 } | |
1378 } | 1405 } |
1379 return false; | 1406 Handle<Script> casted_script(Script::cast(script)); |
| 1407 // Compute the location from the function and the relocation info of the |
| 1408 // baseline code. For optimized code this will use the deoptimization |
| 1409 // information to get canonical location information. |
| 1410 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 1411 JavaScriptFrame::cast(frame)->Summarize(&frames); |
| 1412 FrameSummary& summary = frames.last(); |
| 1413 int pos = summary.abstract_code()->SourcePosition(summary.code_offset()); |
| 1414 *target = MessageLocation(casted_script, pos, pos + 1, handle(fun)); |
| 1415 return true; |
1380 } | 1416 } |
1381 | 1417 |
1382 | |
1383 bool Isolate::ComputeLocationFromException(MessageLocation* target, | 1418 bool Isolate::ComputeLocationFromException(MessageLocation* target, |
1384 Handle<Object> exception) { | 1419 Handle<Object> exception) { |
1385 if (!exception->IsJSObject()) return false; | 1420 if (!exception->IsJSObject()) return false; |
1386 | 1421 |
1387 Handle<Name> start_pos_symbol = factory()->error_start_pos_symbol(); | 1422 Handle<Name> start_pos_symbol = factory()->error_start_pos_symbol(); |
1388 Handle<Object> start_pos = JSReceiver::GetDataProperty( | 1423 Handle<Object> start_pos = JSReceiver::GetDataProperty( |
1389 Handle<JSObject>::cast(exception), start_pos_symbol); | 1424 Handle<JSObject>::cast(exception), start_pos_symbol); |
1390 if (!start_pos->IsSmi()) return false; | 1425 if (!start_pos->IsSmi()) return false; |
1391 int start_pos_value = Handle<Smi>::cast(start_pos)->value(); | 1426 int start_pos_value = Handle<Smi>::cast(start_pos)->value(); |
1392 | 1427 |
(...skipping 20 matching lines...) Expand all Loading... |
1413 Handle<Name> key = factory()->stack_trace_symbol(); | 1448 Handle<Name> key = factory()->stack_trace_symbol(); |
1414 Handle<Object> property = | 1449 Handle<Object> property = |
1415 JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key); | 1450 JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key); |
1416 if (!property->IsJSArray()) return false; | 1451 if (!property->IsJSArray()) return false; |
1417 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); | 1452 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); |
1418 | 1453 |
1419 Handle<FixedArray> elements(FixedArray::cast(simple_stack_trace->elements())); | 1454 Handle<FixedArray> elements(FixedArray::cast(simple_stack_trace->elements())); |
1420 int elements_limit = Smi::cast(simple_stack_trace->length())->value(); | 1455 int elements_limit = Smi::cast(simple_stack_trace->length())->value(); |
1421 | 1456 |
1422 for (int i = 1; i < elements_limit; i += 4) { | 1457 for (int i = 1; i < elements_limit; i += 4) { |
1423 Handle<JSFunction> fun = | 1458 Handle<Object> fun_obj = handle(elements->get(i + 1), this); |
1424 handle(JSFunction::cast(elements->get(i + 1)), this); | 1459 if (fun_obj->IsSmi()) { |
| 1460 // TODO(clemensh): handle wasm frames |
| 1461 return false; |
| 1462 } |
| 1463 Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); |
1425 if (!fun->shared()->IsSubjectToDebugging()) continue; | 1464 if (!fun->shared()->IsSubjectToDebugging()) continue; |
1426 | 1465 |
1427 Object* script = fun->shared()->script(); | 1466 Object* script = fun->shared()->script(); |
1428 if (script->IsScript() && | 1467 if (script->IsScript() && |
1429 !(Script::cast(script)->source()->IsUndefined())) { | 1468 !(Script::cast(script)->source()->IsUndefined())) { |
1430 int pos = PositionFromStackTrace(elements, i); | 1469 int pos = PositionFromStackTrace(elements, i); |
1431 Handle<Script> casted_script(Script::cast(script)); | 1470 Handle<Script> casted_script(Script::cast(script)); |
1432 *target = MessageLocation(casted_script, pos, pos + 1); | 1471 *target = MessageLocation(casted_script, pos, pos + 1); |
1433 return true; | 1472 return true; |
1434 } | 1473 } |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2999 // Then check whether this scope intercepts. | 3038 // Then check whether this scope intercepts. |
3000 if ((flag & intercept_mask_)) { | 3039 if ((flag & intercept_mask_)) { |
3001 intercepted_flags_ |= flag; | 3040 intercepted_flags_ |= flag; |
3002 return true; | 3041 return true; |
3003 } | 3042 } |
3004 return false; | 3043 return false; |
3005 } | 3044 } |
3006 | 3045 |
3007 } // namespace internal | 3046 } // namespace internal |
3008 } // namespace v8 | 3047 } // namespace v8 |
OLD | NEW |