OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 | 231 |
232 int RelocInfo::target_address_size() { | 232 int RelocInfo::target_address_size() { |
233 if (IsCodedSpecially()) { | 233 if (IsCodedSpecially()) { |
234 return Assembler::kCallTargetSize; | 234 return Assembler::kCallTargetSize; |
235 } else { | 235 } else { |
236 return Assembler::kExternalTargetSize; | 236 return Assembler::kExternalTargetSize; |
237 } | 237 } |
238 } | 238 } |
239 | 239 |
240 | 240 |
241 void RelocInfo::set_target_address(Address target) { | 241 void RelocInfo::set_target_address(Address target, WriteBarrierMode mode) { |
242 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); | 242 ASSERT(IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY); |
243 if (IsCodeTarget(rmode_)) { | 243 if (IsCodeTarget(rmode_)) { |
244 Assembler::set_target_address_at(pc_, target); | 244 Assembler::set_target_address_at(pc_, target); |
245 Object* target_code = Code::GetCodeFromTargetAddress(target); | 245 Object* target_code = Code::GetCodeFromTargetAddress(target); |
246 if (host() != NULL) { | 246 if (mode == UPDATE_WRITE_BARRIER && host() != NULL) { |
247 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( | 247 host()->GetHeap()->incremental_marking()->RecordWriteIntoCode( |
248 host(), this, HeapObject::cast(target_code)); | 248 host(), this, HeapObject::cast(target_code)); |
249 } | 249 } |
250 } else { | 250 } else { |
251 Memory::Address_at(pc_) = target; | 251 Memory::Address_at(pc_) = target; |
252 CPU::FlushICache(pc_, sizeof(Address)); | 252 CPU::FlushICache(pc_, sizeof(Address)); |
253 } | 253 } |
254 } | 254 } |
255 | 255 |
256 | 256 |
(...skipping 18 matching lines...) Expand all Loading... |
275 return reinterpret_cast<Object**>(pc_); | 275 return reinterpret_cast<Object**>(pc_); |
276 } | 276 } |
277 | 277 |
278 | 278 |
279 Address* RelocInfo::target_reference_address() { | 279 Address* RelocInfo::target_reference_address() { |
280 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); | 280 ASSERT(rmode_ == RelocInfo::EXTERNAL_REFERENCE); |
281 return reinterpret_cast<Address*>(pc_); | 281 return reinterpret_cast<Address*>(pc_); |
282 } | 282 } |
283 | 283 |
284 | 284 |
285 void RelocInfo::set_target_object(Object* target) { | 285 void RelocInfo::set_target_object(Object* target, WriteBarrierMode mode) { |
286 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); | 286 ASSERT(IsCodeTarget(rmode_) || rmode_ == EMBEDDED_OBJECT); |
287 Memory::Object_at(pc_) = target; | 287 Memory::Object_at(pc_) = target; |
288 CPU::FlushICache(pc_, sizeof(Address)); | 288 CPU::FlushICache(pc_, sizeof(Address)); |
289 if (host() != NULL && target->IsHeapObject()) { | 289 if (mode == UPDATE_WRITE_BARRIER && |
| 290 host() != NULL && |
| 291 target->IsHeapObject()) { |
290 host()->GetHeap()->incremental_marking()->RecordWrite( | 292 host()->GetHeap()->incremental_marking()->RecordWrite( |
291 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); | 293 host(), &Memory::Object_at(pc_), HeapObject::cast(target)); |
292 } | 294 } |
293 } | 295 } |
294 | 296 |
295 | 297 |
296 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { | 298 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { |
297 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 299 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
298 Address address = Memory::Address_at(pc_); | 300 Address address = Memory::Address_at(pc_); |
299 return Handle<JSGlobalPropertyCell>( | 301 return Handle<JSGlobalPropertyCell>( |
300 reinterpret_cast<JSGlobalPropertyCell**>(address)); | 302 reinterpret_cast<JSGlobalPropertyCell**>(address)); |
301 } | 303 } |
302 | 304 |
303 | 305 |
304 JSGlobalPropertyCell* RelocInfo::target_cell() { | 306 JSGlobalPropertyCell* RelocInfo::target_cell() { |
305 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 307 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
306 Address address = Memory::Address_at(pc_); | 308 Address address = Memory::Address_at(pc_); |
307 Object* object = HeapObject::FromAddress( | 309 Object* object = HeapObject::FromAddress( |
308 address - JSGlobalPropertyCell::kValueOffset); | 310 address - JSGlobalPropertyCell::kValueOffset); |
309 return reinterpret_cast<JSGlobalPropertyCell*>(object); | 311 return reinterpret_cast<JSGlobalPropertyCell*>(object); |
310 } | 312 } |
311 | 313 |
312 | 314 |
313 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell) { | 315 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, |
| 316 WriteBarrierMode mode) { |
314 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 317 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); |
315 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; | 318 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; |
316 Memory::Address_at(pc_) = address; | 319 Memory::Address_at(pc_) = address; |
317 CPU::FlushICache(pc_, sizeof(Address)); | 320 CPU::FlushICache(pc_, sizeof(Address)); |
318 if (host() != NULL) { | 321 if (mode == UPDATE_WRITE_BARRIER && |
| 322 host() != NULL) { |
319 // TODO(1550) We are passing NULL as a slot because cell can never be on | 323 // TODO(1550) We are passing NULL as a slot because cell can never be on |
320 // evacuation candidate. | 324 // evacuation candidate. |
321 host()->GetHeap()->incremental_marking()->RecordWrite( | 325 host()->GetHeap()->incremental_marking()->RecordWrite( |
322 host(), NULL, cell); | 326 host(), NULL, cell); |
323 } | 327 } |
324 } | 328 } |
325 | 329 |
326 | 330 |
327 bool RelocInfo::IsPatchedReturnSequence() { | 331 bool RelocInfo::IsPatchedReturnSequence() { |
328 // The recognized call sequence is: | 332 // The recognized call sequence is: |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 ASSERT(len_ == 1 || len_ == 2); | 477 ASSERT(len_ == 1 || len_ == 2); |
474 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 478 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
475 *p = disp; | 479 *p = disp; |
476 len_ += sizeof(int32_t); | 480 len_ += sizeof(int32_t); |
477 } | 481 } |
478 | 482 |
479 | 483 |
480 } } // namespace v8::internal | 484 } } // namespace v8::internal |
481 | 485 |
482 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 486 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |