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

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

Issue 7039058: MIPS: arch-independent changes to support mips. (Closed)
Patch Set: Updated per comments, rebased on r8009. Created 9 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 | « src/assembler.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »
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 are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 88 }
89 89
90 90
91 Address RelocInfo::target_address() { 91 Address RelocInfo::target_address() {
92 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 92 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
93 return Assembler::target_address_at(pc_); 93 return Assembler::target_address_at(pc_);
94 } 94 }
95 95
96 96
97 Address RelocInfo::target_address_address() { 97 Address RelocInfo::target_address_address() {
98 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY 98 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
99 || rmode_ == EMBEDDED_OBJECT 99 return reinterpret_cast<Address>(pc_);
100 || rmode_ == EXTERNAL_REFERENCE);
101 // Read the address of the word containing the target_address in an
102 // instruction stream.
103 // The only architecture-independent user of this function is the serializer.
104 // The serializer uses it to find out how many raw bytes of instruction to
105 // output before the next target.
106 // For an instructions like LUI/ORI where the target bits are mixed into the
107 // instruction bits, the size of the target will be zero, indicating that the
108 // serializer should not step forward in memory after a target is resolved
109 // and written. In this case the target_address_address function should
110 // return the end of the instructions to be patched, allowing the
111 // deserializer to deserialize the instructions as raw bytes and put them in
112 // place, ready to be patched with the target. In our case, that is the
113 // address of the instruction that follows LUI/ORI instruction pair.
114 return reinterpret_cast<Address>(
115 pc_ + Assembler::kInstructionsFor32BitConstant * Assembler::kInstrSize);
116 } 100 }
117 101
118 102
119 int RelocInfo::target_address_size() { 103 int RelocInfo::target_address_size() {
120 return Assembler::kExternalTargetSize; 104 return Assembler::kExternalTargetSize;
121 } 105 }
122 106
123 107
124 void RelocInfo::set_target_address(Address target) { 108 void RelocInfo::set_target_address(Address target) {
125 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 109 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
(...skipping 11 matching lines...) Expand all
137 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 121 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
138 return Handle<Object>(reinterpret_cast<Object**>( 122 return Handle<Object>(reinterpret_cast<Object**>(
139 Assembler::target_address_at(pc_))); 123 Assembler::target_address_at(pc_)));
140 } 124 }
141 125
142 126
143 Object** RelocInfo::target_object_address() { 127 Object** RelocInfo::target_object_address() {
144 // Provide a "natural pointer" to the embedded object, 128 // Provide a "natural pointer" to the embedded object,
145 // which can be de-referenced during heap iteration. 129 // which can be de-referenced during heap iteration.
146 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 130 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
147 // TODO(mips): Commenting out, to simplify arch-independent changes. 131 reconstructed_obj_ptr_ =
148 // GC won't work like this, but this commit is for asm/disasm/sim. 132 reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
149 // reconstructed_obj_ptr_ = 133 return &reconstructed_obj_ptr_;
150 // reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
151 // return &reconstructed_obj_ptr_;
152 return NULL;
153 } 134 }
154 135
155 136
156 void RelocInfo::set_target_object(Object* target) { 137 void RelocInfo::set_target_object(Object* target) {
157 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 138 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
158 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); 139 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target));
159 } 140 }
160 141
161 142
162 Address* RelocInfo::target_reference_address() { 143 Address* RelocInfo::target_reference_address() {
163 ASSERT(rmode_ == EXTERNAL_REFERENCE); 144 ASSERT(rmode_ == EXTERNAL_REFERENCE);
164 // TODO(mips): Commenting out, to simplify arch-independent changes. 145 reconstructed_adr_ptr_ = Assembler::target_address_at(pc_);
165 // GC won't work like this, but this commit is for asm/disasm/sim. 146 return &reconstructed_adr_ptr_;
166 // reconstructed_adr_ptr_ = Assembler::target_address_at(pc_);
167 // return &reconstructed_adr_ptr_;
168 return NULL;
169 } 147 }
170 148
171 149
172 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { 150 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() {
173 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 151 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
174 Address address = Memory::Address_at(pc_); 152 Address address = Memory::Address_at(pc_);
175 return Handle<JSGlobalPropertyCell>( 153 return Handle<JSGlobalPropertyCell>(
176 reinterpret_cast<JSGlobalPropertyCell**>(address)); 154 reinterpret_cast<JSGlobalPropertyCell**>(address));
177 } 155 }
178 156
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 222
245 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { 223 bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
246 Instr current_instr = Assembler::instr_at(pc_); 224 Instr current_instr = Assembler::instr_at(pc_);
247 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); 225 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP);
248 } 226 }
249 227
250 228
251 void RelocInfo::Visit(ObjectVisitor* visitor) { 229 void RelocInfo::Visit(ObjectVisitor* visitor) {
252 RelocInfo::Mode mode = rmode(); 230 RelocInfo::Mode mode = rmode();
253 if (mode == RelocInfo::EMBEDDED_OBJECT) { 231 if (mode == RelocInfo::EMBEDDED_OBJECT) {
254 // RelocInfo is needed when pointer must be updated/serialized, such as 232 Object** p = target_object_address();
255 // UpdatingVisitor in mark-compact.cc or Serializer in serialize.cc. 233 Object* orig = *p;
256 // It is ignored by visitors that do not need it. 234 visitor->VisitPointer(p);
Søren Thygesen Gjesse 2011/05/24 07:54:36 Instead of the additional local var p you could us
257 // TODO(mips): Commenting out, to simplify arch-independent changes. 235 if (*p != orig) {
258 // GC won't work like this, but this commit is for asm/disasm/sim. 236 set_target_object(*p);
259 // visitor->VisitPointer(target_object_address(), this); 237 }
260 } else if (RelocInfo::IsCodeTarget(mode)) { 238 } else if (RelocInfo::IsCodeTarget(mode)) {
261 visitor->VisitCodeTarget(this); 239 visitor->VisitCodeTarget(this);
262 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 240 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
263 visitor->VisitGlobalPropertyCell(this); 241 visitor->VisitGlobalPropertyCell(this);
264 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 242 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
265 // RelocInfo is needed when external-references must be serialized by 243 visitor->VisitExternalReference(target_reference_address());
266 // Serializer Visitor in serialize.cc. It is ignored by visitors that
267 // do not need it.
268 // TODO(mips): Commenting out, to simplify arch-independent changes.
269 // Serializer won't work like this, but this commit is for asm/disasm/sim.
270 // visitor->VisitExternalReference(target_reference_address(), this);
271 #ifdef ENABLE_DEBUGGER_SUPPORT 244 #ifdef ENABLE_DEBUGGER_SUPPORT
272 // TODO(isolates): Get a cached isolate below. 245 // TODO(isolates): Get a cached isolate below.
273 } else if (((RelocInfo::IsJSReturn(mode) && 246 } else if (((RelocInfo::IsJSReturn(mode) &&
274 IsPatchedReturnSequence()) || 247 IsPatchedReturnSequence()) ||
275 (RelocInfo::IsDebugBreakSlot(mode) && 248 (RelocInfo::IsDebugBreakSlot(mode) &&
276 IsPatchedDebugBreakSlotSequence())) && 249 IsPatchedDebugBreakSlotSequence())) &&
277 Isolate::Current()->debug()->has_break_points()) { 250 Isolate::Current()->debug()->has_break_points()) {
278 visitor->VisitDebugTarget(this); 251 visitor->VisitDebugTarget(this);
279 #endif 252 #endif
280 } else if (mode == RelocInfo::RUNTIME_ENTRY) { 253 } else if (mode == RelocInfo::RUNTIME_ENTRY) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 CheckBuffer(); 303 CheckBuffer();
331 *reinterpret_cast<Instr*>(pc_) = x; 304 *reinterpret_cast<Instr*>(pc_) = x;
332 pc_ += kInstrSize; 305 pc_ += kInstrSize;
333 CheckTrampolinePoolQuick(); 306 CheckTrampolinePoolQuick();
334 } 307 }
335 308
336 309
337 } } // namespace v8::internal 310 } } // namespace v8::internal
338 311
339 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 312 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698