| 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 <iostream> // NOLINT(readability/streams) | 5 #include <iostream> // NOLINT(readability/streams) |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
| 9 | 9 |
| 10 #include "src/arm64/assembler-arm64-inl.h" | 10 #include "src/arm64/assembler-arm64-inl.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 code->Print(os); | 55 code->Print(os); |
| 56 ::printf("f() = %" PRIx64 "\n\n", ret_value); | 56 ::printf("f() = %" PRIx64 "\n\n", ret_value); |
| 57 #endif | 57 #endif |
| 58 int offset = 1234; | 58 int offset = 1234; |
| 59 | 59 |
| 60 // Relocating reference by offset | 60 // Relocating reference by offset |
| 61 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); | 61 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); |
| 62 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 62 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 63 DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); | 63 DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); |
| 64 it.rinfo()->update_wasm_memory_reference( | 64 it.rinfo()->update_wasm_memory_reference( |
| 65 it.rinfo()->wasm_memory_reference(), | 65 isolate, it.rinfo()->wasm_memory_reference(), |
| 66 it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); | 66 it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Call into relocated code object | 69 // Call into relocated code object |
| 70 ret_value = runnable.Call(); | 70 ret_value = runnable.Call(); |
| 71 CHECK_EQ((imm + offset), ret_value); | 71 CHECK_EQ((imm + offset), ret_value); |
| 72 | 72 |
| 73 #ifdef DEBUG | 73 #ifdef DEBUG |
| 74 code->Print(os); | 74 code->Print(os); |
| 75 ::printf("f() = %" PRIx64 "\n\n", ret_value); | 75 ::printf("f() = %" PRIx64 "\n\n", ret_value); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 OFStream os(stdout); | 110 OFStream os(stdout); |
| 111 code->Print(os); | 111 code->Print(os); |
| 112 ::printf("f() = %" PRIx64 "\n\n", ret_value); | 112 ::printf("f() = %" PRIx64 "\n\n", ret_value); |
| 113 #endif | 113 #endif |
| 114 int32_t diff = 512; | 114 int32_t diff = 512; |
| 115 | 115 |
| 116 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); | 116 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); |
| 117 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 117 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 118 DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode())); | 118 DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode())); |
| 119 it.rinfo()->update_wasm_memory_size( | 119 it.rinfo()->update_wasm_memory_size( |
| 120 it.rinfo()->wasm_memory_size_reference(), | 120 isolate, it.rinfo()->wasm_memory_size_reference(), |
| 121 it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); | 121 it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); |
| 122 } | 122 } |
| 123 | 123 |
| 124 ret_value = runnable.Call(); | 124 ret_value = runnable.Call(); |
| 125 CHECK_NE(ret_value, 0xdeadbeef); | 125 CHECK_NE(ret_value, 0xdeadbeef); |
| 126 | 126 |
| 127 #ifdef DEBUG | 127 #ifdef DEBUG |
| 128 code->Print(os); | 128 code->Print(os); |
| 129 ::printf("f() = %" PRIx64 "\n\n", ret_value); | 129 ::printf("f() = %" PRIx64 "\n\n", ret_value); |
| 130 #endif | 130 #endif |
| 131 } | 131 } |
| 132 | 132 |
| 133 #undef __ | 133 #undef __ |
| OLD | NEW |