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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 // Iterate over all roots. Stack frames may have pointer into original code, | 896 // Iterate over all roots. Stack frames may have pointer into original code, |
897 // so temporary replace the pointers with offset numbers | 897 // so temporary replace the pointers with offset numbers |
898 // in prologue/epilogue. | 898 // in prologue/epilogue. |
899 { | 899 { |
900 Heap::IterateStrongRoots(&visitor, VISIT_ALL); | 900 Heap::IterateStrongRoots(&visitor, VISIT_ALL); |
901 } | 901 } |
902 | 902 |
903 // Now iterate over all pointers of all objects, including code_target | 903 // Now iterate over all pointers of all objects, including code_target |
904 // implicit pointers. | 904 // implicit pointers. |
905 HeapIterator iterator; | 905 HeapIterator iterator; |
906 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 906 for (HeapObject* obj = iterator.Next(); obj != NULL; obj = iterator.Next()) { |
907 obj->Iterate(&visitor); | 907 obj->Iterate(&visitor); |
908 } | 908 } |
909 | 909 |
910 visitor.Replace(substitution); | 910 visitor.Replace(substitution); |
911 } | 911 } |
912 | 912 |
913 | 913 |
914 // Check whether the code is natural function code (not a lazy-compile stub | 914 // Check whether the code is natural function code (not a lazy-compile stub |
915 // code). | 915 // code). |
916 static bool IsJSFunctionCode(Code* code) { | 916 static bool IsJSFunctionCode(Code* code) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 | 980 |
981 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { | 981 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { |
982 return Top::ThrowIllegalOperation(); | 982 return Top::ThrowIllegalOperation(); |
983 } | 983 } |
984 | 984 |
985 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); | 985 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); |
986 SharedInfoWrapper shared_info_wrapper(shared_info_array); | 986 SharedInfoWrapper shared_info_wrapper(shared_info_array); |
987 | 987 |
988 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); | 988 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); |
989 | 989 |
| 990 Heap::EnsureHeapIsIterable(); |
| 991 |
990 if (IsJSFunctionCode(shared_info->code())) { | 992 if (IsJSFunctionCode(shared_info->code())) { |
991 ReplaceCodeObject(shared_info->code(), | 993 ReplaceCodeObject(shared_info->code(), |
992 *(compile_info_wrapper.GetFunctionCode())); | 994 *(compile_info_wrapper.GetFunctionCode())); |
993 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); | 995 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); |
994 if (code_scope_info->IsFixedArray()) { | 996 if (code_scope_info->IsFixedArray()) { |
995 shared_info->set_scope_info(SerializedScopeInfo::cast(*code_scope_info)); | 997 shared_info->set_scope_info(SerializedScopeInfo::cast(*code_scope_info)); |
996 } | 998 } |
997 } | 999 } |
998 | 1000 |
999 if (shared_info->debug_info()->IsDebugInfo()) { | 1001 if (shared_info->debug_info()->IsDebugInfo()) { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 int new_function_start = TranslatePosition(old_function_start, | 1210 int new_function_start = TranslatePosition(old_function_start, |
1209 position_change_array); | 1211 position_change_array); |
1210 info->set_start_position(new_function_start); | 1212 info->set_start_position(new_function_start); |
1211 info->set_end_position(TranslatePosition(info->end_position(), | 1213 info->set_end_position(TranslatePosition(info->end_position(), |
1212 position_change_array)); | 1214 position_change_array)); |
1213 | 1215 |
1214 info->set_function_token_position( | 1216 info->set_function_token_position( |
1215 TranslatePosition(info->function_token_position(), | 1217 TranslatePosition(info->function_token_position(), |
1216 position_change_array)); | 1218 position_change_array)); |
1217 | 1219 |
| 1220 Heap::EnsureHeapIsIterable(); |
| 1221 |
1218 if (IsJSFunctionCode(info->code())) { | 1222 if (IsJSFunctionCode(info->code())) { |
1219 // Patch relocation info section of the code. | 1223 // Patch relocation info section of the code. |
1220 Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()), | 1224 Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()), |
1221 position_change_array); | 1225 position_change_array); |
1222 if (*patched_code != info->code()) { | 1226 if (*patched_code != info->code()) { |
1223 // Replace all references to the code across the heap. In particular, | 1227 // Replace all references to the code across the heap. In particular, |
1224 // some stubs may refer to this code and this code may be being executed | 1228 // some stubs may refer to this code and this code may be being executed |
1225 // on stack (it is safe to substitute the code object on stack, because | 1229 // on stack (it is safe to substitute the code object on stack, because |
1226 // we only change the structure of rinfo and leave instructions | 1230 // we only change the structure of rinfo and leave instructions |
1227 // untouched). | 1231 // untouched). |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 | 1647 |
1644 bool LiveEditFunctionTracker::IsActive() { | 1648 bool LiveEditFunctionTracker::IsActive() { |
1645 return false; | 1649 return false; |
1646 } | 1650 } |
1647 | 1651 |
1648 #endif // ENABLE_DEBUGGER_SUPPORT | 1652 #endif // ENABLE_DEBUGGER_SUPPORT |
1649 | 1653 |
1650 | 1654 |
1651 | 1655 |
1652 } } // namespace v8::internal | 1656 } } // namespace v8::internal |
OLD | NEW |