| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 81 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 82 return reinterpret_cast<Address>(pc_); | 82 return reinterpret_cast<Address>(pc_); |
| 83 } | 83 } |
| 84 | 84 |
| 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) { | 91 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { |
| 92 Assembler::set_target_address_at(pc_, target); | 92 Assembler::set_target_address_at(pc_, target); |
| 93 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 93 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
| 94 if (host() != NULL && IsCodeTarget(rmode_)) { | 94 if (mode == UPDATE_WRITE_BARRIER && host() != NULL && IsCodeTarget(rmode_)) { |
| 95 Object* target_code = Code::GetCodeFromTargetAddress(target); | 95 Object* target_code = Code::GetCodeFromTargetAddress(target); |
| 96 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 96 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
| 97 host(), this, HeapObject::cast(target_code)); | 97 host(), this, HeapObject::cast(target_code)); |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 Object* RelocInfo::target_object() { | 102 Object* RelocInfo::target_object() { |
| 103 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 103 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 104 return Memory::Object_at(pc_); | 104 return Memory::Object_at(pc_); |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { | 108 Handle<Object> RelocInfo::target_object_handle(Assembler* origin) { |
| 109 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 109 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 110 return Memory::Object_Handle_at(pc_); | 110 return Memory::Object_Handle_at(pc_); |
| 111 } | 111 } |
| 112 | 112 |
| 113 | 113 |
| 114 Object** RelocInfo::target_object_address() { | 114 Object** RelocInfo::target_object_address() { |
| 115 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 115 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 116 return &Memory::Object_at(pc_); | 116 return &Memory::Object_at(pc_); |
| 117 } | 117 } |
| 118 | 118 |
| 119 | 119 |
| 120 void RelocInfo::set_target_object(Object* target) { | 120 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { |
| 121 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 121 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
| 122 Memory::Object_at(pc_) = target; | 122 Memory::Object_at(pc_) = target; |
| 123 CPU::FlushICache(pc_, sizeof(Address)); | 123 CPU::FlushICache(pc_, sizeof(Address)); |
| 124 if (host() != NULL && target->IsHeapObject()) { | 124 if (mode == UPDATE_WRITE_BARRIER && |
| 125 host() != NULL && |
| 126 target->IsHeapObject()) { |
| 125 host()->GetHeap()->incremental_marking()->RecordWrite( | 127 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 126 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 128 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
| 127 } | 129 } |
| 128 } | 130 } |
| 129 | 131 |
| 130 | 132 |
| 131 Address* RelocInfo::target_reference_address() { | 133 Address* RelocInfo::target_reference_address() { |
| 132 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | 134 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
| 133 return reinterpret_cast<Address*>(pc_); | 135 return reinterpret_cast<Address*>(pc_); |
| 134 } | 136 } |
| 135 | 137 |
| 136 | 138 |
| 137 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { | 139 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { |
| 138 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 140 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 139 Address address = Memory::Address_at(pc_); | 141 Address address = Memory::Address_at(pc_); |
| 140 return Handle<JSGlobalPropertyCell>( | 142 return Handle<JSGlobalPropertyCell>( |
| 141 reinterpret_cast<JSGlobalPropertyCell**>(address)); | 143 reinterpret_cast<JSGlobalPropertyCell**>(address)); |
| 142 } | 144 } |
| 143 | 145 |
| 144 | 146 |
| 145 JSGlobalPropertyCell* RelocInfo::target_cell() { | 147 JSGlobalPropertyCell* RelocInfo::target_cell() { |
| 146 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 148 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 147 Address address = Memory::Address_at(pc_); | 149 Address address = Memory::Address_at(pc_); |
| 148 Object* object = HeapObject::FromAddress( | 150 Object* object = HeapObject::FromAddress( |
| 149 address - JSGlobalPropertyCell::kValueOffset); | 151 address - JSGlobalPropertyCell::kValueOffset); |
| 150 return reinterpret_cast<JSGlobalPropertyCell*>(object); | 152 return reinterpret_cast<JSGlobalPropertyCell*>(object); |
| 151 } | 153 } |
| 152 | 154 |
| 153 | 155 |
| 154 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { | 156 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, |
| 157 WriteBarrierMode mode) { |
| 155 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 158 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
| 156 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; | 159 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; |
| 157 Memory::Address_at(pc_) = address; | 160 Memory::Address_at(pc_) = address; |
| 158 CPU::FlushICache(pc_, sizeof(Address)); | 161 CPU::FlushICache(pc_, sizeof(Address)); |
| 159 if (host() != NULL) { | 162 if (mode == UPDATE_WRITE_BARRIER && host() != NULL) { |
| 160 // TODO(1550) We are passing NULL as a slot because cell can never be on | 163 // TODO(1550) We are passing NULL as a slot because cell can never be on |
| 161 // evacuation candidate. | 164 // evacuation candidate. |
| 162 host()->GetHeap()->incremental_marking()->RecordWrite( | 165 host()->GetHeap()->incremental_marking()->RecordWrite( |
| 163 host(), NULL, cell); | 166 host(), NULL, cell); |
| 164 } | 167 } |
| 165 } | 168 } |
| 166 | 169 |
| 167 | 170 |
| 168 Address RelocInfo::call_address() { | 171 Address RelocInfo::call_address() { |
| 169 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || | 172 ASSERT((IsJSReturn(rmode()) && IsPatchedReturnSequence()) || |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 | 460 |
| 458 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { | 461 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { |
| 459 // [disp/r] | 462 // [disp/r] |
| 460 set_modrm(0, ebp); | 463 set_modrm(0, ebp); |
| 461 set_dispr(disp, rmode); | 464 set_dispr(disp, rmode); |
| 462 } | 465 } |
| 463 | 466 |
| 464 } } // namespace v8::internal | 467 } } // namespace v8::internal |
| 465 | 468 |
| 466 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ | 469 #endif // V8_IA32_ASSEMBLER_IA32_INL_H_ |
| OLD | NEW |