Commit 6da59ee3 authored by Kim-Anh Tran's avatar Kim-Anh Tran Committed by Commit Bot

[wasm] Remove default value for is_liftoff

AddCode and AddOwnedCode (from NativeModule), as well as the WasmCode
constructor are using a default value (false) for determining whether
the code is liftoff-compiled or not. This CL removes the default
value and requires each call to these functions/constructors to explicitly
set the value.

Change-Id: Icd4187d1710c774826c9134078ec65845bc98dd7
Reviewed-on: https://chromium-review.googlesource.com/928921
Commit-Queue: Kim-Anh Tran <kimanh@google.com>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51475}
parent aff1f378
......@@ -5374,7 +5374,7 @@ WasmCodeWrapper WasmCompilationUnit::FinishTurbofanCompilation(
desc, tf_.job_->compilation_info()->wasm_code_desc()->frame_slot_count,
func_index_,
tf_.job_->compilation_info()->wasm_code_desc()->safepoint_table_offset,
std::move(protected_instructions_));
std::move(protected_instructions_), false);
if (!code) {
return WasmCodeWrapper(code);
}
......
......@@ -402,7 +402,7 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code,
Nothing<uint32_t>(), kind, code->constant_pool_offset(),
(code->has_safepoint_info() ? code->stack_slots() : 0),
(code->has_safepoint_info() ? code->safepoint_table_offset() : 0),
protected_instructions);
protected_instructions, false);
if (ret == nullptr) return nullptr;
intptr_t delta = ret->instructions().start() - code->instruction_start();
int mask = RelocInfo::kApplyMask | RelocInfo::kCodeTargetMask |
......@@ -493,7 +493,7 @@ Address NativeModule::CreateTrampolineTo(Handle<Code> code) {
masm.GetCode(nullptr, &code_desc);
WasmCode* wasm_code = AddOwnedCode(
{code_desc.buffer, static_cast<size_t>(code_desc.instr_size)}, nullptr, 0,
Nothing<uint32_t>(), WasmCode::kTrampoline, 0, 0, 0, {});
Nothing<uint32_t>(), WasmCode::kTrampoline, 0, 0, 0, {}, false);
if (wasm_code == nullptr) return nullptr;
Address ret = wasm_code->instructions().start();
trampolines_.emplace(std::make_pair(dest, ret));
......@@ -696,7 +696,7 @@ WasmCode* NativeModule::CloneCode(const WasmCode* original_code) {
original_code->reloc_info().size(), original_code->index_,
original_code->kind(), original_code->constant_pool_offset_,
original_code->stack_slots(), original_code->safepoint_table_offset_,
original_code->protected_instructions_);
original_code->protected_instructions_, original_code->is_liftoff());
if (ret == nullptr) return nullptr;
if (!ret->IsAnonymous()) {
SetCodeTable(ret->index(), ret);
......
......@@ -144,7 +144,7 @@ class V8_EXPORT_PRIVATE WasmCode final {
size_t constant_pool_offset, uint32_t stack_slots,
size_t safepoint_table_offset,
std::shared_ptr<ProtectedInstructions> protected_instructions,
bool is_liftoff = false)
bool is_liftoff)
: instructions_(instructions),
reloc_info_(std::move(reloc_info)),
reloc_size_(reloc_size),
......@@ -193,8 +193,7 @@ class V8_EXPORT_PRIVATE NativeModule final {
WasmCode* AddCode(const CodeDesc& desc, uint32_t frame_count, uint32_t index,
size_t safepoint_table_offset,
std::unique_ptr<ProtectedInstructions>,
bool is_liftoff = false);
std::unique_ptr<ProtectedInstructions>, bool is_liftoff);
// A way to copy over JS-allocated code. This is because we compile
// certain wrappers using a different pipeline.
......@@ -286,7 +285,7 @@ class V8_EXPORT_PRIVATE NativeModule final {
WasmCode::Kind kind, size_t constant_pool_offset,
uint32_t stack_slots, size_t safepoint_table_offset,
std::shared_ptr<ProtectedInstructions>,
bool is_liftoff = false);
bool is_liftoff);
void SetCodeTable(uint32_t, wasm::WasmCode*);
WasmCode* CloneCode(const WasmCode*);
bool CloneTrampolinesAndStubs(const NativeModule* other);
......
......@@ -7,6 +7,22 @@
load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function testLiftoffFlag() {
print(arguments.callee.name);
const builder = new WasmModuleBuilder();
builder.addFunction('i32_add', kSig_i_ii)
.addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add])
.exportFunc();
const module = new WebAssembly.Module(builder.toBuffer());
const instance = new WebAssembly.Instance(module);
const instance2 = new WebAssembly.Instance(module);
assertEquals(%IsLiftoffFunction(instance.exports.i32_add),
%IsLiftoffFunction(instance2.exports.i32_add));
})();
(function testLiftoffSync() {
print(arguments.callee.name);
const builder = new WasmModuleBuilder();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment