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/frames.h" | 5 #include "src/frames.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 accumulator->Add("WASM ["); | 1528 accumulator->Add("WASM ["); |
1529 Script* script = this->script(); | 1529 Script* script = this->script(); |
1530 accumulator->PrintName(script->name()); | 1530 accumulator->PrintName(script->name()); |
1531 int pc = static_cast<int>(this->pc() - LookupCode()->instruction_start()); | 1531 int pc = static_cast<int>(this->pc() - LookupCode()->instruction_start()); |
1532 Vector<const uint8_t> raw_func_name; | 1532 Vector<const uint8_t> raw_func_name; |
1533 Object* instance_or_undef = this->wasm_instance(); | 1533 Object* instance_or_undef = this->wasm_instance(); |
1534 if (instance_or_undef->IsUndefined(this->isolate())) { | 1534 if (instance_or_undef->IsUndefined(this->isolate())) { |
1535 raw_func_name = STATIC_CHAR_VECTOR("<undefined>"); | 1535 raw_func_name = STATIC_CHAR_VECTOR("<undefined>"); |
1536 } else { | 1536 } else { |
1537 raw_func_name = WasmInstanceObject::cast(instance_or_undef) | 1537 raw_func_name = WasmInstanceObject::cast(instance_or_undef) |
1538 ->get_compiled_module() | 1538 ->compiled_module() |
1539 ->GetRawFunctionName(this->function_index()); | 1539 ->GetRawFunctionName(this->function_index()); |
1540 } | 1540 } |
1541 const int kMaxPrintedFunctionName = 64; | 1541 const int kMaxPrintedFunctionName = 64; |
1542 char func_name[kMaxPrintedFunctionName + 1]; | 1542 char func_name[kMaxPrintedFunctionName + 1]; |
1543 int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length()); | 1543 int func_name_len = std::min(kMaxPrintedFunctionName, raw_func_name.length()); |
1544 memcpy(func_name, raw_func_name.start(), func_name_len); | 1544 memcpy(func_name, raw_func_name.start(), func_name_len); |
1545 func_name[func_name_len] = '\0'; | 1545 func_name[func_name_len] = '\0'; |
1546 accumulator->Add("], function #%u ('%s'), pc=%p, pos=%d\n", | 1546 accumulator->Add("], function #%u ('%s'), pc=%p, pos=%d\n", |
1547 this->function_index(), func_name, pc, this->position()); | 1547 this->function_index(), func_name, pc, this->position()); |
1548 if (mode != OVERVIEW) accumulator->Add("\n"); | 1548 if (mode != OVERVIEW) accumulator->Add("\n"); |
(...skipping 22 matching lines...) Expand all Loading... |
1571 return Smi::cast(deopt_data->get(1))->value(); | 1571 return Smi::cast(deopt_data->get(1))->value(); |
1572 } | 1572 } |
1573 | 1573 |
1574 Script* WasmFrame::script() const { | 1574 Script* WasmFrame::script() const { |
1575 Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate()); | 1575 Handle<JSObject> instance(JSObject::cast(wasm_instance()), isolate()); |
1576 return *wasm::GetScript(instance); | 1576 return *wasm::GetScript(instance); |
1577 } | 1577 } |
1578 | 1578 |
1579 int WasmFrame::position() const { | 1579 int WasmFrame::position() const { |
1580 int position = StandardFrame::position(); | 1580 int position = StandardFrame::position(); |
1581 if (wasm_instance()->get_compiled_module()->is_asm_js()) { | 1581 if (wasm_instance()->compiled_module()->is_asm_js()) { |
1582 Handle<WasmCompiledModule> compiled_module( | 1582 Handle<WasmCompiledModule> compiled_module( |
1583 WasmInstanceObject::cast(wasm_instance())->get_compiled_module(), | 1583 WasmInstanceObject::cast(wasm_instance())->compiled_module(), |
1584 isolate()); | 1584 isolate()); |
1585 DCHECK_LE(0, position); | 1585 DCHECK_LE(0, position); |
1586 position = WasmCompiledModule::GetAsmJsSourcePosition( | 1586 position = WasmCompiledModule::GetAsmJsSourcePosition( |
1587 compiled_module, function_index(), static_cast<uint32_t>(position), | 1587 compiled_module, function_index(), static_cast<uint32_t>(position), |
1588 at_to_number_conversion()); | 1588 at_to_number_conversion()); |
1589 } | 1589 } |
1590 return position; | 1590 return position; |
1591 } | 1591 } |
1592 | 1592 |
1593 bool WasmFrame::at_to_number_conversion() const { | 1593 bool WasmFrame::at_to_number_conversion() const { |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2043 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 2043 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
2044 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 2044 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
2045 list.Add(frame, zone); | 2045 list.Add(frame, zone); |
2046 } | 2046 } |
2047 return list.ToVector(); | 2047 return list.ToVector(); |
2048 } | 2048 } |
2049 | 2049 |
2050 | 2050 |
2051 } // namespace internal | 2051 } // namespace internal |
2052 } // namespace v8 | 2052 } // namespace v8 |
OLD | NEW |