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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 if (helper.IsStrictFrame(*fun)) flags |= FrameArray::kIsStrict; | 503 if (helper.IsStrictFrame(*fun)) flags |= FrameArray::kIsStrict; |
504 if (exit_frame->IsConstructor()) flags |= FrameArray::kForceConstructor; | 504 if (exit_frame->IsConstructor()) flags |= FrameArray::kForceConstructor; |
505 | 505 |
506 elements = FrameArray::AppendJSFrame(elements, recv, fun, | 506 elements = FrameArray::AppendJSFrame(elements, recv, fun, |
507 Handle<AbstractCode>::cast(code), | 507 Handle<AbstractCode>::cast(code), |
508 offset, flags); | 508 offset, flags); |
509 } break; | 509 } break; |
510 | 510 |
511 case StackFrame::WASM: { | 511 case StackFrame::WASM: { |
512 WasmFrame* wasm_frame = WasmFrame::cast(frame); | 512 WasmFrame* wasm_frame = WasmFrame::cast(frame); |
513 Handle<Object> wasm_object(wasm_frame->wasm_obj(), this); | 513 Handle<Object> instance(wasm_frame->wasm_instance(), this); |
514 const int wasm_function_index = wasm_frame->function_index(); | 514 const int wasm_function_index = wasm_frame->function_index(); |
515 Code* code = wasm_frame->unchecked_code(); | 515 Code* code = wasm_frame->unchecked_code(); |
516 Handle<AbstractCode> abstract_code(AbstractCode::cast(code), this); | 516 Handle<AbstractCode> abstract_code(AbstractCode::cast(code), this); |
517 const int offset = | 517 const int offset = |
518 static_cast<int>(wasm_frame->pc() - code->instruction_start()); | 518 static_cast<int>(wasm_frame->pc() - code->instruction_start()); |
519 | 519 |
520 // TODO(wasm): The wasm object returned by the WasmFrame should always | 520 // TODO(wasm): The wasm object returned by the WasmFrame should always |
521 // be a wasm object. | 521 // be a wasm object. |
522 DCHECK(wasm::IsWasmObject(*wasm_object) || | 522 DCHECK(wasm::IsWasmInstance(*instance) || instance->IsUndefined(this)); |
523 wasm_object->IsUndefined(this)); | |
524 | 523 |
525 int flags = wasm::WasmIsAsmJs(*wasm_object, this) | 524 int flags = wasm::WasmIsAsmJs(*instance, this) |
526 ? FrameArray::kIsAsmJsWasmFrame | 525 ? FrameArray::kIsAsmJsWasmFrame |
527 : FrameArray::kIsWasmFrame; | 526 : FrameArray::kIsWasmFrame; |
528 | 527 |
529 elements = FrameArray::AppendWasmFrame(elements, wasm_object, | 528 elements = |
530 wasm_function_index, | 529 FrameArray::AppendWasmFrame(elements, instance, wasm_function_index, |
531 abstract_code, offset, flags); | 530 abstract_code, offset, flags); |
532 } break; | 531 } break; |
533 | 532 |
534 default: | 533 default: |
535 break; | 534 break; |
536 } | 535 } |
537 } | 536 } |
538 | 537 |
539 elements->ShrinkToFit(); | 538 elements->ShrinkToFit(); |
540 | 539 |
541 // TODO(yangguo): Queue this structured stack trace for preprocessing on GC. | 540 // TODO(yangguo): Queue this structured stack trace for preprocessing on GC. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 694 |
696 return stack_frame; | 695 return stack_frame; |
697 } | 696 } |
698 | 697 |
699 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { | 698 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { |
700 Handle<JSObject> stack_frame = | 699 Handle<JSObject> stack_frame = |
701 factory()->NewJSObject(isolate_->object_function()); | 700 factory()->NewJSObject(isolate_->object_function()); |
702 | 701 |
703 if (!function_key_.is_null()) { | 702 if (!function_key_.is_null()) { |
704 Handle<String> name = wasm::GetWasmFunctionName( | 703 Handle<String> name = wasm::GetWasmFunctionName( |
705 isolate_, handle(frame->wasm_obj(), isolate_), | 704 isolate_, handle(frame->wasm_instance(), isolate_), |
706 frame->function_index()); | 705 frame->function_index()); |
707 JSObject::AddProperty(stack_frame, function_key_, name, NONE); | 706 JSObject::AddProperty(stack_frame, function_key_, name, NONE); |
708 } | 707 } |
709 // Encode the function index as line number. | 708 // Encode the function index as line number. |
710 if (!line_key_.is_null()) { | 709 if (!line_key_.is_null()) { |
711 JSObject::AddProperty( | 710 JSObject::AddProperty( |
712 stack_frame, line_key_, | 711 stack_frame, line_key_, |
713 isolate_->factory()->NewNumberFromInt(frame->function_index()), NONE); | 712 isolate_->factory()->NewNumberFromInt(frame->function_index()), NONE); |
714 } | 713 } |
715 // Encode the byte offset as column. | 714 // Encode the byte offset as column. |
(...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3465 // Then check whether this scope intercepts. | 3464 // Then check whether this scope intercepts. |
3466 if ((flag & intercept_mask_)) { | 3465 if ((flag & intercept_mask_)) { |
3467 intercepted_flags_ |= flag; | 3466 intercepted_flags_ |= flag; |
3468 return true; | 3467 return true; |
3469 } | 3468 } |
3470 return false; | 3469 return false; |
3471 } | 3470 } |
3472 | 3471 |
3473 } // namespace internal | 3472 } // namespace internal |
3474 } // namespace v8 | 3473 } // namespace v8 |
OLD | NEW |