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 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 uint32_t dest_addr = | 1539 uint32_t dest_addr = |
1540 static_cast<uint32_t>(segment->get_int(kDestAddrValue)); | 1540 static_cast<uint32_t>(segment->get_int(kDestAddrValue)); |
1541 if (segment->get_int(kDestAddrKind) == 1) { | 1541 if (segment->get_int(kDestAddrKind) == 1) { |
1542 // The destination address is the value of a global variable. | 1542 // The destination address is the value of a global variable. |
1543 dest_addr = | 1543 dest_addr = |
1544 *reinterpret_cast<uint32_t*>(raw_buffer_ptr(globals, dest_addr)); | 1544 *reinterpret_cast<uint32_t*>(raw_buffer_ptr(globals, dest_addr)); |
1545 } | 1545 } |
1546 | 1546 |
1547 uint32_t source_size = | 1547 uint32_t source_size = |
1548 static_cast<uint32_t>(segment->get_int(kSourceSize)); | 1548 static_cast<uint32_t>(segment->get_int(kSourceSize)); |
| 1549 // TODO(titzer): These should be runtime errors and not CHECKs if |
| 1550 // dest_addr is global (and therefore initialized at linktime to an |
| 1551 // possibly-invalid value). |
1549 CHECK_LT(dest_addr, mem_size); | 1552 CHECK_LT(dest_addr, mem_size); |
1550 CHECK_LE(source_size, mem_size); | 1553 CHECK_LE(source_size, mem_size); |
1551 CHECK_LE(dest_addr, mem_size - source_size); | 1554 CHECK_LE(dest_addr, mem_size - source_size); |
1552 byte* addr = mem_addr + dest_addr; | 1555 byte* addr = mem_addr + dest_addr; |
1553 data->copy_out(last_extraction_pos, addr, source_size); | 1556 data->copy_out(last_extraction_pos, addr, source_size); |
1554 last_extraction_pos += source_size; | 1557 last_extraction_pos += source_size; |
1555 } | 1558 } |
1556 } | 1559 } |
1557 | 1560 |
1558 Handle<Code> CompileImportWrapper(int index, Handle<FixedArray> data, | 1561 Handle<Code> CompileImportWrapper(int index, Handle<FixedArray> data, |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2278 WasmCompiledModule* compiled_module = | 2281 WasmCompiledModule* compiled_module = |
2279 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); | 2282 WasmCompiledModule::cast(instance->GetInternalField(kWasmCompiledModule)); |
2280 CHECK(compiled_module->has_weak_module_object()); | 2283 CHECK(compiled_module->has_weak_module_object()); |
2281 CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); | 2284 CHECK(compiled_module->ptr_to_weak_module_object()->cleared()); |
2282 } | 2285 } |
2283 | 2286 |
2284 } // namespace testing | 2287 } // namespace testing |
2285 } // namespace wasm | 2288 } // namespace wasm |
2286 } // namespace internal | 2289 } // namespace internal |
2287 } // namespace v8 | 2290 } // namespace v8 |
OLD | NEW |