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 1935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_); | 1954 Handle<JSArrayBuffer> buffer(instance->memory_buffer(), isolate_); |
1955 memory_object = WasmMemoryObject::New( | 1955 memory_object = WasmMemoryObject::New( |
1956 isolate_, buffer, | 1956 isolate_, |
| 1957 (instance->has_memory_buffer()) |
| 1958 ? handle(instance->memory_buffer()) |
| 1959 : Handle<JSArrayBuffer>::null(), |
1957 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); | 1960 (module_->max_mem_pages != 0) ? module_->max_mem_pages : -1); |
1958 instance->set_memory_object(*memory_object); | 1961 instance->set_memory_object(*memory_object); |
1959 } else { | 1962 } else { |
1960 memory_object = | 1963 memory_object = |
1961 Handle<WasmMemoryObject>(instance->memory_object(), isolate_); | 1964 Handle<WasmMemoryObject>(instance->memory_object(), isolate_); |
1962 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory_object)); | 1965 DCHECK(WasmJs::IsWasmMemoryObject(isolate_, memory_object)); |
1963 memory_object->ResetInstancesLink(isolate_); | 1966 memory_object->ResetInstancesLink(isolate_); |
1964 } | 1967 } |
1965 | 1968 |
1966 desc.set_value(memory_object); | 1969 desc.set_value(memory_object); |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 callee_compiled->instruction_start()); | 3323 callee_compiled->instruction_start()); |
3321 } | 3324 } |
3322 DCHECK_EQ(non_compiled_functions.size(), idx); | 3325 DCHECK_EQ(non_compiled_functions.size(), idx); |
3323 } | 3326 } |
3324 | 3327 |
3325 Code* ret = | 3328 Code* ret = |
3326 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); | 3329 Code::cast(compiled_module->code_table()->get(func_to_return_idx)); |
3327 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); | 3330 DCHECK_EQ(Code::WASM_FUNCTION, ret->kind()); |
3328 return handle(ret, isolate); | 3331 return handle(ret, isolate); |
3329 } | 3332 } |
OLD | NEW |