| OLD | NEW |
| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 307 |
| 308 void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) { | 308 void WasmJs::Install(Isolate* isolate, Handle<JSGlobalObject> global) { |
| 309 // Setup wasm function map. | 309 // Setup wasm function map. |
| 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 global->native_context()->set_wasm_function_map(*wasm_function_map); | 313 global->native_context()->set_wasm_function_map(*wasm_function_map); |
| 314 | 314 |
| 315 // Bind the WASM object. | 315 // Bind the WASM object. |
| 316 Factory* factory = isolate->factory(); | 316 Factory* factory = isolate->factory(); |
| 317 Handle<String> name = v8_str(isolate, "WASM"); | 317 Handle<String> name = v8_str(isolate, "_WASMEXP_"); |
| 318 Handle<JSFunction> cons = factory->NewFunction(name); | 318 Handle<JSFunction> cons = factory->NewFunction(name); |
| 319 JSFunction::SetInstancePrototype( | 319 JSFunction::SetInstancePrototype( |
| 320 cons, Handle<Object>(global->native_context()->initial_object_prototype(), | 320 cons, Handle<Object>(global->native_context()->initial_object_prototype(), |
| 321 isolate)); | 321 isolate)); |
| 322 cons->shared()->set_instance_class_name(*name); | 322 cons->shared()->set_instance_class_name(*name); |
| 323 Handle<JSObject> wasm_object = factory->NewJSObject(cons, TENURED); | 323 Handle<JSObject> wasm_object = factory->NewJSObject(cons, TENURED); |
| 324 PropertyAttributes attributes = static_cast<PropertyAttributes>(DONT_ENUM); | 324 PropertyAttributes attributes = static_cast<PropertyAttributes>(DONT_ENUM); |
| 325 JSObject::AddProperty(global, name, wasm_object, attributes); | 325 JSObject::AddProperty(global, name, wasm_object, attributes); |
| 326 | 326 |
| 327 // Install functions on the WASM object. | 327 // Install functions on the WASM object. |
| 328 InstallFunc(isolate, wasm_object, "instantiateModule", InstantiateModule); | 328 InstallFunc(isolate, wasm_object, "instantiateModule", InstantiateModule); |
| 329 InstallFunc(isolate, wasm_object, "verifyModule", VerifyModule); | 329 InstallFunc(isolate, wasm_object, "verifyModule", VerifyModule); |
| 330 InstallFunc(isolate, wasm_object, "verifyFunction", VerifyFunction); | 330 InstallFunc(isolate, wasm_object, "verifyFunction", VerifyFunction); |
| 331 InstallFunc(isolate, wasm_object, "compileRun", CompileRun); | 331 InstallFunc(isolate, wasm_object, "compileRun", CompileRun); |
| 332 InstallFunc(isolate, wasm_object, "asmCompileRun", AsmCompileRun); | 332 InstallFunc(isolate, wasm_object, "asmCompileRun", AsmCompileRun); |
| 333 InstallFunc(isolate, wasm_object, "instantiateModuleFromAsm", | 333 InstallFunc(isolate, wasm_object, "instantiateModuleFromAsm", |
| 334 InstantiateModuleFromAsm); | 334 InstantiateModuleFromAsm); |
| 335 } | 335 } |
| 336 } // namespace internal | 336 } // namespace internal |
| 337 } // namespace v8 | 337 } // namespace v8 |
| OLD | NEW |