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 1527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 Handle<Name> key = factory()->stack_trace_symbol(); | 1538 Handle<Name> key = factory()->stack_trace_symbol(); |
1539 Handle<Object> property = | 1539 Handle<Object> property = |
1540 JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key); | 1540 JSReceiver::GetDataProperty(Handle<JSObject>::cast(exception), key); |
1541 if (!property->IsJSArray()) return false; | 1541 if (!property->IsJSArray()) return false; |
1542 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); | 1542 Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); |
1543 | 1543 |
1544 Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements())); | 1544 Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements())); |
1545 | 1545 |
1546 const int frame_count = elements->FrameCount(); | 1546 const int frame_count = elements->FrameCount(); |
1547 for (int i = 0; i < frame_count; i++) { | 1547 for (int i = 0; i < frame_count; i++) { |
1548 if (elements->IsWasmFrame(i)) { | 1548 if (elements->IsWasmFrame(i) || elements->IsAsmJsWasmFrame(i)) { |
1549 // TODO(clemensh): Handle wasm frames if they ever need handling here. | |
1550 continue; | |
1551 } | |
1552 | |
1553 if (elements->IsAsmJsWasmFrame(i)) { | |
1554 Handle<WasmCompiledModule> compiled_module( | 1549 Handle<WasmCompiledModule> compiled_module( |
1555 WasmInstanceObject::cast(elements->WasmInstance(i)) | 1550 WasmInstanceObject::cast(elements->WasmInstance(i)) |
1556 ->get_compiled_module()); | 1551 ->get_compiled_module()); |
1557 int func_index = elements->WasmFunctionIndex(i)->value(); | 1552 int func_index = elements->WasmFunctionIndex(i)->value(); |
1558 int code_offset = elements->Offset(i)->value(); | 1553 int code_offset = elements->Offset(i)->value(); |
1559 int byte_pos = elements->Code(i)->SourcePosition(code_offset); | 1554 // TODO(wasm): Clean this up (bug 5007). |
1560 int source_pos = WasmCompiledModule::GetAsmJsSourcePosition( | 1555 int pos = code_offset < 0 |
1561 compiled_module, func_index, byte_pos); | 1556 ? (-1 - code_offset) |
| 1557 : elements->Code(i)->SourcePosition(code_offset); |
| 1558 if (elements->IsAsmJsWasmFrame(i)) { |
| 1559 // For asm.js frames, make an additional translation step to get the |
| 1560 // asm.js source position. |
| 1561 pos = WasmCompiledModule::GetAsmJsSourcePosition(compiled_module, |
| 1562 func_index, pos); |
| 1563 } else { |
| 1564 // For pure wasm, make the function-local position module-relative by |
| 1565 // adding the function offset. |
| 1566 pos += compiled_module->GetFunctionOffset(func_index); |
| 1567 } |
1562 Handle<Script> script = compiled_module->script(); | 1568 Handle<Script> script = compiled_module->script(); |
1563 | 1569 |
1564 *target = MessageLocation(script, source_pos, source_pos + 1); | 1570 *target = MessageLocation(script, pos, pos + 1); |
1565 return true; | 1571 return true; |
1566 } | 1572 } |
1567 | 1573 |
1568 Handle<JSFunction> fun = handle(elements->Function(i), this); | 1574 Handle<JSFunction> fun = handle(elements->Function(i), this); |
1569 if (!fun->shared()->IsSubjectToDebugging()) continue; | 1575 if (!fun->shared()->IsSubjectToDebugging()) continue; |
1570 | 1576 |
1571 Object* script = fun->shared()->script(); | 1577 Object* script = fun->shared()->script(); |
1572 if (script->IsScript() && | 1578 if (script->IsScript() && |
1573 !(Script::cast(script)->source()->IsUndefined(this))) { | 1579 !(Script::cast(script)->source()->IsUndefined(this))) { |
1574 AbstractCode* abstract_code = elements->Code(i); | 1580 AbstractCode* abstract_code = elements->Code(i); |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3516 // Then check whether this scope intercepts. | 3522 // Then check whether this scope intercepts. |
3517 if ((flag & intercept_mask_)) { | 3523 if ((flag & intercept_mask_)) { |
3518 intercepted_flags_ |= flag; | 3524 intercepted_flags_ |= flag; |
3519 return true; | 3525 return true; |
3520 } | 3526 } |
3521 return false; | 3527 return false; |
3522 } | 3528 } |
3523 | 3529 |
3524 } // namespace internal | 3530 } // namespace internal |
3525 } // namespace v8 | 3531 } // namespace v8 |
OLD | NEW |