Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/arm/assembler-arm-inl.h

Issue 1921203002: Add new relocation type WASM_MEMORY_SIZE_REFERENCE, use relocatable pointers to update wasm memory … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips/mips64 build Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/arm64/assembler-arm64-inl.h » ('j') | src/compiler/common-operator.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions 5 // modification, are permitted provided that the following conditions
6 // are met: 6 // are met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 Address RelocInfo::target_address() { 69 Address RelocInfo::target_address() {
70 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)); 70 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_));
71 return Assembler::target_address_at(pc_, host_); 71 return Assembler::target_address_at(pc_, host_);
72 } 72 }
73 73
74 Address RelocInfo::wasm_memory_reference() { 74 Address RelocInfo::wasm_memory_reference() {
75 DCHECK(IsWasmMemoryReference(rmode_)); 75 DCHECK(IsWasmMemoryReference(rmode_));
76 return Assembler::target_address_at(pc_, host_); 76 return Assembler::target_address_at(pc_, host_);
77 } 77 }
78 78
79 uint32_t RelocInfo::wasm_memory_size_reference() {
80 DCHECK(IsWasmMemorySizeReference(rmode_));
81 return reinterpret_cast<uint32_t>(Assembler::target_address_at(pc_, host_));
82 }
83
79 Address RelocInfo::target_address_address() { 84 Address RelocInfo::target_address_address() {
80 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) 85 DCHECK(IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
81 || rmode_ == EMBEDDED_OBJECT 86 || rmode_ == EMBEDDED_OBJECT
82 || rmode_ == EXTERNAL_REFERENCE); 87 || rmode_ == EXTERNAL_REFERENCE);
83 if (FLAG_enable_embedded_constant_pool || 88 if (FLAG_enable_embedded_constant_pool ||
84 Assembler::IsMovW(Memory::int32_at(pc_))) { 89 Assembler::IsMovW(Memory::int32_at(pc_))) {
85 // We return the PC for embedded constant pool since this function is used 90 // We return the PC for embedded constant pool since this function is used
86 // by the serializer and expects the address to reside within the code 91 // by the serializer and expects the address to reside within the code
87 // object. 92 // object.
88 return reinterpret_cast<Address>(pc_); 93 return reinterpret_cast<Address>(pc_);
(...skipping 22 matching lines...) Expand all
111 Assembler::set_target_address_at(isolate_, pc_, host_, target, 116 Assembler::set_target_address_at(isolate_, pc_, host_, target,
112 icache_flush_mode); 117 icache_flush_mode);
113 if (write_barrier_mode == UPDATE_WRITE_BARRIER && 118 if (write_barrier_mode == UPDATE_WRITE_BARRIER &&
114 host() != NULL && IsCodeTarget(rmode_)) { 119 host() != NULL && IsCodeTarget(rmode_)) {
115 Object* target_code = Code::GetCodeFromTargetAddress(target); 120 Object* target_code = Code::GetCodeFromTargetAddress(target);
116 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( 121 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
117 host(), this, HeapObject::cast(target_code)); 122 host(), this, HeapObject::cast(target_code));
118 } 123 }
119 } 124 }
120 125
121 void RelocInfo::update_wasm_memory_reference( 126 void RelocInfo::update_wasm_memory_reference(
titzer 2016/05/04 11:21:22 Can we move this into the .cc file? There are othe
gdeepti 2016/05/04 20:14:52 Done.
122 Address old_base, Address new_base, size_t old_size, size_t new_size, 127 Address old_base, Address new_base, uint32_t old_size, uint32_t new_size,
123 ICacheFlushMode icache_flush_mode) { 128 ICacheFlushMode icache_flush_mode) {
124 DCHECK(IsWasmMemoryReference(rmode_)); 129 DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_));
125 DCHECK(old_base <= wasm_memory_reference() && 130 if (IsWasmMemoryReference(rmode_)) {
126 wasm_memory_reference() < old_base + old_size); 131 Address updated_memory_reference;
127 Address updated_reference = new_base + (wasm_memory_reference() - old_base); 132 DCHECK(old_base <= wasm_memory_reference() &&
128 DCHECK(new_base <= updated_reference && 133 wasm_memory_reference() < old_base + old_size);
129 updated_reference < new_base + new_size); 134 updated_memory_reference = new_base + (wasm_memory_reference() - old_base);
130 Assembler::set_target_address_at(isolate_, pc_, host_, updated_reference, 135 DCHECK(new_base <= updated_memory_reference &&
131 icache_flush_mode); 136 updated_memory_reference < new_base + new_size);
137 Assembler::set_target_address_at(
138 isolate_, pc_, host_, updated_memory_reference, icache_flush_mode);
139 } else if (IsWasmMemorySizeReference(rmode_)) {
140 uint32_t updated_size_reference;
141 DCHECK(wasm_memory_size_reference() <= old_size);
142 updated_size_reference =
143 new_size + (wasm_memory_size_reference() - old_size);
144 DCHECK(updated_size_reference <= new_size);
145 Assembler::set_target_address_at(
146 isolate_, pc_, host_, reinterpret_cast<Address>(updated_size_reference),
147 icache_flush_mode);
148 } else {
149 UNREACHABLE();
150 }
132 } 151 }
133 152
134 Object* RelocInfo::target_object() { 153 Object* RelocInfo::target_object() {
135 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 154 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
136 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_)); 155 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_, host_));
137 } 156 }
138 157
139 158
140 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 159 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
141 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 160 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 Assembler::FlushICache(isolate, pc, 4 * kInstrSize); 638 Assembler::FlushICache(isolate, pc, 4 * kInstrSize);
620 } 639 }
621 } 640 }
622 } 641 }
623 642
624 643
625 } // namespace internal 644 } // namespace internal
626 } // namespace v8 645 } // namespace v8
627 646
628 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_ 647 #endif // V8_ARM_ASSEMBLER_ARM_INL_H_
OLDNEW
« no previous file with comments | « no previous file | src/arm64/assembler-arm64-inl.h » ('j') | src/compiler/common-operator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698