[Liftoff] Fix get_use_count for register pairs

R=ahaas@chromium.org

Bug: v8:7508, v8:6600
Change-Id: I9eb04171eb489383bb746e2d04c6ffff304b7918
Reviewed-on: https://chromium-review.googlesource.com/942821
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51652}
This commit is contained in:
Clemens Hammacher 2018-03-01 12:47:53 +01:00 committed by Commit Bot
parent 9dd6f0d089
commit 08a9e3eb20
2 changed files with 26 additions and 0 deletions

View File

@ -187,6 +187,11 @@ class LiftoffAssembler : public TurboAssembler {
} }
uint32_t get_use_count(LiftoffRegister reg) const { uint32_t get_use_count(LiftoffRegister reg) const {
if (reg.is_pair()) {
DCHECK_EQ(register_use_count[reg.low().liftoff_code()],
register_use_count[reg.high().liftoff_code()]);
reg = reg.low();
}
DCHECK_GT(arraysize(register_use_count), reg.liftoff_code()); DCHECK_GT(arraysize(register_use_count), reg.liftoff_code());
return register_use_count[reg.liftoff_code()]; return register_use_count[reg.liftoff_code()];
} }

View File

@ -0,0 +1,21 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
builder.addFunction(undefined, kSig_v_v).addLocals({i64_count: 1}).addBody([
kExprI64Const, 0xeb, 0xd7, 0xaf, 0xdf,
0xbe, 0xfd, 0xfa, 0xf5, 0x6b, // i64.const
kExprI32Const, 0, // i32.const
kExprIf, kWasmI32, // if i32
kExprI32Const, 0, // i32.const
kExprElse, // else
kExprI32Const, 0, // i32.const
kExprEnd, // end
kExprBrIf, 0, // br_if depth=0
kExprSetLocal, 0, // set_local 0
]);
builder.instantiate();