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 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 isolate_, table.min_size, maximum, &table_instance.js_wrappers); | 1944 isolate_, table.min_size, maximum, &table_instance.js_wrappers); |
1945 } | 1945 } |
1946 desc.set_value(table_instance.table_object); | 1946 desc.set_value(table_instance.table_object); |
1947 break; | 1947 break; |
1948 } | 1948 } |
1949 case kExternalMemory: { | 1949 case kExternalMemory: { |
1950 // Export the memory as a WebAssembly.Memory object. | 1950 // Export the memory as a WebAssembly.Memory object. |
1951 Handle<WasmMemoryObject> memory_object; | 1951 Handle<WasmMemoryObject> memory_object; |
1952 if (!instance->has_memory_object()) { | 1952 if (!instance->has_memory_object()) { |
1953 // If there was no imported WebAssembly.Memory object, create one. | 1953 // If there was no imported WebAssembly.Memory object, create one. |
1954 Handle<JSArrayBuffer> buffer(instance->memory_buffer(), isolate_); | |
1955 memory_object = WasmMemoryObject::New( | 1954 memory_object = WasmMemoryObject::New( |
1956 isolate_, buffer, | 1955 isolate_, |
| 1956 (instance->has_memory_buffer()) |
| 1957 ? handle(instance->memory_buffer()) |
| 1958 : Handle<JSArrayBuffer>::null(), |
1957 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); | 1959 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); |
1958 instance->set_memory_object(*memory_object); | 1960 instance->set_memory_object(*memory_object); |
1959 } else { | 1961 } else { |
1960 memory_object = | 1962 memory_object = |
1961 Handle<WasmMemoryObject>(instance->memory_object(), isolate_); | 1963 Handle<WasmMemoryObject>(instance->memory_object(), isolate_); |
1962 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory_object)); | 1964 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory_object)); |
1963 memory_object->ResetInstancesLink(isolate_); | 1965 memory_object->ResetInstancesLink(isolate_); |
1964 } | 1966 } |
1965 | 1967 |
1966 desc.set_value(memory_object); | 1968 desc.set_value(memory_object); |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 callee_compiled->instruction_start()); | 3322 callee_compiled->instruction_start()); |
3321 } | 3323 } |
3322 DCHECK_EQ(non_compiled_functions.size(), idx); | 3324 DCHECK_EQ(non_compiled_functions.size(), idx); |
3323 } | 3325 } |
3324 | 3326 |
3325 Code* ret = | 3327 Code* ret = |
3326 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); | 3328 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); |
3327 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); | 3329 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); |
3328 return handle(ret, isolate); | 3330 return handle(ret, isolate); |
3329 } | 3331 } |
OLD | NEW |