OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 } | 325 } |
326 | 326 |
327 | 327 |
328 void RelocInfo::set_target_runtime_entry(Address target, | 328 void RelocInfo::set_target_runtime_entry(Address target, |
329 WriteBarrierMode mode) { | 329 WriteBarrierMode mode) { |
330 ASSERT(IsRuntimeEntry(rmode_)); | 330 ASSERT(IsRuntimeEntry(rmode_)); |
331 if (target_address() != target) set_target_address(target, mode); | 331 if (target_address() != target) set_target_address(target, mode); |
332 } | 332 } |
333 | 333 |
334 | 334 |
335 Handle<JSGlobalPropertyCell> RelocInfo::target_cell_handle() { | 335 Handle<Cell> RelocInfo::target_cell_handle() { |
336 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 336 ASSERT(rmode_ == RelocInfo::CELL); |
337 Address address = Memory::Address_at(pc_); | 337 Address address = Memory::Address_at(pc_); |
338 return Handle<JSGlobalPropertyCell>( | 338 return Handle<Cell>(reinterpret_cast<Cell**>(address)); |
339 reinterpret_cast<JSGlobalPropertyCell**>(address)); | |
340 } | 339 } |
341 | 340 |
342 | 341 |
343 JSGlobalPropertyCell* RelocInfo::target_cell() { | 342 Cell* RelocInfo::target_cell() { |
344 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 343 ASSERT(rmode_ == RelocInfo::CELL); |
345 return JSGlobalPropertyCell::FromValueAddress(Memory::Address_at(pc_)); | 344 return Cell::FromValueAddress(Memory::Address_at(pc_)); |
346 } | 345 } |
347 | 346 |
348 | 347 |
349 void RelocInfo::set_target_cell(JSGlobalPropertyCell* cell, | 348 void RelocInfo::set_target_cell(Cell* cell, WriteBarrierMode mode) { |
350 WriteBarrierMode mode) { | 349 ASSERT(rmode_ == RelocInfo::CELL); |
351 ASSERT(rmode_ == RelocInfo::GLOBAL_PROPERTY_CELL); | 350 Address address = cell->address() + Cell::kValueOffset; |
352 Address address = cell->address() + JSGlobalPropertyCell::kValueOffset; | |
353 Memory::Address_at(pc_) = address; | 351 Memory::Address_at(pc_) = address; |
354 CPU::FlushICache(pc_, sizeof(Address)); | 352 CPU::FlushICache(pc_, sizeof(Address)); |
355 if (mode == UPDATE_WRITE_BARRIER && | 353 if (mode == UPDATE_WRITE_BARRIER && |
356 host() != NULL) { | 354 host() != NULL) { |
357 // TODO(1550) We are passing NULL as a slot because cell can never be on | 355 // TODO(1550) We are passing NULL as a slot because cell can never be on |
358 // evacuation candidate. | 356 // evacuation candidate. |
359 host()->GetHeap()->incremental_marking()->RecordWrite( | 357 host()->GetHeap()->incremental_marking()->RecordWrite( |
360 host(), NULL, cell); | 358 host(), NULL, cell); |
361 } | 359 } |
362 } | 360 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 } | 436 } |
439 | 437 |
440 | 438 |
441 void RelocInfo::Visit(ObjectVisitor* visitor) { | 439 void RelocInfo::Visit(ObjectVisitor* visitor) { |
442 RelocInfo::Mode mode = rmode(); | 440 RelocInfo::Mode mode = rmode(); |
443 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 441 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
444 visitor->VisitEmbeddedPointer(this); | 442 visitor->VisitEmbeddedPointer(this); |
445 CPU::FlushICache(pc_, sizeof(Address)); | 443 CPU::FlushICache(pc_, sizeof(Address)); |
446 } else if (RelocInfo::IsCodeTarget(mode)) { | 444 } else if (RelocInfo::IsCodeTarget(mode)) { |
447 visitor->VisitCodeTarget(this); | 445 visitor->VisitCodeTarget(this); |
448 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 446 } else if (mode == RelocInfo::CELL) { |
449 visitor->VisitGlobalPropertyCell(this); | 447 visitor->VisitCell(this); |
450 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 448 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
451 visitor->VisitExternalReference(this); | 449 visitor->VisitExternalReference(this); |
452 CPU::FlushICache(pc_, sizeof(Address)); | 450 CPU::FlushICache(pc_, sizeof(Address)); |
453 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 451 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
454 visitor->VisitCodeAgeSequence(this); | 452 visitor->VisitCodeAgeSequence(this); |
455 #ifdef ENABLE_DEBUGGER_SUPPORT | 453 #ifdef ENABLE_DEBUGGER_SUPPORT |
456 // TODO(isolates): Get a cached isolate below. | 454 // TODO(isolates): Get a cached isolate below. |
457 } else if (((RelocInfo::IsJSReturn(mode) && | 455 } else if (((RelocInfo::IsJSReturn(mode) && |
458 IsPatchedReturnSequence()) || | 456 IsPatchedReturnSequence()) || |
459 (RelocInfo::IsDebugBreakSlot(mode) && | 457 (RelocInfo::IsDebugBreakSlot(mode) && |
460 IsPatchedDebugBreakSlotSequence())) && | 458 IsPatchedDebugBreakSlotSequence())) && |
461 Isolate::Current()->debug()->has_break_points()) { | 459 Isolate::Current()->debug()->has_break_points()) { |
462 visitor->VisitDebugTarget(this); | 460 visitor->VisitDebugTarget(this); |
463 #endif | 461 #endif |
464 } else if (RelocInfo::IsRuntimeEntry(mode)) { | 462 } else if (RelocInfo::IsRuntimeEntry(mode)) { |
465 visitor->VisitRuntimeEntry(this); | 463 visitor->VisitRuntimeEntry(this); |
466 } | 464 } |
467 } | 465 } |
468 | 466 |
469 | 467 |
470 template<typename StaticVisitor> | 468 template<typename StaticVisitor> |
471 void RelocInfo::Visit(Heap* heap) { | 469 void RelocInfo::Visit(Heap* heap) { |
472 RelocInfo::Mode mode = rmode(); | 470 RelocInfo::Mode mode = rmode(); |
473 if (mode == RelocInfo::EMBEDDED_OBJECT) { | 471 if (mode == RelocInfo::EMBEDDED_OBJECT) { |
474 StaticVisitor::VisitEmbeddedPointer(heap, this); | 472 StaticVisitor::VisitEmbeddedPointer(heap, this); |
475 CPU::FlushICache(pc_, sizeof(Address)); | 473 CPU::FlushICache(pc_, sizeof(Address)); |
476 } else if (RelocInfo::IsCodeTarget(mode)) { | 474 } else if (RelocInfo::IsCodeTarget(mode)) { |
477 StaticVisitor::VisitCodeTarget(heap, this); | 475 StaticVisitor::VisitCodeTarget(heap, this); |
478 } else if (mode == RelocInfo::GLOBAL_PROPERTY_CELL) { | 476 } else if (mode == RelocInfo::CELL) { |
479 StaticVisitor::VisitGlobalPropertyCell(heap, this); | 477 StaticVisitor::VisitCell(heap, this); |
480 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { | 478 } else if (mode == RelocInfo::EXTERNAL_REFERENCE) { |
481 StaticVisitor::VisitExternalReference(this); | 479 StaticVisitor::VisitExternalReference(this); |
482 CPU::FlushICache(pc_, sizeof(Address)); | 480 CPU::FlushICache(pc_, sizeof(Address)); |
483 } else if (RelocInfo::IsCodeAgeSequence(mode)) { | 481 } else if (RelocInfo::IsCodeAgeSequence(mode)) { |
484 StaticVisitor::VisitCodeAgeSequence(heap, this); | 482 StaticVisitor::VisitCodeAgeSequence(heap, this); |
485 #ifdef ENABLE_DEBUGGER_SUPPORT | 483 #ifdef ENABLE_DEBUGGER_SUPPORT |
486 } else if (heap->isolate()->debug()->has_break_points() && | 484 } else if (heap->isolate()->debug()->has_break_points() && |
487 ((RelocInfo::IsJSReturn(mode) && | 485 ((RelocInfo::IsJSReturn(mode) && |
488 IsPatchedReturnSequence()) || | 486 IsPatchedReturnSequence()) || |
489 (RelocInfo::IsDebugBreakSlot(mode) && | 487 (RelocInfo::IsDebugBreakSlot(mode) && |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 ASSERT(len_ == 1 || len_ == 2); | 528 ASSERT(len_ == 1 || len_ == 2); |
531 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); | 529 int32_t* p = reinterpret_cast<int32_t*>(&buf_[len_]); |
532 *p = disp; | 530 *p = disp; |
533 len_ += sizeof(int32_t); | 531 len_ += sizeof(int32_t); |
534 } | 532 } |
535 | 533 |
536 | 534 |
537 } } // namespace v8::internal | 535 } } // namespace v8::internal |
538 | 536 |
539 #endif // V8_X64_ASSEMBLER_X64_INL_H_ | 537 #endif // V8_X64_ASSEMBLER_X64_INL_H_ |
OLD | NEW |