Commit 01148639 authored by titzer's avatar titzer Committed by Commit Bot

[wasm] Remove the use of private symbols for branding.

Instead, rely on the underlying instance types for WebAssembly.* types.

R=clemensh@chromium.org, rossberg@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2971093003
Cr-Commit-Position: refs/heads/master@{#46478}
parent dfdcaf43
......@@ -366,13 +366,9 @@ enum ContextLookupFlags {
V(NATIVE_FUNCTION_MAP_INDEX, Map, native_function_map) \
V(WASM_FUNCTION_MAP_INDEX, Map, wasm_function_map) \
V(WASM_INSTANCE_CONSTRUCTOR_INDEX, JSFunction, wasm_instance_constructor) \
V(WASM_INSTANCE_SYM_INDEX, Symbol, wasm_instance_sym) \
V(WASM_MEMORY_CONSTRUCTOR_INDEX, JSFunction, wasm_memory_constructor) \
V(WASM_MEMORY_SYM_INDEX, Symbol, wasm_memory_sym) \
V(WASM_MODULE_CONSTRUCTOR_INDEX, JSFunction, wasm_module_constructor) \
V(WASM_MODULE_SYM_INDEX, Symbol, wasm_module_sym) \
V(WASM_TABLE_CONSTRUCTOR_INDEX, JSFunction, wasm_table_constructor) \
V(WASM_TABLE_SYM_INDEX, Symbol, wasm_table_sym) \
V(TYPED_ARRAY_FUN_INDEX, JSFunction, typed_array_function) \
V(TYPED_ARRAY_PROTOTYPE_INDEX, JSObject, typed_array_prototype) \
V(UINT16_ARRAY_FUN_INDEX, JSFunction, uint16_array_fun) \
......
......@@ -1318,7 +1318,7 @@ int InstanceBuilder::ProcessImports(Handle<FixedArray> code_table,
break;
}
case kExternalTable: {
if (!WasmJs::IsWasmTableObject(isolate_, value)) {
if (!value->IsWasmTableObject()) {
ReportLinkError("table import requires a WebAssembly.Table", index,
module_name, import_name);
return -1;
......@@ -1390,13 +1390,12 @@ int InstanceBuilder::ProcessImports(Handle<FixedArray> code_table,
// Validation should have failed if more than one memory object was
// provided.
DCHECK(!instance->has_memory_object());
if (!WasmJs::IsWasmMemoryObject(isolate_, value)) {
if (!value->IsWasmMemoryObject()) {
ReportLinkError("memory import must be a WebAssembly.Memory object",
index, module_name, import_name);
return -1;
}
auto memory = Handle<WasmMemoryObject>::cast(value);
DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory));
instance->set_memory_object(*memory);
memory_ = Handle<JSArrayBuffer>(memory->array_buffer(), isolate_);
uint32_t imported_cur_pages = static_cast<uint32_t>(
......
This diff is collapsed.
......@@ -162,8 +162,6 @@ Handle<WasmModuleObject> WasmModuleObject::New(
isolate->native_context()->wasm_module_constructor());
auto module_object = Handle<WasmModuleObject>::cast(
isolate->factory()->NewJSObject(module_cons));
Handle<Symbol> module_sym(isolate->native_context()->wasm_module_sym());
Object::SetProperty(module_object, module_sym, module_object, STRICT).Check();
module_object->set_compiled_module(*compiled_module);
Handle<WeakCell> link_to_module =
isolate->factory()->NewWeakCell(module_object);
......@@ -190,8 +188,6 @@ Handle<WasmTableObject> WasmTableObject::New(Isolate* isolate, uint32_t initial,
Handle<FixedArray> dispatch_tables = isolate->factory()->NewFixedArray(0);
table_obj->set_dispatch_tables(*dispatch_tables);
Handle<Symbol> table_sym(isolate->native_context()->wasm_table_sym());
Object::SetProperty(table_obj, table_sym, table_obj, STRICT).Check();
return Handle<WasmTableObject>::cast(table_obj);
}
......@@ -327,8 +323,6 @@ Handle<WasmMemoryObject> WasmMemoryObject::New(Isolate* isolate,
}
memory_obj->set_array_buffer(*buffer);
memory_obj->set_maximum_pages(maximum);
Handle<Symbol> memory_sym(isolate->native_context()->wasm_memory_sym());
Object::SetProperty(memory_obj, memory_sym, memory_obj, STRICT).Check();
return Handle<WasmMemoryObject>::cast(memory_obj);
}
......@@ -436,9 +430,6 @@ Handle<WasmInstanceObject> WasmInstanceObject::New(
Handle<JSObject> instance_object =
isolate->factory()->NewJSObject(instance_cons, TENURED);
Handle<Symbol> instance_sym(isolate->native_context()->wasm_instance_sym());
Object::SetProperty(instance_object, instance_sym, instance_object, STRICT)
.Check();
Handle<WasmInstanceObject> instance(
reinterpret_cast<WasmInstanceObject*>(*instance_object), isolate);
......
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