Bug 1592973 - Fix WebAssembly ABIResultIter for stack arguments r=lth
authorAndy Wingo <wingo@igalia.com>
Tue, 05 Nov 2019 15:38:39 +0000
changeset 500612 a9d567f1675794fc506a250121338a7d3d17e44e
parent 500611 f0e9baa206dc4318293804c2c2ccca5c9eb7258e
child 500613 f93228668d163def9ead24e7dfd269b4a2bf09e6
push id99724
push usercsabou@mozilla.com
push dateTue, 05 Nov 2019 15:45:29 +0000
treeherderautoland@a9d567f16757 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1592973
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1592973 - Fix WebAssembly ABIResultIter for stack arguments r=lth Differential Revision: https://phabricator.services.mozilla.com/D51269
js/src/wasm/WasmStubs.cpp
--- a/js/src/wasm/WasmStubs.cpp
+++ b/js/src/wasm/WasmStubs.cpp
@@ -61,17 +61,18 @@ static uint32_t ResultStackSize(ValType 
       MOZ_CRASH("Unexpected result type");
   }
 }
 
 uint32_t ABIResult::size() const { return ResultStackSize(type()); }
 
 void ABIResultIter::settleRegister(ValType type) {
   MOZ_ASSERT(!done());
-  MOZ_ASSERT(index() < RegisterResultCount);
+  MOZ_ASSERT_IF(direction_ == Next, index() < RegisterResultCount);
+  MOZ_ASSERT_IF(direction_ == Prev, index() >= count_ - RegisterResultCount);
   static_assert(RegisterResultCount == 1, "expected a single register result");
 
   switch (type.code()) {
     case ValType::I32:
       cur_ = ABIResult(type, ReturnReg);
       break;
     case ValType::I64:
       cur_ = ABIResult(type, ReturnReg64);