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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1006 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { | 1006 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { |
1007 return Isolate::Current()->ThrowIllegalOperation(); | 1007 return Isolate::Current()->ThrowIllegalOperation(); |
1008 } | 1008 } |
1009 | 1009 |
1010 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); | 1010 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); |
1011 SharedInfoWrapper shared_info_wrapper(shared_info_array); | 1011 SharedInfoWrapper shared_info_wrapper(shared_info_array); |
1012 | 1012 |
1013 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); | 1013 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); |
1014 | 1014 |
1015 if (IsJSFunctionCode(shared_info->code())) { | 1015 if (IsJSFunctionCode(shared_info->code())) { |
1016 ReplaceCodeObject(shared_info->code(), | 1016 Handle<Code> code = compile_info_wrapper.GetFunctionCode(); |
1017 *(compile_info_wrapper.GetFunctionCode())); | 1017 ReplaceCodeObject(shared_info->code(), *code); |
1018 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); | 1018 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); |
1019 if (code_scope_info->IsFixedArray()) { | 1019 if (code_scope_info->IsFixedArray()) { |
1020 shared_info->set_scope_info(SerializedScopeInfo::cast(*code_scope_info)); | 1020 shared_info->set_scope_info(SerializedScopeInfo::cast(*code_scope_info)); |
1021 } | 1021 } |
1022 } | 1022 } |
1023 | 1023 |
1024 if (shared_info->debug_info()->IsDebugInfo()) { | 1024 if (shared_info->debug_info()->IsDebugInfo()) { |
1025 Handle<DebugInfo> debug_info(DebugInfo::cast(shared_info->debug_info())); | 1025 Handle<DebugInfo> debug_info(DebugInfo::cast(shared_info->debug_info())); |
1026 Handle<Code> new_original_code = | 1026 Handle<Code> new_original_code = |
1027 FACTORY->CopyCode(compile_info_wrapper.GetFunctionCode()); | 1027 FACTORY->CopyCode(compile_info_wrapper.GetFunctionCode()); |
1028 debug_info->set_original_code(*new_original_code); | 1028 debug_info->set_original_code(*new_original_code); |
1029 } | 1029 } |
1030 | 1030 |
1031 shared_info->set_start_position(compile_info_wrapper.GetStartPosition()); | 1031 int start_position = compile_info_wrapper.GetStartPosition(); |
1032 shared_info->set_end_position(compile_info_wrapper.GetEndPosition()); | 1032 int end_position = compile_info_wrapper.GetEndPosition(); |
| 1033 shared_info->set_start_position(start_position); |
| 1034 shared_info->set_end_position(end_position); |
1033 | 1035 |
1034 shared_info->set_construct_stub( | 1036 shared_info->set_construct_stub( |
1035 Isolate::Current()->builtins()->builtin( | 1037 Isolate::Current()->builtins()->builtin( |
1036 Builtins::kJSConstructStubGeneric)); | 1038 Builtins::kJSConstructStubGeneric)); |
1037 | 1039 |
1038 DeoptimizeDependentFunctions(*shared_info); | 1040 DeoptimizeDependentFunctions(*shared_info); |
1039 Isolate::Current()->compilation_cache()->Remove(shared_info); | 1041 Isolate::Current()->compilation_cache()->Remove(shared_info); |
1040 | 1042 |
1041 return HEAP->undefined_value(); | 1043 return HEAP->undefined_value(); |
1042 } | 1044 } |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1226 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { | 1228 if (!SharedInfoWrapper::IsInstance(shared_info_array)) { |
1227 return Isolate::Current()->ThrowIllegalOperation(); | 1229 return Isolate::Current()->ThrowIllegalOperation(); |
1228 } | 1230 } |
1229 | 1231 |
1230 SharedInfoWrapper shared_info_wrapper(shared_info_array); | 1232 SharedInfoWrapper shared_info_wrapper(shared_info_array); |
1231 Handle<SharedFunctionInfo> info = shared_info_wrapper.GetInfo(); | 1233 Handle<SharedFunctionInfo> info = shared_info_wrapper.GetInfo(); |
1232 | 1234 |
1233 int old_function_start = info->start_position(); | 1235 int old_function_start = info->start_position(); |
1234 int new_function_start = TranslatePosition(old_function_start, | 1236 int new_function_start = TranslatePosition(old_function_start, |
1235 position_change_array); | 1237 position_change_array); |
| 1238 int new_function_end = TranslatePosition(info->end_position(), |
| 1239 position_change_array); |
| 1240 int new_function_token_pos = |
| 1241 TranslatePosition(info->function_token_position(), position_change_array); |
| 1242 |
1236 info->set_start_position(new_function_start); | 1243 info->set_start_position(new_function_start); |
1237 info->set_end_position(TranslatePosition(info->end_position(), | 1244 info->set_end_position(new_function_end); |
1238 position_change_array)); | 1245 info->set_function_token_position(new_function_token_pos); |
1239 | |
1240 info->set_function_token_position( | |
1241 TranslatePosition(info->function_token_position(), | |
1242 position_change_array)); | |
1243 | 1246 |
1244 if (IsJSFunctionCode(info->code())) { | 1247 if (IsJSFunctionCode(info->code())) { |
1245 // Patch relocation info section of the code. | 1248 // Patch relocation info section of the code. |
1246 Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()), | 1249 Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()), |
1247 position_change_array); | 1250 position_change_array); |
1248 if (*patched_code != info->code()) { | 1251 if (*patched_code != info->code()) { |
1249 // Replace all references to the code across the heap. In particular, | 1252 // Replace all references to the code across the heap. In particular, |
1250 // some stubs may refer to this code and this code may be being executed | 1253 // some stubs may refer to this code and this code may be being executed |
1251 // on stack (it is safe to substitute the code object on stack, because | 1254 // on stack (it is safe to substitute the code object on stack, because |
1252 // we only change the structure of rinfo and leave instructions | 1255 // we only change the structure of rinfo and leave instructions |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 | 1683 |
1681 bool LiveEditFunctionTracker::IsActive() { | 1684 bool LiveEditFunctionTracker::IsActive() { |
1682 return false; | 1685 return false; |
1683 } | 1686 } |
1684 | 1687 |
1685 #endif // ENABLE_DEBUGGER_SUPPORT | 1688 #endif // ENABLE_DEBUGGER_SUPPORT |
1686 | 1689 |
1687 | 1690 |
1688 | 1691 |
1689 } } // namespace v8::internal | 1692 } } // namespace v8::internal |
OLD | NEW |