| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "src/assembler-inl.h" | 7 #include "src/assembler-inl.h" |
| 8 #include "src/base/adapters.h" | 8 #include "src/base/adapters.h" |
| 9 #include "src/base/atomic-utils.h" | 9 #include "src/base/atomic-utils.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 uint32_t mem_size = | 1164 uint32_t mem_size = |
| 1165 static_cast<uint32_t>(memory_->byte_length()->Number()); | 1165 static_cast<uint32_t>(memory_->byte_length()->Number()); |
| 1166 LoadDataSegments(mem_start, mem_size); | 1166 LoadDataSegments(mem_start, mem_size); |
| 1167 | 1167 |
| 1168 uint32_t old_mem_size = compiled_module_->mem_size(); | 1168 uint32_t old_mem_size = compiled_module_->mem_size(); |
| 1169 Address old_mem_start = | 1169 Address old_mem_start = |
| 1170 compiled_module_->has_memory() | 1170 compiled_module_->has_memory() |
| 1171 ? static_cast<Address>( | 1171 ? static_cast<Address>( |
| 1172 compiled_module_->memory()->backing_store()) | 1172 compiled_module_->memory()->backing_store()) |
| 1173 : nullptr; | 1173 : nullptr; |
| 1174 code_specialization.RelocateMemoryReferences(old_mem_start, old_mem_size, | 1174 // We might get instantiated again with the same memory. No patching |
| 1175 mem_start, mem_size); | 1175 // needed in this case. |
| 1176 if (old_mem_start != mem_start || old_mem_size != mem_size) { |
| 1177 code_specialization.RelocateMemoryReferences( |
| 1178 old_mem_start, old_mem_size, mem_start, mem_size); |
| 1179 } |
| 1176 compiled_module_->set_memory(memory_); | 1180 compiled_module_->set_memory(memory_); |
| 1177 } | 1181 } |
| 1178 | 1182 |
| 1179 //-------------------------------------------------------------------------- | 1183 //-------------------------------------------------------------------------- |
| 1180 // Set up the runtime support for the new instance. | 1184 // Set up the runtime support for the new instance. |
| 1181 //-------------------------------------------------------------------------- | 1185 //-------------------------------------------------------------------------- |
| 1182 Handle<WeakCell> weak_link = factory->NewWeakCell(instance); | 1186 Handle<WeakCell> weak_link = factory->NewWeakCell(instance); |
| 1183 | 1187 |
| 1184 for (int i = num_imported_functions + FLAG_skip_compiling_wasm_funcs; | 1188 for (int i = num_imported_functions + FLAG_skip_compiling_wasm_funcs; |
| 1185 i < code_table->length(); ++i) { | 1189 i < code_table->length(); ++i) { |
| (...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 Handle<String> module_property_name = | 2712 Handle<String> module_property_name = |
| 2709 isolate->factory()->InternalizeUtf8String("module"); | 2713 isolate->factory()->InternalizeUtf8String("module"); |
| 2710 Handle<String> instance_property_name = | 2714 Handle<String> instance_property_name = |
| 2711 isolate->factory()->InternalizeUtf8String("instance"); | 2715 isolate->factory()->InternalizeUtf8String("instance"); |
| 2712 JSObject::AddProperty(ret, module_property_name, module, NONE); | 2716 JSObject::AddProperty(ret, module_property_name, module, NONE); |
| 2713 JSObject::AddProperty(ret, instance_property_name, | 2717 JSObject::AddProperty(ret, instance_property_name, |
| 2714 instance_object.ToHandleChecked(), NONE); | 2718 instance_object.ToHandleChecked(), NONE); |
| 2715 | 2719 |
| 2716 ResolvePromise(isolate, promise, ret); | 2720 ResolvePromise(isolate, promise, ret); |
| 2717 } | 2721 } |
| OLD | NEW |