Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: src/frames.cc

Issue 2555243002: [wasm] Fix location for error in asm.js ToNumber conversion (Closed)
Patch Set: Address comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/frames.h ('K') | « src/frames.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 } 1573 }
1574 1574
1575 int WasmFrame::position() const { 1575 int WasmFrame::position() const {
1576 int position = StandardFrame::position(); 1576 int position = StandardFrame::position();
1577 if (wasm::WasmIsAsmJs(wasm_instance(), isolate())) { 1577 if (wasm::WasmIsAsmJs(wasm_instance(), isolate())) {
1578 Handle<WasmCompiledModule> compiled_module( 1578 Handle<WasmCompiledModule> compiled_module(
1579 WasmInstanceObject::cast(wasm_instance())->get_compiled_module(), 1579 WasmInstanceObject::cast(wasm_instance())->get_compiled_module(),
1580 isolate()); 1580 isolate());
1581 DCHECK_LE(0, position); 1581 DCHECK_LE(0, position);
1582 position = WasmCompiledModule::GetAsmJsSourcePosition( 1582 position = WasmCompiledModule::GetAsmJsSourcePosition(
1583 compiled_module, function_index(), static_cast<uint32_t>(position)); 1583 compiled_module, function_index(), static_cast<uint32_t>(position),
1584 at_to_number_conversion());
1584 } 1585 }
1585 return position; 1586 return position;
1586 } 1587 }
1587 1588
1589 bool WasmFrame::at_to_number_conversion() const {
1590 // WasmToJsFrame::ComputeCallerState encoded this for us in the constant pool
1591 // address ;)
1592 return !!constant_pool_address();
1593 }
1594
1588 int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) { 1595 int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) {
1589 DCHECK_NOT_NULL(stack_slots); 1596 DCHECK_NOT_NULL(stack_slots);
1590 Code* code = LookupCode(); 1597 Code* code = LookupCode();
1591 HandlerTable* table = HandlerTable::cast(code->handler_table()); 1598 HandlerTable* table = HandlerTable::cast(code->handler_table());
1592 int pc_offset = static_cast<int>(pc() - code->entry()); 1599 int pc_offset = static_cast<int>(pc() - code->entry());
1593 *stack_slots = code->stack_slots(); 1600 *stack_slots = code->stack_slots();
1594 return table->LookupReturn(pc_offset); 1601 return table->LookupReturn(pc_offset);
1595 } 1602 }
1596 1603
1604 void WasmToJsFrame::ComputeCallerState(State* state) const {
1605 // Remember at which of the two calls inside it we are, and transfer this
1606 // information to the subsequent WASM frame.
1607 Code* code = unchecked_code();
1608 AbstractCode* abstract_code = AbstractCode::cast(code);
1609 int offset = static_cast<int>(pc() - code->instruction_start());
1610 int at_to_number_call = abstract_code->SourcePosition(offset);
1611 DCHECK(at_to_number_call == 0 || at_to_number_call == 1);
1612 StubFrame::ComputeCallerState(state);
1613 DCHECK_EQ(StackFrame::WASM, ComputeType(iterator_, state));
1614 // Use a little hack here: The constant pool address is not used for wasm
1615 // frames, so use it to encode whether we are at the to_number call.
1616 state->constant_pool_address = reinterpret_cast<Address*>(at_to_number_call);
1617 }
1618
1597 namespace { 1619 namespace {
1598 1620
1599 1621
1600 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, 1622 void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared,
1601 Code* code) { 1623 Code* code) {
1602 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { 1624 if (FLAG_max_stack_trace_source_length != 0 && code != NULL) {
1603 std::ostringstream os; 1625 std::ostringstream os;
1604 os << "--------- s o u r c e c o d e ---------\n" 1626 os << "--------- s o u r c e c o d e ---------\n"
1605 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) 1627 << SourceCodeOf(shared, FLAG_max_stack_trace_source_length)
1606 << "\n-----------------------------------------\n"; 1628 << "\n-----------------------------------------\n";
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 2047 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
2026 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 2048 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
2027 list.Add(frame, zone); 2049 list.Add(frame, zone);
2028 } 2050 }
2029 return list.ToVector(); 2051 return list.ToVector();
2030 } 2052 }
2031 2053
2032 2054
2033 } // namespace internal 2055 } // namespace internal
2034 } // namespace v8 2056 } // namespace v8
OLDNEW
« src/frames.h ('K') | « src/frames.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698