Chromium Code Reviews| 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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 961 private: | 961 private: |
| 962 Code* original_; | 962 Code* original_; |
| 963 Code* substitution_; | 963 Code* substitution_; |
| 964 }; | 964 }; |
| 965 | 965 |
| 966 | 966 |
| 967 // Finds all references to original and replaces them with substitution. | 967 // Finds all references to original and replaces them with substitution. |
| 968 static void ReplaceCodeObject(Code* original, Code* substitution) { | 968 static void ReplaceCodeObject(Code* original, Code* substitution) { |
| 969 ASSERT(!HEAP->InNewSpace(substitution)); | 969 ASSERT(!HEAP->InNewSpace(substitution)); |
| 970 | 970 |
| 971 // Perform a full GC in order to avoid dead objects and to | |
| 972 // notify the GC with a write barrier so that the it can keep track of where | |
| 973 // there are pointers in case some of the objects move in a compacting GC. | |
|
Erik Corry
2012/06/25 11:43:51
I think this comment should read:
// Perform a fu
Peter Rybin
2012/06/25 21:43:42
Thank you!
| |
| 974 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, | |
| 975 "liveedit.cc ReplaceCodeObject"); | |
| 976 | |
| 971 AssertNoAllocation no_allocations_please; | 977 AssertNoAllocation no_allocations_please; |
| 972 | 978 |
| 973 ReplacingVisitor visitor(original, substitution); | 979 ReplacingVisitor visitor(original, substitution); |
| 974 | 980 |
| 975 // Iterate over all roots. Stack frames may have pointer into original code, | 981 // Iterate over all roots. Stack frames may have pointer into original code, |
| 976 // so temporary replace the pointers with offset numbers | 982 // so temporary replace the pointers with offset numbers |
| 977 // in prologue/epilogue. | 983 // in prologue/epilogue. |
| 978 HEAP->IterateRoots(&visitor, VISIT_ALL); | 984 HEAP->IterateRoots(&visitor, VISIT_ALL); |
| 979 | 985 |
| 980 // Now iterate over all pointers of all objects, including code_target | 986 // Now iterate over all pointers of all objects, including code_target |
| (...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1868 | 1874 |
| 1869 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 1875 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 1870 return false; | 1876 return false; |
| 1871 } | 1877 } |
| 1872 | 1878 |
| 1873 #endif // ENABLE_DEBUGGER_SUPPORT | 1879 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1874 | 1880 |
| 1875 | 1881 |
| 1876 | 1882 |
| 1877 } } // namespace v8::internal | 1883 } } // namespace v8::internal |
| OLD | NEW |