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

Unified Diff: src/frames.cc

Issue 2555243002: [wasm] Fix location for error in asm.js ToNumber conversion (Closed)
Patch Set: Address Michis 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
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index f34c07ab09c292c1888dc09728ea48a183627604..ff9ca9dd601b496e812fc2bb9d63c77570a9206f 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -1580,11 +1580,20 @@ 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. If there was no WasmToJsFrame above us, we just return false here,
+ // but this information is not relevant in this case anyway.
+ intptr_t addr_int = reinterpret_cast<intptr_t>(constant_pool_address());
+ return addr_int == 1;
+}
+
int WasmFrame::LookupExceptionHandlerInTable(int* stack_slots) {
DCHECK_NOT_NULL(stack_slots);
Code* code = LookupCode();
@@ -1594,6 +1603,20 @@ 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);
+ // 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 {

Powered by Google App Engine
This is Rietveld 408576698