27e36250f7
There was a bug in spilling i64 constants, in that the half stack slot *above* should have been filled with the high word instead of the one *below*. Instead of just fixing this, this CL optimizes spilling x64 constants to the stack by emitting shorter and faster code, especially if the constant fits in 31 bits (which is the majority of cases). R=titzer@chromium.org Bug: v8:7565,v8:6600 Change-Id: Id75ddafe82615930a84333a0c49bd515ccbcc093 Reviewed-on: https://chromium-review.googlesource.com/965062 Reviewed-by: Ben Titzer <titzer@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#51985}
21 lines
913 B
JavaScript
21 lines
913 B
JavaScript
// 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();
|
|
sig0 = makeSig([], [kWasmI32]);
|
|
builder.addFunction(undefined, sig0).addLocals({i64_count: 1}).addBody([
|
|
kExprLoop, kWasmI32, // loop i32
|
|
kExprF32Const, 0x00, 0x00, 0x00, 0x00, // f32.const 0 --> f32:0
|
|
kExprGetLocal, 0x00, // get_local 0 --> i64:0
|
|
kExprF32SConvertI64, // f32.sconvert/i64 --> f32:0
|
|
kExprF32Ge, // f32.ge --> i32:1
|
|
kExprEnd, // end
|
|
]);
|
|
builder.addExport('main', 0);
|
|
const module = builder.instantiate();
|
|
assertEquals(1, module.exports.main());
|