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/base/atomic-utils.h" | 7 #include "src/base/atomic-utils.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 | 9 |
10 #include "src/macro-assembler.h" | 10 #include "src/macro-assembler.h" |
(...skipping 1441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 *GetRawGlobalPtr<double>(global, globals) = global.init.val.f64_const; | 1452 *GetRawGlobalPtr<double>(global, globals) = global.init.val.f64_const; |
1453 break; | 1453 break; |
1454 case WasmInitExpr::kGlobalIndex: { | 1454 case WasmInitExpr::kGlobalIndex: { |
1455 // Initialize with another global. | 1455 // Initialize with another global. |
1456 uint32_t new_offset = global.offset; | 1456 uint32_t new_offset = global.offset; |
1457 uint32_t old_offset = | 1457 uint32_t old_offset = |
1458 module_->globals[global.init.val.global_index].offset; | 1458 module_->globals[global.init.val.global_index].offset; |
1459 TRACE("init [globals+%u] = [globals+%d]\n", global.offset, | 1459 TRACE("init [globals+%u] = [globals+%d]\n", global.offset, |
1460 old_offset); | 1460 old_offset); |
1461 size_t size = (global.type == kAstI64 || global.type == kAstF64) | 1461 size_t size = (global.type == kAstI64 || global.type == kAstF64) |
1462 ? size = sizeof(double) | 1462 ? sizeof(double) |
1463 : sizeof(int32_t); | 1463 : sizeof(int32_t); |
1464 memcpy(raw_buffer_ptr(globals, new_offset), | 1464 memcpy(raw_buffer_ptr(globals, new_offset), |
1465 raw_buffer_ptr(globals, old_offset), size); | 1465 raw_buffer_ptr(globals, old_offset), size); |
1466 break; | 1466 break; |
1467 } | 1467 } |
1468 case WasmInitExpr::kNone: | 1468 case WasmInitExpr::kNone: |
1469 // Happens with imported globals. | 1469 // Happens with imported globals. |
1470 break; | 1470 break; |
1471 default: | 1471 default: |
1472 UNREACHABLE(); | 1472 UNREACHABLE(); |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1981 CHECK_NOT_NULL(result.val); | 1981 CHECK_NOT_NULL(result.val); |
1982 module = const_cast<WasmModule*>(result.val); | 1982 module = const_cast<WasmModule*>(result.val); |
1983 } | 1983 } |
1984 | 1984 |
1985 Handle<WasmModuleWrapper> module_wrapper = | 1985 Handle<WasmModuleWrapper> module_wrapper = |
1986 WasmModuleWrapper::New(isolate, module); | 1986 WasmModuleWrapper::New(isolate, module); |
1987 | 1987 |
1988 compiled_module->set_module_wrapper(module_wrapper); | 1988 compiled_module->set_module_wrapper(module_wrapper); |
1989 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); | 1989 DCHECK(WasmCompiledModule::IsWasmCompiledModule(*compiled_module)); |
1990 } | 1990 } |
OLD | NEW |