| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 513       case StackFrame::WASM: { | 513       case StackFrame::WASM: { | 
| 514         WasmFrame* wasm_frame = WasmFrame::cast(frame); | 514         WasmFrame* wasm_frame = WasmFrame::cast(frame); | 
| 515         Handle<WasmInstanceObject> 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         int flags = 0; | 522         int flags = 0; | 
| 523         if (instance->get_compiled_module()->is_asm_js()) { | 523         if (instance->compiled_module()->is_asm_js()) { | 
| 524           flags |= FrameArray::kIsAsmJsWasmFrame; | 524           flags |= FrameArray::kIsAsmJsWasmFrame; | 
| 525           if (wasm_frame->at_to_number_conversion()) { | 525           if (wasm_frame->at_to_number_conversion()) { | 
| 526             flags |= FrameArray::kAsmJsAtNumberConversion; | 526             flags |= FrameArray::kAsmJsAtNumberConversion; | 
| 527           } | 527           } | 
| 528         } else { | 528         } else { | 
| 529           flags |= FrameArray::kIsWasmFrame; | 529           flags |= FrameArray::kIsWasmFrame; | 
| 530         } | 530         } | 
| 531 | 531 | 
| 532         elements = | 532         elements = | 
| 533             FrameArray::AppendWasmFrame(elements, instance, wasm_function_index, | 533             FrameArray::AppendWasmFrame(elements, instance, wasm_function_index, | 
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 698 | 698 | 
| 699     return stack_frame; | 699     return stack_frame; | 
| 700   } | 700   } | 
| 701 | 701 | 
| 702   Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { | 702   Handle<JSObject> NewStackFrameObject(WasmFrame* frame) { | 
| 703     Handle<JSObject> stack_frame = | 703     Handle<JSObject> stack_frame = | 
| 704         factory()->NewJSObject(isolate_->object_function()); | 704         factory()->NewJSObject(isolate_->object_function()); | 
| 705 | 705 | 
| 706     if (!function_key_.is_null()) { | 706     if (!function_key_.is_null()) { | 
| 707       Handle<WasmCompiledModule> compiled_module( | 707       Handle<WasmCompiledModule> compiled_module( | 
| 708           frame->wasm_instance()->get_compiled_module(), isolate_); | 708           frame->wasm_instance()->compiled_module(), isolate_); | 
| 709       Handle<String> name = WasmCompiledModule::GetFunctionName( | 709       Handle<String> name = WasmCompiledModule::GetFunctionName( | 
| 710           isolate_, compiled_module, frame->function_index()); | 710           isolate_, compiled_module, frame->function_index()); | 
| 711       JSObject::AddProperty(stack_frame, function_key_, name, NONE); | 711       JSObject::AddProperty(stack_frame, function_key_, name, NONE); | 
| 712     } | 712     } | 
| 713     // Encode the function index as line number (1-based). | 713     // Encode the function index as line number (1-based). | 
| 714     if (!line_key_.is_null()) { | 714     if (!line_key_.is_null()) { | 
| 715       JSObject::AddProperty( | 715       JSObject::AddProperty( | 
| 716           stack_frame, line_key_, | 716           stack_frame, line_key_, | 
| 717           isolate_->factory()->NewNumberFromInt(frame->function_index() + 1), | 717           isolate_->factory()->NewNumberFromInt(frame->function_index() + 1), | 
| 718           NONE); | 718           NONE); | 
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1552   if (!property->IsJSArray()) return false; | 1552   if (!property->IsJSArray()) return false; | 
| 1553   Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); | 1553   Handle<JSArray> simple_stack_trace = Handle<JSArray>::cast(property); | 
| 1554 | 1554 | 
| 1555   Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements())); | 1555   Handle<FrameArray> elements(FrameArray::cast(simple_stack_trace->elements())); | 
| 1556 | 1556 | 
| 1557   const int frame_count = elements->FrameCount(); | 1557   const int frame_count = elements->FrameCount(); | 
| 1558   for (int i = 0; i < frame_count; i++) { | 1558   for (int i = 0; i < frame_count; i++) { | 
| 1559     if (elements->IsWasmFrame(i) || elements->IsAsmJsWasmFrame(i)) { | 1559     if (elements->IsWasmFrame(i) || elements->IsAsmJsWasmFrame(i)) { | 
| 1560       Handle<WasmCompiledModule> compiled_module( | 1560       Handle<WasmCompiledModule> compiled_module( | 
| 1561           WasmInstanceObject::cast(elements->WasmInstance(i)) | 1561           WasmInstanceObject::cast(elements->WasmInstance(i)) | 
| 1562               ->get_compiled_module()); | 1562               ->compiled_module()); | 
| 1563       int func_index = elements->WasmFunctionIndex(i)->value(); | 1563       int func_index = elements->WasmFunctionIndex(i)->value(); | 
| 1564       int code_offset = elements->Offset(i)->value(); | 1564       int code_offset = elements->Offset(i)->value(); | 
| 1565       // TODO(wasm): Clean this up (bug 5007). | 1565       // TODO(wasm): Clean this up (bug 5007). | 
| 1566       int pos = code_offset < 0 | 1566       int pos = code_offset < 0 | 
| 1567                     ? (-1 - code_offset) | 1567                     ? (-1 - code_offset) | 
| 1568                     : elements->Code(i)->SourcePosition(code_offset); | 1568                     : elements->Code(i)->SourcePosition(code_offset); | 
| 1569       if (elements->IsAsmJsWasmFrame(i)) { | 1569       if (elements->IsAsmJsWasmFrame(i)) { | 
| 1570         // For asm.js frames, make an additional translation step to get the | 1570         // For asm.js frames, make an additional translation step to get the | 
| 1571         // asm.js source position. | 1571         // asm.js source position. | 
| 1572         bool at_to_number_conversion = | 1572         bool at_to_number_conversion = | 
| 1573             elements->Flags(i)->value() & FrameArray::kAsmJsAtNumberConversion; | 1573             elements->Flags(i)->value() & FrameArray::kAsmJsAtNumberConversion; | 
| 1574         pos = WasmCompiledModule::GetAsmJsSourcePosition( | 1574         pos = WasmCompiledModule::GetAsmJsSourcePosition( | 
| 1575             compiled_module, func_index, pos, at_to_number_conversion); | 1575             compiled_module, func_index, pos, at_to_number_conversion); | 
| 1576       } else { | 1576       } else { | 
| 1577         // For pure wasm, make the function-local position module-relative by | 1577         // For pure wasm, make the function-local position module-relative by | 
| 1578         // adding the function offset. | 1578         // adding the function offset. | 
| 1579         pos += compiled_module->GetFunctionOffset(func_index); | 1579         pos += compiled_module->GetFunctionOffset(func_index); | 
| 1580       } | 1580       } | 
| 1581       Handle<Script> script = compiled_module->script(); | 1581       Handle<Script> script(compiled_module->script()); | 
| 1582 | 1582 | 
| 1583       *target = MessageLocation(script, pos, pos + 1); | 1583       *target = MessageLocation(script, pos, pos + 1); | 
| 1584       return true; | 1584       return true; | 
| 1585     } | 1585     } | 
| 1586 | 1586 | 
| 1587     Handle<JSFunction> fun = handle(elements->Function(i), this); | 1587     Handle<JSFunction> fun = handle(elements->Function(i), this); | 
| 1588     if (!fun->shared()->IsSubjectToDebugging()) continue; | 1588     if (!fun->shared()->IsSubjectToDebugging()) continue; | 
| 1589 | 1589 | 
| 1590     Object* script = fun->shared()->script(); | 1590     Object* script = fun->shared()->script(); | 
| 1591     if (script->IsScript() && | 1591     if (script->IsScript() && | 
| (...skipping 1993 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3585   // Then check whether this scope intercepts. | 3585   // Then check whether this scope intercepts. | 
| 3586   if ((flag & intercept_mask_)) { | 3586   if ((flag & intercept_mask_)) { | 
| 3587     intercepted_flags_ |= flag; | 3587     intercepted_flags_ |= flag; | 
| 3588     return true; | 3588     return true; | 
| 3589   } | 3589   } | 
| 3590   return false; | 3590   return false; | 
| 3591 } | 3591 } | 
| 3592 | 3592 | 
| 3593 }  // namespace internal | 3593 }  // namespace internal | 
| 3594 }  // namespace v8 | 3594 }  // namespace v8 | 
| OLD | NEW | 
|---|