OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 reloc_infos_[i].set_target_address(substitution->instruction_start()); | 384 reloc_infos_[i].set_target_address(substitution->instruction_start()); |
385 } | 385 } |
386 } | 386 } |
387 | 387 |
388 private: | 388 private: |
389 Code* original_; | 389 Code* original_; |
390 ZoneList<Object**> rvalues_; | 390 ZoneList<Object**> rvalues_; |
391 ZoneList<RelocInfo> reloc_infos_; | 391 ZoneList<RelocInfo> reloc_infos_; |
392 }; | 392 }; |
393 | 393 |
| 394 |
| 395 class FrameCookingThreadVisitor : public ThreadVisitor { |
| 396 public: |
| 397 void VisitThread(ThreadLocalTop* top) { |
| 398 StackFrame::CookFramesForThread(top); |
| 399 } |
| 400 }; |
| 401 |
| 402 class FrameUncookingThreadVisitor : public ThreadVisitor { |
| 403 public: |
| 404 void VisitThread(ThreadLocalTop* top) { |
| 405 StackFrame::UncookFramesForThread(top); |
| 406 } |
| 407 }; |
| 408 |
| 409 static void IterateAllThreads(ThreadVisitor* visitor) { |
| 410 Top::IterateThread(visitor); |
| 411 ThreadManager::IterateThreads(visitor); |
| 412 } |
| 413 |
394 // Finds all references to original and replaces them with substitution. | 414 // Finds all references to original and replaces them with substitution. |
395 static void ReplaceCodeObject(Code* original, Code* substitution) { | 415 static void ReplaceCodeObject(Code* original, Code* substitution) { |
396 ASSERT(!Heap::InNewSpace(substitution)); | 416 ASSERT(!Heap::InNewSpace(substitution)); |
397 | 417 |
398 AssertNoAllocation no_allocations_please; | 418 AssertNoAllocation no_allocations_please; |
399 | 419 |
400 // A zone scope for ReferenceCollectorVisitor. | 420 // A zone scope for ReferenceCollectorVisitor. |
401 ZoneScope scope(DELETE_ON_EXIT); | 421 ZoneScope scope(DELETE_ON_EXIT); |
402 | 422 |
403 ReferenceCollectorVisitor visitor(original); | 423 ReferenceCollectorVisitor visitor(original); |
404 | 424 |
405 // Iterate over all roots. Stack frames may have pointer into original code, | 425 // Iterate over all roots. Stack frames may have pointer into original code, |
406 // so temporary replace the pointers with offset numbers | 426 // so temporary replace the pointers with offset numbers |
407 // in prologue/epilogue. | 427 // in prologue/epilogue. |
408 ThreadManager::MarkCompactPrologue(true); | 428 { |
409 Heap::IterateStrongRoots(&visitor, VISIT_ALL); | 429 FrameCookingThreadVisitor cooking_visitor; |
410 ThreadManager::MarkCompactEpilogue(true); | 430 IterateAllThreads(&cooking_visitor); |
| 431 |
| 432 Heap::IterateStrongRoots(&visitor, VISIT_ALL); |
| 433 |
| 434 FrameUncookingThreadVisitor uncooking_visitor; |
| 435 IterateAllThreads(&uncooking_visitor); |
| 436 } |
411 | 437 |
412 // Now iterate over all pointers of all objects, including code_target | 438 // Now iterate over all pointers of all objects, including code_target |
413 // implicit pointers. | 439 // implicit pointers. |
414 HeapIterator iterator; | 440 HeapIterator iterator; |
415 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 441 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
416 obj->Iterate(&visitor); | 442 obj->Iterate(&visitor); |
417 } | 443 } |
418 | 444 |
419 visitor.Replace(substitution); | 445 visitor.Replace(substitution); |
420 } | 446 } |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 | 728 |
703 bool LiveEditFunctionTracker::IsActive() { | 729 bool LiveEditFunctionTracker::IsActive() { |
704 return false; | 730 return false; |
705 } | 731 } |
706 | 732 |
707 #endif // ENABLE_DEBUGGER_SUPPORT | 733 #endif // ENABLE_DEBUGGER_SUPPORT |
708 | 734 |
709 | 735 |
710 | 736 |
711 } } // namespace v8::internal | 737 } } // namespace v8::internal |
OLD | NEW |