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

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

Issue 6880010: Merge (7265, 7271] from bleeding_edge to experimental/gc branch.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: '' Created 9 years, 8 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 | Annotate | Revision Log
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 int RelocInfo::target_address_size() { 86 int RelocInfo::target_address_size() {
87 return Assembler::kExternalTargetSize; 87 return Assembler::kExternalTargetSize;
88 } 88 }
89 89
90 90
91 void RelocInfo::set_target_address(Address target, Code* code) { 91 void RelocInfo::set_target_address(Address target, Code* code) {
92 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); 92 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY);
93 if (code != NULL && IsCodeTarget(rmode_)) { 93 if (code != NULL && IsCodeTarget(rmode_)) {
94 Object* target_code = Code::GetCodeFromTargetAddress(target); 94 Object* target_code = Code::GetCodeFromTargetAddress(target);
95 IncrementalMarking::RecordWrite(code, HeapObject::cast(target_code)); 95 // TODO(gc) ISOLATES MERGE code should have heap.
96 code->GetHeap()->incremental_marking()->RecordWrite(
97 code, HeapObject::cast(target_code));
96 } 98 }
97 Assembler::set_target_address_at(pc_, target); 99 Assembler::set_target_address_at(pc_, target);
98 } 100 }
99 101
100 102
101 Object* RelocInfo::target_object() { 103 Object* RelocInfo::target_object() {
102 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 104 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
103 return Memory::Object_at(pc_); 105 return Memory::Object_at(pc_);
104 } 106 }
105 107
106 108
107 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { 109 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) {
108 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 110 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
109 return Memory::Object_Handle_at(pc_); 111 return Memory::Object_Handle_at(pc_);
110 } 112 }
111 113
112 114
113 Object** RelocInfo::target_object_address() { 115 Object** RelocInfo::target_object_address() {
114 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 116 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
115 return &Memory::Object_at(pc_); 117 return &Memory::Object_at(pc_);
116 } 118 }
117 119
118 120
119 void RelocInfo::set_target_object(Object* target, Code* code) { 121 void RelocInfo::set_target_object(Object* target, Code* code) {
120 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); 122 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT);
121 Memory::Object_at(pc_) = target; 123 Memory::Object_at(pc_) = target;
122 CPU::FlushICache(pc_, sizeof(Address)); 124 CPU::FlushICache(pc_, sizeof(Address));
123 if (code != NULL && target->IsHeapObject()) { 125 if (code != NULL && target->IsHeapObject()) {
124 IncrementalMarking::RecordWrite(code, HeapObject::cast(target)); 126 // TODO(gc) ISOLATES MERGE code object should have heap() accessor.
127 code->GetHeap()->incremental_marking()->RecordWrite(
128 code, HeapObject::cast(target));
125 } 129 }
126 } 130 }
127 131
128 132
129 Address* RelocInfo::target_reference_address() { 133 Address* RelocInfo::target_reference_address() {
130 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); 134 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE);
131 return reinterpret_cast<Address*>(pc_); 135 return reinterpret_cast<Address*>(pc_);
132 } 136 }
133 137
134 138
(...skipping 12 matching lines...) Expand all
147 address - JSGlobalPropertyCell::kValueOffset); 151 address - JSGlobalPropertyCell::kValueOffset);
148 return reinterpret_cast<JSGlobalPropertyCell*>(object); 152 return reinterpret_cast<JSGlobalPropertyCell*>(object);
149 } 153 }
150 154
151 155
152 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, Code* code) { 156 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, Code* code) {
153 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); 157 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL);
154 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; 158 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset;
155 Memory::Address_at(pc_) = address; 159 Memory::Address_at(pc_) = address;
156 CPU::FlushICache(pc_, sizeof(Address)); 160 CPU::FlushICache(pc_, sizeof(Address));
157 if (code != NULL) IncrementalMarking::RecordWrite(code, cell); 161 if (code != NULL) {
162 // TODO(gc) ISOLATES MERGE code object should have heap() accessor.
163 code->GetHeap()->incremental_marking()->RecordWrite(code, cell);
164 }
158 } 165 }
159 166
160 167
161 Address RelocInfo::call_address() { 168 Address RelocInfo::call_address() {
162 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || 169 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) ||
163 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence())); 170 (IsDebugBreakSlot(rmode()) && IsPatchedDebugBreakSlotSequence()));
164 return Assembler::target_address_at(pc_ + 1); 171 return Assembler::target_address_at(pc_ + 1);
165 } 172 }
166 173
167 174
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 visitor->VisitPointer(target_object_address()); 212 visitor->VisitPointer(target_object_address());
206 CPU::FlushICache(pc_, sizeof(Address)); 213 CPU::FlushICache(pc_, sizeof(Address));
207 } else if (RelocInfo::IsCodeTarget(mode)) { 214 } else if (RelocInfo::IsCodeTarget(mode)) {
208 visitor->VisitCodeTarget(this); 215 visitor->VisitCodeTarget(this);
209 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 216 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
210 visitor->VisitGlobalPropertyCell(this); 217 visitor->VisitGlobalPropertyCell(this);
211 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 218 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
212 visitor->VisitExternalReference(target_reference_address()); 219 visitor->VisitExternalReference(target_reference_address());
213 CPU::FlushICache(pc_, sizeof(Address)); 220 CPU::FlushICache(pc_, sizeof(Address));
214 #ifdef ENABLE_DEBUGGER_SUPPORT 221 #ifdef ENABLE_DEBUGGER_SUPPORT
215 } else if (Debug::has_break_points() && 222 // TODO(isolates): Get a cached isolate below.
216 ((RelocInfo::IsJSReturn(mode) && 223 } else if (((RelocInfo::IsJSReturn(mode) &&
217 IsPatchedReturnSequence()) || 224 IsPatchedReturnSequence()) ||
218 (RelocInfo::IsDebugBreakSlot(mode) && 225 (RelocInfo::IsDebugBreakSlot(mode) &&
219 IsPatchedDebugBreakSlotSequence()))) { 226 IsPatchedDebugBreakSlotSequence())) &&
227 Isolate::Current()->debug()->has_break_points()) {
220 visitor->VisitDebugTarget(this); 228 visitor->VisitDebugTarget(this);
221 #endif 229 #endif
222 } else if (mode == RelocInfo::RUNTIME_ENTRY) { 230 } else if (mode == RelocInfo::RUNTIME_ENTRY) {
223 visitor->VisitRuntimeEntry(this); 231 visitor->VisitRuntimeEntry(this);
224 } 232 }
225 } 233 }
226 234
227 235
228 template<typename StaticVisitor> 236 template<typename StaticVisitor>
229 void RelocInfo::Visit() { 237 void RelocInfo::Visit(Heap* heap) {
230 RelocInfo::Mode mode = rmode(); 238 RelocInfo::Mode mode = rmode();
231 if (mode == RelocInfo::EMBEDDED_OBJECT) { 239 if (mode == RelocInfo::EMBEDDED_OBJECT) {
232 StaticVisitor::VisitPointer(target_object_address()); 240 StaticVisitor::VisitPointer(heap, target_object_address());
233 CPU::FlushICache(pc_, sizeof(Address)); 241 CPU::FlushICache(pc_, sizeof(Address));
234 } else if (RelocInfo::IsCodeTarget(mode)) { 242 } else if (RelocInfo::IsCodeTarget(mode)) {
235 StaticVisitor::VisitCodeTarget(this); 243 StaticVisitor::VisitCodeTarget(this);
236 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { 244 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) {
237 StaticVisitor::VisitGlobalPropertyCell(this); 245 StaticVisitor::VisitGlobalPropertyCell(this);
238 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { 246 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) {
239 StaticVisitor::VisitExternalReference(target_reference_address()); 247 StaticVisitor::VisitExternalReference(target_reference_address());
240 CPU::FlushICache(pc_, sizeof(Address)); 248 CPU::FlushICache(pc_, sizeof(Address));
241 #ifdef ENABLE_DEBUGGER_SUPPORT 249 #ifdef ENABLE_DEBUGGER_SUPPORT
242 } else if (Debug::has_break_points() && 250 } else if (heap->isolate()->debug()->has_break_points() &&
243 ((RelocInfo::IsJSReturn(mode) && 251 ((RelocInfo::IsJSReturn(mode) &&
244 IsPatchedReturnSequence()) || 252 IsPatchedReturnSequence()) ||
245 (RelocInfo::IsDebugBreakSlot(mode) && 253 (RelocInfo::IsDebugBreakSlot(mode) &&
246 IsPatchedDebugBreakSlotSequence()))) { 254 IsPatchedDebugBreakSlotSequence()))) {
247 StaticVisitor::VisitDebugTarget(this); 255 StaticVisitor::VisitDebugTarget(this);
248 #endif 256 #endif
249 } else if (mode == RelocInfo::RUNTIME_ENTRY) { 257 } else if (mode == RelocInfo::RUNTIME_ENTRY) {
250 StaticVisitor::VisitRuntimeEntry(this); 258 StaticVisitor::VisitRuntimeEntry(this);
251 } 259 }
252 } 260 }
(...skipping 14 matching lines...) Expand all
267 275
268 Immediate::Immediate(Label* internal_offset) { 276 Immediate::Immediate(Label* internal_offset) {
269 x_ = reinterpret_cast<int32_t>(internal_offset); 277 x_ = reinterpret_cast<int32_t>(internal_offset);
270 rmode_ = RelocInfo::INTERNAL_REFERENCE; 278 rmode_ = RelocInfo::INTERNAL_REFERENCE;
271 } 279 }
272 280
273 281
274 Immediate::Immediate(Handle<Object> handle) { 282 Immediate::Immediate(Handle<Object> handle) {
275 // Verify all Objects referred by code are NOT in new space. 283 // Verify all Objects referred by code are NOT in new space.
276 Object* obj = *handle; 284 Object* obj = *handle;
277 ASSERT(!Heap::InNewSpace(obj)); 285 ASSERT(!HEAP->InNewSpace(obj));
278 if (obj->IsHeapObject()) { 286 if (obj->IsHeapObject()) {
279 x_ = reinterpret_cast<intptr_t>(handle.location()); 287 x_ = reinterpret_cast<intptr_t>(handle.location());
280 rmode_ = RelocInfo::EMBEDDED_OBJECT; 288 rmode_ = RelocInfo::EMBEDDED_OBJECT;
281 } else { 289 } else {
282 // no relocation needed 290 // no relocation needed
283 x_ = reinterpret_cast<intptr_t>(obj); 291 x_ = reinterpret_cast<intptr_t>(obj);
284 rmode_ = RelocInfo::NONE; 292 rmode_ = RelocInfo::NONE;
285 } 293 }
286 } 294 }
287 295
(...skipping 12 matching lines...) Expand all
300 308
301 void Assembler::emit(uint32_t x) { 309 void Assembler::emit(uint32_t x) {
302 *reinterpret_cast<uint32_t*>(pc_) = x; 310 *reinterpret_cast<uint32_t*>(pc_) = x;
303 pc_ += sizeof(uint32_t); 311 pc_ += sizeof(uint32_t);
304 } 312 }
305 313
306 314
307 void Assembler::emit(Handle<Object> handle) { 315 void Assembler::emit(Handle<Object> handle) {
308 // Verify all Objects referred by code are NOT in new space. 316 // Verify all Objects referred by code are NOT in new space.
309 Object* obj = *handle; 317 Object* obj = *handle;
310 ASSERT(!Heap::InNewSpace(obj)); 318 ASSERT(!HEAP->InNewSpace(obj));
311 if (obj->IsHeapObject()) { 319 if (obj->IsHeapObject()) {
312 emit(reinterpret_cast<intptr_t>(handle.location()), 320 emit(reinterpret_cast<intptr_t>(handle.location()),
313 RelocInfo::EMBEDDED_OBJECT); 321 RelocInfo::EMBEDDED_OBJECT);
314 } else { 322 } else {
315 // no relocation needed 323 // no relocation needed
316 emit(reinterpret_cast<intptr_t>(obj)); 324 emit(reinterpret_cast<intptr_t>(obj));
317 } 325 }
318 } 326 }
319 327
320 328
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 436
429 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { 437 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) {
430 // [disp/r] 438 // [disp/r]
431 set_modrm(0, ebp); 439 set_modrm(0, ebp);
432 set_dispr(disp, rmode); 440 set_dispr(disp, rmode);
433 } 441 }
434 442
435 } } // namespace v8::internal 443 } } // namespace v8::internal
436 444
437 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ 445 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698