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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 Handle<JSObject> wasm_object = factory->NewJSObject(cons, TENURED); | 287 Handle<JSObject> wasm_object = factory->NewJSObject(cons, TENURED); |
288 PropertyAttributes attributes = static_cast<PropertyAttributes>(DONT_ENUM); | 288 PropertyAttributes attributes = static_cast<PropertyAttributes>(DONT_ENUM); |
289 JSObject::AddProperty(global, name, wasm_object, attributes); | 289 JSObject::AddProperty(global, name, wasm_object, attributes); |
290 | 290 |
291 // Install functions on the WASM object. | 291 // Install functions on the WASM object. |
292 InstallFunc(isolate, wasm_object, "verifyModule", VerifyModule); | 292 InstallFunc(isolate, wasm_object, "verifyModule", VerifyModule); |
293 InstallFunc(isolate, wasm_object, "verifyFunction", VerifyFunction); | 293 InstallFunc(isolate, wasm_object, "verifyFunction", VerifyFunction); |
294 InstallFunc(isolate, wasm_object, "instantiateModule", InstantiateModule); | 294 InstallFunc(isolate, wasm_object, "instantiateModule", InstantiateModule); |
295 InstallFunc(isolate, wasm_object, "instantiateModuleFromAsm", | 295 InstallFunc(isolate, wasm_object, "instantiateModuleFromAsm", |
296 InstantiateModuleFromAsm); | 296 InstantiateModuleFromAsm); |
| 297 |
| 298 { |
| 299 // Add the Wasm.experimentalVersion property. |
| 300 Handle<String> name = v8_str(isolate, "experimentalVersion"); |
| 301 PropertyAttributes attributes = |
| 302 static_cast<PropertyAttributes>(DONT_DELETE | READ_ONLY); |
| 303 Handle<Smi> value = Handle<Smi>(Smi::FromInt(wasm::kWasmVersion), isolate); |
| 304 JSObject::AddProperty(wasm_object, name, value, attributes); |
| 305 } |
297 } | 306 } |
298 | 307 |
299 | 308 |
300 void WasmJs::InstallWasmFunctionMap(Isolate* isolate, Handle<Context> context) { | 309 void WasmJs::InstallWasmFunctionMap(Isolate* isolate, Handle<Context> context) { |
301 if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) { | 310 if (!context->get(Context::WASM_FUNCTION_MAP_INDEX)->IsMap()) { |
302 // TODO(titzer): Move this to bootstrapper.cc?? | 311 // TODO(titzer): Move this to bootstrapper.cc?? |
303 // TODO(titzer): Also make one for strict mode functions? | 312 // TODO(titzer): Also make one for strict mode functions? |
304 Handle<Map> prev_map = Handle<Map>(context->sloppy_function_map(), isolate); | 313 Handle<Map> prev_map = Handle<Map>(context->sloppy_function_map(), isolate); |
305 | 314 |
306 InstanceType instance_type = prev_map->instance_type(); | 315 InstanceType instance_type = prev_map->instance_type(); |
(...skipping 10 matching lines...) Expand all Loading... |
317 int unused_property_fields = in_object_properties - pre_allocated; | 326 int unused_property_fields = in_object_properties - pre_allocated; |
318 Handle<Map> map = Map::CopyInitialMap( | 327 Handle<Map> map = Map::CopyInitialMap( |
319 prev_map, instance_size, in_object_properties, unused_property_fields); | 328 prev_map, instance_size, in_object_properties, unused_property_fields); |
320 | 329 |
321 context->set_wasm_function_map(*map); | 330 context->set_wasm_function_map(*map); |
322 } | 331 } |
323 } | 332 } |
324 | 333 |
325 } // namespace internal | 334 } // namespace internal |
326 } // namespace v8 | 335 } // namespace v8 |
OLD | NEW |