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

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

Issue 8106002: MIPS: port Merge experimental/gc branch to the bleeding_edge. (Closed)
Patch Set: Rebased on r9598, greatly simplified. Created 9 years, 2 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/mips/assembler-mips.cc ('k') | src/mips/code-stubs-mips.h » ('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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 Operand::Operand(Register rm) { 71 Operand::Operand(Register rm) {
72 rm_ = rm; 72 rm_ = rm;
73 } 73 }
74 74
75 75
76 bool Operand::is_reg() const { 76 bool Operand::is_reg() const {
77 return rm_.is_valid(); 77 return rm_.is_valid();
78 } 78 }
79 79
80 80
81
82 // ----------------------------------------------------------------------------- 81 // -----------------------------------------------------------------------------
83 // RelocInfo. 82 // RelocInfo.
84 83
85 void RelocInfo::apply(intptr_t delta) { 84 void RelocInfo::apply(intptr_t delta) {
86 if (IsCodeTarget(rmode_)) { 85 if (IsCodeTarget(rmode_)) {
87 uint32_t scope1 = (uint32_t) target_address() & ~kImm28Mask; 86 uint32_t scope1 = (uint32_t) target_address() & ~kImm28Mask;
88 uint32_t scope2 = reinterpret_cast<uint32_t>(pc_) & ~kImm28Mask; 87 uint32_t scope2 = reinterpret_cast<uint32_t>(pc_) & ~kImm28Mask;
89 88
90 if (scope1 != scope2) { 89 if (scope1 != scope2) {
91 Assembler::JumpLabelToJumpRegister(pc_); 90 Assembler::JumpLabelToJumpRegister(pc_);
(...skipping 21 matching lines...) Expand all
113 112
114 113
115 int RelocInfo::target_address_size() { 114 int RelocInfo::target_address_size() {
116 return Assembler::kExternalTargetSize; 115 return Assembler::kExternalTargetSize;
117 } 116 }
118 117
119 118
120 void RelocInfo::set_target_address(Address target) { 119 void RelocInfo::set_target_address(Address target) {
121 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 120 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
122 Assembler::set_target_address_at(pc_, target); 121 Assembler::set_target_address_at(pc_, target);
122 if (host() != NULL && IsCodeTarget(rmode_)) {
123 Object* target_code = Code::GetCodeFromTargetAddress(target);
124 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
125 host(), this, HeapObject::cast(target_code));
126 }
123 } 127 }
124 128
125 129
126 Object* RelocInfo::target_object() { 130 Object* RelocInfo::target_object() {
127 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 131 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
128 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_)); 132 return reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
129 } 133 }
130 134
131 135
132 Handle<Object> RelocInfo::target_object_handle(Assembler *origin) { 136 Handle<Object> RelocInfo::target_object_handle(Assembler *origin) {
133 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 137 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
134 return Handle<Object>(reinterpret_cast<Object**>( 138 return Handle<Object>(reinterpret_cast<Object**>(
135 Assembler::target_address_at(pc_))); 139 Assembler::target_address_at(pc_)));
136 } 140 }
137 141
138 142
139 Object** RelocInfo::target_object_address() { 143 Object** RelocInfo::target_object_address() {
140 // Provide a "natural pointer" to the embedded object, 144 // Provide a "natural pointer" to the embedded object,
141 // which can be de-referenced during heap iteration. 145 // which can be de-referenced during heap iteration.
142 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 146 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
143 reconstructed_obj_ptr_ = 147 reconstructed_obj_ptr_ =
144 reinterpret_cast<Object*>(Assembler::target_address_at(pc_)); 148 reinterpret_cast<Object*>(Assembler::target_address_at(pc_));
145 return &reconstructed_obj_ptr_; 149 return &reconstructed_obj_ptr_;
146 } 150 }
147 151
148 152
149 void RelocInfo::set_target_object(Object* target) { 153 void RelocInfo::set_target_object(Object* target) {
150 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 154 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
151 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target)); 155 Assembler::set_target_address_at(pc_, reinterpret_cast<Address>(target));
156 if (host() != NULL && target->IsHeapObject()) {
157 host()->GetHeap()->incremental_marking()->RecordWrite(
158 host(), &Memory::Object_at(pc_), HeapObject::cast(target));
159 }
152 } 160 }
153 161
154 162
155 Address* RelocInfo::target_reference_address() { 163 Address* RelocInfo::target_reference_address() {
156 ASSERT(rmode_ == EXTERNAL_REFERENCE); 164 ASSERT(rmode_ == EXTERNAL_REFERENCE);
157 reconstructed_adr_ptr_ = Assembler::target_address_at(pc_); 165 reconstructed_adr_ptr_ = Assembler::target_address_at(pc_);
158 return &reconstructed_adr_ptr_; 166 return &reconstructed_adr_ptr_;
159 } 167 }
160 168
161 169
(...skipping 11 matching lines...) Expand all
173 Object* object = HeapObject::FromAddress( 181 Object* object = HeapObject::FromAddress(
174 address - JSGlobalPropertyCell::kValueOffset); 182 address - JSGlobalPropertyCell::kValueOffset);
175 return reinterpret_cast<JSGlobalPropertyCell*>(object); 183 return reinterpret_cast<JSGlobalPropertyCell*>(object);
176 } 184 }
177 185
178 186
179 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { 187 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) {
180 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 188 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
181 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; 189 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset;
182 Memory::Address_at(pc_) = address; 190 Memory::Address_at(pc_) = address;
191 if (host() != NULL) {
192 // TODO(1550) We are passing NULL as a slot because cell can never be on
193 // evacuation candidate.
194 host()->GetHeap()->incremental_marking()->RecordWrite(
195 host(), NULL, cell);
196 }
183 } 197 }
184 198
185 199
186 Address RelocInfo::call_address() { 200 Address RelocInfo::call_address() {
187 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 201 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
188 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 202 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
189 // The pc_ offset of 0 assumes mips patched return sequence per 203 // The pc_ offset of 0 assumes mips patched return sequence per
190 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or 204 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
191 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot(). 205 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
192 return Assembler::target_address_at(pc_); 206 return Assembler::target_address_at(pc_);
193 } 207 }
194 208
195 209
196 void RelocInfo::set_call_address(Address target) { 210 void RelocInfo::set_call_address(Address target) {
197 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 211 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
198 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 212 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
199 // The pc_ offset of 0 assumes mips patched return sequence per 213 // The pc_ offset of 0 assumes mips patched return sequence per
200 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or 214 // debug-mips.cc BreakLocationIterator::SetDebugBreakAtReturn(), or
201 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot(). 215 // debug break slot per BreakLocationIterator::SetDebugBreakAtSlot().
202 Assembler::set_target_address_at(pc_, target); 216 Assembler::set_target_address_at(pc_, target);
217 if (host() != NULL) {
218 Object* target_code = Code::GetCodeFromTargetAddress(target);
219 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode(
220 host(), this, HeapObject::cast(target_code));
221 }
203 } 222 }
204 223
205 224
206 Object* RelocInfo::call_object() { 225 Object* RelocInfo::call_object() {
207 return *call_object_address(); 226 return *call_object_address();
208 } 227 }
209 228
210 229
211 Object** RelocInfo::call_object_address() { 230 Object** RelocInfo::call_object_address() {
212 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 231 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
(...skipping 22 matching lines...) Expand all
235 254
236 bool RelocInfo::IsPatchedDebugBreakSlotSequence() { 255 bool RelocInfo::IsPatchedDebugBreakSlotSequence() {
237 Instr current_instr = Assembler::instr_at(pc_); 256 Instr current_instr = Assembler::instr_at(pc_);
238 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP); 257 return !Assembler::IsNop(current_instr, Assembler::DEBUG_BREAK_NOP);
239 } 258 }
240 259
241 260
242 void RelocInfo::Visit(ObjectVisitor* visitor) { 261 void RelocInfo::Visit(ObjectVisitor* visitor) {
243 RelocInfo::Mode mode = rmode(); 262 RelocInfo::Mode mode = rmode();
244 if (mode == RelocInfo::EMBEDDED_OBJECT) { 263 if (mode == RelocInfo::EMBEDDED_OBJECT) {
245 Object** p = target_object_address(); 264 visitor->VisitEmbeddedPointer(this);
246 Object* orig = *p;
247 visitor->VisitEmbeddedPointer(host(), p);
248 if (*p != orig) {
249 set_target_object(*p);
250 }
251 } else if (RelocInfo::IsCodeTarget(mode)) { 265 } else if (RelocInfo::IsCodeTarget(mode)) {
252 visitor->VisitCodeTarget(this); 266 visitor->VisitCodeTarget(this);
253 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 267 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
254 visitor->VisitGlobalPropertyCell(this); 268 visitor->VisitGlobalPropertyCell(this);
255 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 269 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
256 visitor->VisitExternalReference(target_reference_address()); 270 visitor->VisitExternalReference(target_reference_address());
257 #ifdef ENABLE_DEBUGGER_SUPPORT 271 #ifdef ENABLE_DEBUGGER_SUPPORT
258 // TODO(isolates): Get a cached isolate below. 272 // TODO(isolates): Get a cached isolate below.
259 } else if (((RelocInfo::IsJSReturn(mode) && 273 } else if (((RelocInfo::IsJSReturn(mode) &&
260 IsPatchedReturnSequence()) || 274 IsPatchedReturnSequence()) ||
261 (RelocInfo::IsDebugBreakSlot(mode) && 275 (RelocInfo::IsDebugBreakSlot(mode) &&
262 IsPatchedDebugBreakSlotSequence())) && 276 IsPatchedDebugBreakSlotSequence())) &&
263 Isolate::Current()->debug()->has_break_points()) { 277 Isolate::Current()->debug()->has_break_points()) {
264 visitor->VisitDebugTarget(this); 278 visitor->VisitDebugTarget(this);
265 #endif 279 #endif
266 } else if (mode == RelocInfo::RUNTIME_ENTRY) { 280 } else if (mode == RelocInfo::RUNTIME_ENTRY) {
267 visitor->VisitRuntimeEntry(this); 281 visitor->VisitRuntimeEntry(this);
268 } 282 }
269 } 283 }
270 284
271 285
272 template<typename StaticVisitor> 286 template<typename StaticVisitor>
273 void RelocInfo::Visit(Heap* heap) { 287 void RelocInfo::Visit(Heap* heap) {
274 RelocInfo::Mode mode = rmode(); 288 RelocInfo::Mode mode = rmode();
275 if (mode == RelocInfo::EMBEDDED_OBJECT) { 289 if (mode == RelocInfo::EMBEDDED_OBJECT) {
276 StaticVisitor::VisitEmbeddedPointer(heap, host(), target_object_address()); 290 StaticVisitor::VisitEmbeddedPointer(heap, this);
277 } else if (RelocInfo::IsCodeTarget(mode)) { 291 } else if (RelocInfo::IsCodeTarget(mode)) {
278 StaticVisitor::VisitCodeTarget(heap, this); 292 StaticVisitor::VisitCodeTarget(heap, this);
279 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 293 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
280 StaticVisitor::VisitGlobalPropertyCell(heap, this); 294 StaticVisitor::VisitGlobalPropertyCell(heap, this);
281 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 295 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
282 StaticVisitor::VisitExternalReference(target_reference_address()); 296 StaticVisitor::VisitExternalReference(target_reference_address());
283 #ifdef ENABLE_DEBUGGER_SUPPORT 297 #ifdef ENABLE_DEBUGGER_SUPPORT
284 } else if (heap->isolate()->debug()->has_break_points() && 298 } else if (heap->isolate()->debug()->has_break_points() &&
285 ((RelocInfo::IsJSReturn(mode) && 299 ((RelocInfo::IsJSReturn(mode) &&
286 IsPatchedReturnSequence()) || 300 IsPatchedReturnSequence()) ||
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 } 332 }
319 *reinterpret_cast<Instr*>(pc_) = x; 333 *reinterpret_cast<Instr*>(pc_) = x;
320 pc_ += kInstrSize; 334 pc_ += kInstrSize;
321 CheckTrampolinePoolQuick(); 335 CheckTrampolinePoolQuick();
322 } 336 }
323 337
324 338
325 } } // namespace v8::internal 339 } } // namespace v8::internal
326 340
327 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_ 341 #endif // V8_MIPS_ASSEMBLER_MIPS_INL_H_
OLDNEW
« no previous file with comments | « src/mips/assembler-mips.cc ('k') | src/mips/code-stubs-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698