| 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/arm/assembler-arm-inl.h" | 10 #include "src/arm/assembler-arm-inl.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 code->Print(os); | 50 code->Print(os); |
| 51 ::printf("f() = %d\n\n", ret_value); | 51 ::printf("f() = %d\n\n", ret_value); |
| 52 #endif | 52 #endif |
| 53 int offset = 1234; | 53 int offset = 1234; |
| 54 | 54 |
| 55 // Relocating references by offset | 55 // Relocating references by offset |
| 56 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); | 56 int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); |
| 57 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 57 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 58 DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); | 58 DCHECK(RelocInfo::IsWasmMemoryReference(it.rinfo()->rmode())); |
| 59 it.rinfo()->update_wasm_memory_reference( | 59 it.rinfo()->update_wasm_memory_reference( |
| 60 it.rinfo()->wasm_memory_reference(), | 60 isolate, it.rinfo()->wasm_memory_reference(), |
| 61 it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); | 61 it.rinfo()->wasm_memory_reference() + offset, SKIP_ICACHE_FLUSH); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Call into relocated code object | 64 // Call into relocated code object |
| 65 ret_value = runnable.Call(); | 65 ret_value = runnable.Call(); |
| 66 CHECK_EQ((imm + offset), ret_value); | 66 CHECK_EQ((imm + offset), ret_value); |
| 67 | 67 |
| 68 #ifdef DEBUG | 68 #ifdef DEBUG |
| 69 code->Print(os); | 69 code->Print(os); |
| 70 ::printf("f() = %d\n\n", ret_value); | 70 ::printf("f() = %d\n\n", ret_value); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 OFStream os(stdout); | 104 OFStream os(stdout); |
| 105 code->Print(os); | 105 code->Print(os); |
| 106 ::printf("f() = %d\n\n", ret_value); | 106 ::printf("f() = %d\n\n", ret_value); |
| 107 #endif | 107 #endif |
| 108 size_t diff = 512; | 108 size_t diff = 512; |
| 109 | 109 |
| 110 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); | 110 int mode_mask = (1 << RelocInfo::WASM_MEMORY_SIZE_REFERENCE); |
| 111 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { | 111 for (RelocIterator it(*code, mode_mask); !it.done(); it.next()) { |
| 112 DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode())); | 112 DCHECK(RelocInfo::IsWasmMemorySizeReference(it.rinfo()->rmode())); |
| 113 it.rinfo()->update_wasm_memory_size( | 113 it.rinfo()->update_wasm_memory_size( |
| 114 it.rinfo()->wasm_memory_size_reference(), | 114 isolate, it.rinfo()->wasm_memory_size_reference(), |
| 115 it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); | 115 it.rinfo()->wasm_memory_size_reference() + diff, SKIP_ICACHE_FLUSH); |
| 116 } | 116 } |
| 117 | 117 |
| 118 ret_value = runnable.Call(); | 118 ret_value = runnable.Call(); |
| 119 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); | 119 CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); |
| 120 | 120 |
| 121 #ifdef DEBUG | 121 #ifdef DEBUG |
| 122 code->Print(os); | 122 code->Print(os); |
| 123 ::printf("f() = %d\n\n", ret_value); | 123 ::printf("f() = %d\n\n", ret_value); |
| 124 #endif | 124 #endif |
| 125 } | 125 } |
| 126 #undef __ | 126 #undef __ |
| OLD | NEW |