| 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 ensure that we are not in the middle of an | |
| 972 // incremental marking phase when we are replacing the code object. | |
| 973 // Since we are not in an incremental marking phase we can write pointers | |
| 974 // to code objects (that are never in new space) without worrying about | |
| 975 // write barriers. | |
| 976 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, | |
| 977 "liveedit.cc ReplaceCodeObject"); | |
| 978 | |
| 979 AssertNoAllocation no_allocations_please; | 971 AssertNoAllocation no_allocations_please; |
| 980 | 972 |
| 981 ReplacingVisitor visitor(original, substitution); | 973 ReplacingVisitor visitor(original, substitution); |
| 982 | 974 |
| 983 // Iterate over all roots. Stack frames may have pointer into original code, | 975 // Iterate over all roots. Stack frames may have pointer into original code, |
| 984 // so temporary replace the pointers with offset numbers | 976 // so temporary replace the pointers with offset numbers |
| 985 // in prologue/epilogue. | 977 // in prologue/epilogue. |
| 986 HEAP->IterateRoots(&visitor, VISIT_ALL); | 978 HEAP->IterateRoots(&visitor, VISIT_ALL); |
| 987 | 979 |
| 988 // Now iterate over all pointers of all objects, including code_target | 980 // Now iterate over all pointers of all objects, including code_target |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 | 1879 |
| 1888 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 1880 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
| 1889 return false; | 1881 return false; |
| 1890 } | 1882 } |
| 1891 | 1883 |
| 1892 #endif // ENABLE_DEBUGGER_SUPPORT | 1884 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1893 | 1885 |
| 1894 | 1886 |
| 1895 | 1887 |
| 1896 } } // namespace v8::internal | 1888 } } // namespace v8::internal |
| OLD | NEW |