OLD | NEW |
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 WriteBarrierMode write_barrier_mode, | 130 WriteBarrierMode write_barrier_mode, |
131 ICacheFlushMode icache_flush_mode) { | 131 ICacheFlushMode icache_flush_mode) { |
132 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 132 DCHECK(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
133 Memory::Object_at(pc_) = target; | 133 Memory::Object_at(pc_) = target; |
134 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { | 134 if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
135 Assembler::FlushICache(isolate_, pc_, sizeof(Address)); | 135 Assembler::FlushICache(isolate_, pc_, sizeof(Address)); |
136 } | 136 } |
137 if (write_barrier_mode == UPDATE_WRITE_BARRIER && | 137 if (write_barrier_mode == UPDATE_WRITE_BARRIER && |
138 host() != NULL && | 138 host() != NULL && |
139 target->IsHeapObject()) { | 139 target->IsHeapObject()) { |
140 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 140 host()->GetHeap()->RecordWriteIntoCode(host(), this, target); |
141 host(), this, HeapObject::cast(target)); | |
142 } | 141 } |
143 } | 142 } |
144 | 143 |
145 | 144 |
146 Address RelocInfo::target_external_reference() { | 145 Address RelocInfo::target_external_reference() { |
147 DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | 146 DCHECK(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
148 return Memory::Address_at(pc_); | 147 return Memory::Address_at(pc_); |
149 } | 148 } |
150 | 149 |
151 | 150 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 x_ = reinterpret_cast<int32_t>(internal_offset); | 333 x_ = reinterpret_cast<int32_t>(internal_offset); |
335 rmode_ = RelocInfo::INTERNAL_REFERENCE; | 334 rmode_ = RelocInfo::INTERNAL_REFERENCE; |
336 } | 335 } |
337 | 336 |
338 | 337 |
339 Immediate::Immediate(Handle<Object> handle) { | 338 Immediate::Immediate(Handle<Object> handle) { |
340 AllowDeferredHandleDereference using_raw_address; | 339 AllowDeferredHandleDereference using_raw_address; |
341 // Verify all Objects referred by code are NOT in new space. | 340 // Verify all Objects referred by code are NOT in new space. |
342 Object* obj = *handle; | 341 Object* obj = *handle; |
343 if (obj->IsHeapObject()) { | 342 if (obj->IsHeapObject()) { |
344 DCHECK(!HeapObject::cast(obj)->GetHeap()->InNewSpace(obj)); | |
345 x_ = reinterpret_cast<intptr_t>(handle.location()); | 343 x_ = reinterpret_cast<intptr_t>(handle.location()); |
346 rmode_ = RelocInfo::EMBEDDED_OBJECT; | 344 rmode_ = RelocInfo::EMBEDDED_OBJECT; |
347 } else { | 345 } else { |
348 // no relocation needed | 346 // no relocation needed |
349 x_ = reinterpret_cast<intptr_t>(obj); | 347 x_ = reinterpret_cast<intptr_t>(obj); |
350 rmode_ = RelocInfo::NONE32; | 348 rmode_ = RelocInfo::NONE32; |
351 } | 349 } |
352 } | 350 } |
353 | 351 |
354 | 352 |
(...skipping 18 matching lines...) Expand all Loading... |
373 void Assembler::emit_q(uint64_t x) { | 371 void Assembler::emit_q(uint64_t x) { |
374 *reinterpret_cast<uint64_t*>(pc_) = x; | 372 *reinterpret_cast<uint64_t*>(pc_) = x; |
375 pc_ += sizeof(uint64_t); | 373 pc_ += sizeof(uint64_t); |
376 } | 374 } |
377 | 375 |
378 | 376 |
379 void Assembler::emit(Handle<Object> handle) { | 377 void Assembler::emit(Handle<Object> handle) { |
380 AllowDeferredHandleDereference heap_object_check; | 378 AllowDeferredHandleDereference heap_object_check; |
381 // Verify all Objects referred by code are NOT in new space. | 379 // Verify all Objects referred by code are NOT in new space. |
382 Object* obj = *handle; | 380 Object* obj = *handle; |
383 DCHECK(!isolate()->heap()->InNewSpace(obj)); | |
384 if (obj->IsHeapObject()) { | 381 if (obj->IsHeapObject()) { |
385 emit(reinterpret_cast<intptr_t>(handle.location()), | 382 emit(reinterpret_cast<intptr_t>(handle.location()), |
386 RelocInfo::EMBEDDED_OBJECT); | 383 RelocInfo::EMBEDDED_OBJECT); |
387 } else { | 384 } else { |
388 // no relocation needed | 385 // no relocation needed |
389 emit(reinterpret_cast<intptr_t>(obj)); | 386 emit(reinterpret_cast<intptr_t>(obj)); |
390 } | 387 } |
391 } | 388 } |
392 | 389 |
393 | 390 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 | 550 |
554 Operand::Operand(Immediate imm) { | 551 Operand::Operand(Immediate imm) { |
555 // [disp/r] | 552 // [disp/r] |
556 set_modrm(0, ebp); | 553 set_modrm(0, ebp); |
557 set_dispr(imm.x_, imm.rmode_); | 554 set_dispr(imm.x_, imm.rmode_); |
558 } | 555 } |
559 } // namespace internal | 556 } // namespace internal |
560 } // namespace v8 | 557 } // namespace v8 |
561 | 558 |
562 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 559 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
OLD | NEW |