[wasm] Rename type to value in Global constructor
This was renamed recently in the spec. Change-Id: I825e47e8b4113ddb2c3356ee8e7663705ba65e1c Reviewed-on: https://chromium-review.googlesource.com/1079851 Reviewed-by: Andreas Haas <ahaas@chromium.org> Commit-Queue: Ben Smith <binji@chromium.org> Cr-Commit-Position: refs/heads/master@{#53448}
This commit is contained in:
parent
53d4dfc377
commit
b466a99f91
@ -888,11 +888,13 @@ void WebAssemblyGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
}
|
||||
}
|
||||
|
||||
// The descriptor's 'type'.
|
||||
// The descriptor's type, called 'value'. It is called 'value' because this
|
||||
// descriptor is planned to be re-used as the global's type for reflection,
|
||||
// so calling it 'type' is redundant.
|
||||
i::wasm::ValueType type;
|
||||
{
|
||||
v8::MaybeLocal<v8::Value> maybe =
|
||||
descriptor->Get(context, v8_str(isolate, "type"));
|
||||
descriptor->Get(context, v8_str(isolate, "value"));
|
||||
v8::Local<v8::Value> value;
|
||||
if (!maybe.ToLocal(&value)) return;
|
||||
v8::Local<v8::String> string;
|
||||
@ -909,7 +911,7 @@ void WebAssemblyGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
||||
type = i::wasm::kWasmF64;
|
||||
} else {
|
||||
thrower.TypeError(
|
||||
"Descriptor property 'type' must be 'i32', 'f32', or 'f64'");
|
||||
"Descriptor property 'value' must be 'i32', 'f32', or 'f64'");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ load("test/mjsunit/wasm/wasm-constants.js");
|
||||
load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
|
||||
(function TestBasic() {
|
||||
let global = new WebAssembly.Global({type: 'i32'}, 1);
|
||||
let global = new WebAssembly.Global({value: 'i32'}, 1);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImportedGlobal("mod", "g", kWasmI32);
|
||||
builder.addFunction("main", kSig_i_v)
|
||||
@ -20,7 +20,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
})();
|
||||
|
||||
(function TestTypeMismatch() {
|
||||
let global = new WebAssembly.Global({type: 'f32'}, 1);
|
||||
let global = new WebAssembly.Global({value: 'f32'}, 1);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImportedGlobal("mod", "g", kWasmI32);
|
||||
|
||||
@ -28,13 +28,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
||||
})();
|
||||
|
||||
(function TestMutableMismatch() {
|
||||
let global = new WebAssembly.Global({type: 'f64'}, 1);
|
||||
let global = new WebAssembly.Global({value: 'f64'}, 1);
|
||||
let builder = new WasmModuleBuilder();
|
||||
builder.addImportedGlobal("mod", "g", kWasmF64, true);
|
||||
|
||||
assertThrows(() => builder.instantiate({mod: {g: global}}));
|
||||
|
||||
global = new WebAssembly.Global({type: 'i32', mutable: true}, 1);
|
||||
global = new WebAssembly.Global({value: 'i32', mutable: true}, 1);
|
||||
builder = new WasmModuleBuilder();
|
||||
builder.addImportedGlobal("mod", "g", kWasmI32);
|
||||
|
||||
@ -73,7 +73,7 @@ function addGlobalGetterAndSetter(builder, index, name, type) {
|
||||
let builder = new WasmModuleBuilder();
|
||||
|
||||
for (let [index, {name, type}] of globalDesc.entries()) {
|
||||
globals[name] = new WebAssembly.Global({type: name, mutable: true});
|
||||
globals[name] = new WebAssembly.Global({value: name, mutable: true});
|
||||
builder.addImportedGlobal("mod", name, type, true);
|
||||
addGlobalGetterAndSetter(builder, index, name, type);
|
||||
}
|
||||
|
@ -21,11 +21,11 @@ function assertGlobalIsValid(global) {
|
||||
assertThrows(() => new WebAssembly.Global(""), TypeError);
|
||||
|
||||
assertThrows(() => new WebAssembly.Global({}), TypeError);
|
||||
assertThrows(() => new WebAssembly.Global({type: 'foo'}), TypeError);
|
||||
assertThrows(() => new WebAssembly.Global({type: 'i64'}), TypeError);
|
||||
assertThrows(() => new WebAssembly.Global({value: 'foo'}), TypeError);
|
||||
assertThrows(() => new WebAssembly.Global({value: 'i64'}), TypeError);
|
||||
|
||||
for (let type of ['i32', 'f32', 'f64']) {
|
||||
assertGlobalIsValid(new WebAssembly.Global({type}));
|
||||
assertGlobalIsValid(new WebAssembly.Global({value: type}));
|
||||
}
|
||||
})();
|
||||
|
||||
@ -215,7 +215,7 @@ const f64_values = [
|
||||
];
|
||||
|
||||
function GlobalI32(value, mutable = false) {
|
||||
return new WebAssembly.Global({type: 'i32', mutable}, value);
|
||||
return new WebAssembly.Global({value: 'i32', mutable}, value);
|
||||
}
|
||||
|
||||
function GlobalI64(mutable = false) {
|
||||
@ -227,11 +227,11 @@ function GlobalI64(mutable = false) {
|
||||
}
|
||||
|
||||
function GlobalF32(value, mutable = false) {
|
||||
return new WebAssembly.Global({type: 'f32', mutable}, value);
|
||||
return new WebAssembly.Global({value: 'f32', mutable}, value);
|
||||
}
|
||||
|
||||
function GlobalF64(value, mutable = false) {
|
||||
return new WebAssembly.Global({type: 'f64', mutable}, value);
|
||||
return new WebAssembly.Global({value: 'f64', mutable}, value);
|
||||
}
|
||||
|
||||
(function TestDefaultValue() {
|
||||
|
Loading…
Reference in New Issue
Block a user