OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 #include "v8.h" | 6 #include "v8.h" |
7 | 7 |
8 #include "liveedit.h" | 8 #include "liveedit.h" |
9 | 9 |
10 #include "code-stubs.h" | 10 #include "code-stubs.h" |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 void LiveEdit::ReplaceFunctionCode( | 1158 void LiveEdit::ReplaceFunctionCode( |
1159 Handle<JSArray> new_compile_info_array, | 1159 Handle<JSArray> new_compile_info_array, |
1160 Handle<JSArray> shared_info_array) { | 1160 Handle<JSArray> shared_info_array) { |
1161 Isolate* isolate = new_compile_info_array->GetIsolate(); | 1161 Isolate* isolate = new_compile_info_array->GetIsolate(); |
1162 | 1162 |
1163 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); | 1163 FunctionInfoWrapper compile_info_wrapper(new_compile_info_array); |
1164 SharedInfoWrapper shared_info_wrapper(shared_info_array); | 1164 SharedInfoWrapper shared_info_wrapper(shared_info_array); |
1165 | 1165 |
1166 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); | 1166 Handle<SharedFunctionInfo> shared_info = shared_info_wrapper.GetInfo(); |
1167 | 1167 |
1168 isolate->heap()->EnsureHeapIsIterable(); | 1168 isolate->heap()->MakeHeapIterable(); |
1169 | 1169 |
1170 if (IsJSFunctionCode(shared_info->code())) { | 1170 if (IsJSFunctionCode(shared_info->code())) { |
1171 Handle<Code> code = compile_info_wrapper.GetFunctionCode(); | 1171 Handle<Code> code = compile_info_wrapper.GetFunctionCode(); |
1172 ReplaceCodeObject(Handle<Code>(shared_info->code()), code); | 1172 ReplaceCodeObject(Handle<Code>(shared_info->code()), code); |
1173 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); | 1173 Handle<Object> code_scope_info = compile_info_wrapper.GetCodeScopeInfo(); |
1174 if (code_scope_info->IsFixedArray()) { | 1174 if (code_scope_info->IsFixedArray()) { |
1175 shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info)); | 1175 shared_info->set_scope_info(ScopeInfo::cast(*code_scope_info)); |
1176 } | 1176 } |
1177 shared_info->DisableOptimization(kLiveEdit); | 1177 shared_info->DisableOptimization(kLiveEdit); |
1178 // Update the type feedback vector | 1178 // Update the type feedback vector |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 position_change_array); | 1395 position_change_array); |
1396 int new_function_end = TranslatePosition(info->end_position(), | 1396 int new_function_end = TranslatePosition(info->end_position(), |
1397 position_change_array); | 1397 position_change_array); |
1398 int new_function_token_pos = | 1398 int new_function_token_pos = |
1399 TranslatePosition(info->function_token_position(), position_change_array); | 1399 TranslatePosition(info->function_token_position(), position_change_array); |
1400 | 1400 |
1401 info->set_start_position(new_function_start); | 1401 info->set_start_position(new_function_start); |
1402 info->set_end_position(new_function_end); | 1402 info->set_end_position(new_function_end); |
1403 info->set_function_token_position(new_function_token_pos); | 1403 info->set_function_token_position(new_function_token_pos); |
1404 | 1404 |
1405 info->GetIsolate()->heap()->EnsureHeapIsIterable(); | 1405 info->GetIsolate()->heap()->MakeHeapIterable(); |
1406 | 1406 |
1407 if (IsJSFunctionCode(info->code())) { | 1407 if (IsJSFunctionCode(info->code())) { |
1408 // Patch relocation info section of the code. | 1408 // Patch relocation info section of the code. |
1409 Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()), | 1409 Handle<Code> patched_code = PatchPositionsInCode(Handle<Code>(info->code()), |
1410 position_change_array); | 1410 position_change_array); |
1411 if (*patched_code != info->code()) { | 1411 if (*patched_code != info->code()) { |
1412 // Replace all references to the code across the heap. In particular, | 1412 // Replace all references to the code across the heap. In particular, |
1413 // some stubs may refer to this code and this code may be being executed | 1413 // some stubs may refer to this code and this code may be being executed |
1414 // on stack (it is safe to substitute the code object on stack, because | 1414 // on stack (it is safe to substitute the code object on stack, because |
1415 // we only change the structure of rinfo and leave instructions | 1415 // we only change the structure of rinfo and leave instructions |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1970 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { | 1970 void LiveEditFunctionTracker::RecordRootFunctionInfo(Handle<Code> code) { |
1971 isolate_->active_function_info_listener()->FunctionCode(code); | 1971 isolate_->active_function_info_listener()->FunctionCode(code); |
1972 } | 1972 } |
1973 | 1973 |
1974 | 1974 |
1975 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 1975 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { |
1976 return isolate->active_function_info_listener() != NULL; | 1976 return isolate->active_function_info_listener() != NULL; |
1977 } | 1977 } |
1978 | 1978 |
1979 } } // namespace v8::internal | 1979 } } // namespace v8::internal |
OLD | NEW |