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/wasm/wasm-objects.h" | 5 #include "src/wasm/wasm-objects.h" |
6 #include "src/utils.h" | 6 #include "src/utils.h" |
7 | 7 |
8 #include "src/debug/debug-interface.h" | 8 #include "src/debug/debug-interface.h" |
9 #include "src/wasm/module-decoder.h" | 9 #include "src/wasm/module-decoder.h" |
10 #include "src/wasm/wasm-module.h" | 10 #include "src/wasm/wasm-module.h" |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 | 443 |
444 Handle<WasmCompiledModule> WasmCompiledModule::New( | 444 Handle<WasmCompiledModule> WasmCompiledModule::New( |
445 Isolate* isolate, Handle<WasmSharedModuleData> shared) { | 445 Isolate* isolate, Handle<WasmSharedModuleData> shared) { |
446 Handle<FixedArray> ret = | 446 Handle<FixedArray> ret = |
447 isolate->factory()->NewFixedArray(PropertyIndices::Count, TENURED); | 447 isolate->factory()->NewFixedArray(PropertyIndices::Count, TENURED); |
448 // WasmCompiledModule::cast would fail since fields are not set yet. | 448 // WasmCompiledModule::cast would fail since fields are not set yet. |
449 Handle<WasmCompiledModule> compiled_module( | 449 Handle<WasmCompiledModule> compiled_module( |
450 reinterpret_cast<WasmCompiledModule*>(*ret), isolate); | 450 reinterpret_cast<WasmCompiledModule*>(*ret), isolate); |
451 compiled_module->InitId(); | 451 compiled_module->InitId(); |
452 compiled_module->set_shared(shared); | 452 compiled_module->set_shared(shared); |
| 453 compiled_module->set_native_context(isolate->native_context()); |
453 return compiled_module; | 454 return compiled_module; |
454 } | 455 } |
455 | 456 |
456 void WasmCompiledModule::InitId() { | 457 void WasmCompiledModule::InitId() { |
457 #if DEBUG | 458 #if DEBUG |
458 static uint32_t instance_id_counter = 0; | 459 static uint32_t instance_id_counter = 0; |
459 set(kID_instance_id, Smi::FromInt(instance_id_counter++)); | 460 set(kID_instance_id, Smi::FromInt(instance_id_counter++)); |
460 TRACE("New compiled module id: %d\n", instance_id()); | 461 TRACE("New compiled module id: %d\n", instance_id()); |
461 #endif | 462 #endif |
462 } | 463 } |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) | 837 !array->get(kPreviousInstanceWrapper)->IsFixedArray()) |
837 return false; | 838 return false; |
838 return true; | 839 return true; |
839 } | 840 } |
840 | 841 |
841 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, | 842 void WasmInstanceWrapper::set_instance_object(Handle<JSObject> instance, |
842 Isolate* isolate) { | 843 Isolate* isolate) { |
843 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); | 844 Handle<WeakCell> cell = isolate->factory()->NewWeakCell(instance); |
844 set(kWrapperInstanceObject, *cell); | 845 set(kWrapperInstanceObject, *cell); |
845 } | 846 } |
OLD | NEW |