Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: src/wasm/wasm-js.cc

Issue 1770383002: [wasm] Rename _WASMEXP_ object to Wasm. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-575364.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 #include "src/api-natives.h" 6 #include "src/api-natives.h"
7 #include "src/assert-scope.h" 7 #include "src/assert-scope.h"
8 #include "src/ast/ast.h" 8 #include "src/ast/ast.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 #include "src/factory.h" 10 #include "src/factory.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 } 280 }
281 281
282 282
283 void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) { 283 void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) {
284 // Setup wasm function map. 284 // Setup wasm function map.
285 Handle<Context> context(global->native_context(), isolate); 285 Handle<Context> context(global->native_context(), isolate);
286 InstallWasmFunctionMap(isolate, context); 286 InstallWasmFunctionMap(isolate, context);
287 287
288 // Bind the WASM object. 288 // Bind the WASM object.
289 Factory* factory = isolate->factory(); 289 Factory* factory = isolate->factory();
290 Handle<String> name = v8_str(isolate, "_WASMEXP_"); 290 Handle<String> name = v8_str(isolate, "Wasm");
291 Handle<JSFunction> cons = factory->NewFunction(name); 291 Handle<JSFunction> cons = factory->NewFunction(name);
292 JSFunction::SetInstancePrototype( 292 JSFunction::SetInstancePrototype(
293 cons, Handle<Object>(context->initial_object_prototype(), isolate)); 293 cons, Handle<Object>(context->initial_object_prototype(), isolate));
294 cons->shared()->set_instance_class_name(*name); 294 cons->shared()->set_instance_class_name(*name);
295 Handle<JSObject> wasm_object = factory->NewJSObject(cons, TENURED); 295 Handle<JSObject> wasm_object = factory->NewJSObject(cons, TENURED);
296 PropertyAttributes attributes = static_cast<PropertyAttributes>(DONT_ENUM); 296 PropertyAttributes attributes = static_cast<PropertyAttributes>(DONT_ENUM);
297 JSObject::AddProperty(global, name, wasm_object, attributes); 297 JSObject::AddProperty(global, name, wasm_object, attributes);
298 298
299 // Install functions on the WASM object. 299 // Install functions on the WASM object.
300 InstallFunc(isolate, wasm_object, "verifyModule", VerifyModule); 300 InstallFunc(isolate, wasm_object, "verifyModule", VerifyModule);
301 InstallFunc(isolate, wasm_object, "verifyFunction", VerifyFunction); 301 InstallFunc(isolate, wasm_object, "verifyFunction", VerifyFunction);
302 InstallFunc(isolate, wasm_object, "instantiateModule", InstantiateModule); 302 InstallFunc(isolate, wasm_object, "instantiateModule", InstantiateModule);
303 InstallFunc(isolate, wasm_object, "instantiateModuleFromAsm", 303 InstallFunc(isolate, wasm_object, "instantiateModuleFromAsm",
304 InstantiateModuleFromAsm); 304 InstantiateModuleFromAsm);
305 } 305 }
306 306
307 307
308 void WasmJs::InstallWasmFunctionMap(Isolate* isolate, Handle<Context> context) { 308 void WasmJs::InstallWasmFunctionMap(Isolate* isolate, Handle<Context> context) {
309 if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) { 309 if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) {
310 Handle<Map> wasm_function_map = isolate->factory()->NewMap( 310 Handle<Map> wasm_function_map = isolate->factory()->NewMap(
311 JS_FUNCTION_TYPE, JSFunction::kSize + kPointerSize); 311 JS_FUNCTION_TYPE, JSFunction::kSize + kPointerSize);
312 wasm_function_map->set_is_callable(); 312 wasm_function_map->set_is_callable();
313 context->set_wasm_function_map(*wasm_function_map); 313 context->set_wasm_function_map(*wasm_function_map);
314 } 314 }
315 } 315 }
316 316
317 } // namespace internal 317 } // namespace internal
318 } // namespace v8 318 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-575364.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698