| 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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 if (helper.IsStrictFrame(*fun)) flags |= FrameArray::kIsStrict; | 505 if (helper.IsStrictFrame(*fun)) flags |= FrameArray::kIsStrict; |
| 506 if (exit_frame->IsConstructor()) flags |= FrameArray::kForceConstructor; | 506 if (exit_frame->IsConstructor()) flags |= FrameArray::kForceConstructor; |
| 507 | 507 |
| 508 elements = FrameArray::AppendJSFrame(elements, recv, fun, | 508 elements = FrameArray::AppendJSFrame(elements, recv, fun, |
| 509 Handle<AbstractCode>::cast(code), | 509 Handle<AbstractCode>::cast(code), |
| 510 offset, flags); | 510 offset, flags); |
| 511 } break; | 511 } break; |
| 512 | 512 |
| 513 case StackFrame::WASM: { | 513 case StackFrame::WASM: { |
| 514 WasmFrame* wasm_frame = WasmFrame::cast(frame); | 514 WasmFrame* wasm_frame = WasmFrame::cast(frame); |
| 515 Handle<Object> instance(wasm_frame->wasm_instance(), this); | 515 Handle<WasmInstanceObject> instance(wasm_frame->wasm_instance(), this); |
| 516 const int wasm_function_index = wasm_frame->function_index(); | 516 const int wasm_function_index = wasm_frame->function_index(); |
| 517 Code* code = wasm_frame->unchecked_code(); | 517 Code* code = wasm_frame->unchecked_code(); |
| 518 Handle<AbstractCode> abstract_code(AbstractCode::cast(code), this); | 518 Handle<AbstractCode> abstract_code(AbstractCode::cast(code), this); |
| 519 const int offset = | 519 const int offset = |
| 520 static_cast<int>(wasm_frame->pc() - code->instruction_start()); | 520 static_cast<int>(wasm_frame->pc() - code->instruction_start()); |
| 521 | 521 |
| 522 // TODO(wasm): The wasm object returned by the WasmFrame should always | |
| 523 // be a wasm object. | |
| 524 DCHECK(wasm::IsWasmInstance(*instance) || instance->IsUndefined(this)); | |
| 525 | |
| 526 int flags = 0; | 522 int flags = 0; |
| 527 if (wasm::WasmIsAsmJs(*instance, this)) { | 523 if (instance->get_compiled_module()->is_asm_js()) { |
| 528 flags |= FrameArray::kIsAsmJsWasmFrame; | 524 flags |= FrameArray::kIsAsmJsWasmFrame; |
| 529 if (wasm_frame->at_to_number_conversion()) { | 525 if (wasm_frame->at_to_number_conversion()) { |
| 530 flags |= FrameArray::kAsmJsAtNumberConversion; | 526 flags |= FrameArray::kAsmJsAtNumberConversion; |
| 531 } | 527 } |
| 532 } else { | 528 } else { |
| 533 flags |= FrameArray::kIsWasmFrame; | 529 flags |= FrameArray::kIsWasmFrame; |
| 534 } | 530 } |
| 535 | 531 |
| 536 elements = | 532 elements = |
| 537 FrameArray::AppendWasmFrame(elements, instance, wasm_function_index, | 533 FrameArray::AppendWasmFrame(elements, instance, wasm_function_index, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 DCHECK(!fun->shared()->script()->IsScript()); | 697 DCHECK(!fun->shared()->script()->IsScript()); |
| 702 | 698 |
| 703 return stack_frame; | 699 return stack_frame; |
| 704 } | 700 } |
| 705 | 701 |
| 706 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { | 702 Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { |
| 707 Handle<JSObject> stack_frame = | 703 Handle<JSObject> stack_frame = |
| 708 factory()->NewJSObject(isolate_->object_function()); | 704 factory()->NewJSObject(isolate_->object_function()); |
| 709 | 705 |
| 710 if (!function_key_.is_null()) { | 706 if (!function_key_.is_null()) { |
| 711 Handle<String> name = wasm::GetWasmFunctionName( | 707 Handle<WasmCompiledModule> compiled_module( |
| 712 isolate_, handle(frame->wasm_instance(), isolate_), | 708 frame->wasm_instance()->get_compiled_module(), isolate_); |
| 713 frame->function_index()); | 709 Handle<String> name = WasmCompiledModule::GetFunctionName( |
| 710 isolate_, compiled_module, frame->function_index()); |
| 714 JSObject::AddProperty(stack_frame, function_key_, name, NONE); | 711 JSObject::AddProperty(stack_frame, function_key_, name, NONE); |
| 715 } | 712 } |
| 716 // Encode the function index as line number (1-based). | 713 // Encode the function index as line number (1-based). |
| 717 if (!line_key_.is_null()) { | 714 if (!line_key_.is_null()) { |
| 718 JSObject::AddProperty( | 715 JSObject::AddProperty( |
| 719 stack_frame, line_key_, | 716 stack_frame, line_key_, |
| 720 isolate_->factory()->NewNumberFromInt(frame->function_index() + 1), | 717 isolate_->factory()->NewNumberFromInt(frame->function_index() + 1), |
| 721 NONE); | 718 NONE); |
| 722 } | 719 } |
| 723 // Encode the byte offset as column (1-based). | 720 // Encode the byte offset as column (1-based). |
| (...skipping 2864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3588 // Then check whether this scope intercepts. | 3585 // Then check whether this scope intercepts. |
| 3589 if ((flag & intercept_mask_)) { | 3586 if ((flag & intercept_mask_)) { |
| 3590 intercepted_flags_ |= flag; | 3587 intercepted_flags_ |= flag; |
| 3591 return true; | 3588 return true; |
| 3592 } | 3589 } |
| 3593 return false; | 3590 return false; |
| 3594 } | 3591 } |
| 3595 | 3592 |
| 3596 } // namespace internal | 3593 } // namespace internal |
| 3597 } // namespace v8 | 3594 } // namespace v8 |
| OLD | NEW |