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

Unified 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 side-by-side diff with in-line comments
Download patch
« src/frames.h ('K') | « src/frames.h ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index f34c07ab09c292c1888dc09728ea48a183627604..e9facbc9d98ec0f57d70940cb678bd6589bcb6d3 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -1580,11 +1580,18 @@ int WasmFrame::position() const {
isolate());
DCHECK_LE(0, position);
position = WasmCompiledModule::GetAsmJsSourcePosition(
- compiled_module, function_index(), static_cast<uint32_t>(position));
+ compiled_module, function_index(), static_cast<uint32_t>(position),
+ at_to_number_conversion());
}
return position;
}
+bool WasmFrame::at_to_number_conversion() const {
+ // WasmToJsFrame::ComputeCallerState encoded this for us in the constant pool
+ // address ;)
+ return !!constant_pool_address();
+}
+
int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) {
DCHECK_NOT_NULL(stack_slots);
Code* code = LookupCode();
@@ -1594,6 +1601,21 @@ int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) {
return table->LookupReturn(pc_offset);
}
+void WasmToJsFrame::ComputeCallerState(State* state) const {
+ // Remember at which of the two calls inside it we are, and transfer this
+ // information to the subsequent WASM frame.
+ Code* code = unchecked_code();
+ AbstractCode* abstract_code = AbstractCode::cast(code);
+ int offset = static_cast<int>(pc() - code->instruction_start());
+ int at_to_number_call = abstract_code->SourcePosition(offset);
+ DCHECK(at_to_number_call == 0 || at_to_number_call == 1);
+ StubFrame::ComputeCallerState(state);
+ DCHECK_EQ(StackFrame::WASM, ComputeType(iterator_, state));
+ // Use a little hack here: The constant pool address is not used for wasm
+ // frames, so use it to encode whether we are at the to_number call.
+ state->constant_pool_address = reinterpret_cast<Address*>(at_to_number_call);
+}
+
namespace {
« 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