| 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 #include "src/debug/liveedit.h" | 5 #include "src/debug/liveedit.h" |
| 6 | 6 |
| 7 #include "src/ast/scopeinfo.h" | 7 #include "src/ast/scopeinfo.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-cache.h" | 10 #include "src/compilation-cache.h" |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 | 1064 |
| 1065 DeoptimizeDependentFunctions(*shared_info); | 1065 DeoptimizeDependentFunctions(*shared_info); |
| 1066 shared_info_array->GetIsolate()->compilation_cache()->Remove(shared_info); | 1066 shared_info_array->GetIsolate()->compilation_cache()->Remove(shared_info); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 | 1069 |
| 1070 void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper, | 1070 void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper, |
| 1071 Handle<Object> script_handle) { | 1071 Handle<Object> script_handle) { |
| 1072 Handle<SharedFunctionInfo> shared_info = | 1072 Handle<SharedFunctionInfo> shared_info = |
| 1073 UnwrapSharedFunctionInfoFromJSValue(function_wrapper); | 1073 UnwrapSharedFunctionInfoFromJSValue(function_wrapper); |
| 1074 CHECK(script_handle->IsScript() || script_handle->IsUndefined()); | 1074 Isolate* isolate = function_wrapper->GetIsolate(); |
| 1075 CHECK(script_handle->IsScript() || script_handle->IsUndefined(isolate)); |
| 1075 SharedFunctionInfo::SetScript(shared_info, script_handle); | 1076 SharedFunctionInfo::SetScript(shared_info, script_handle); |
| 1076 shared_info->DisableOptimization(kLiveEdit); | 1077 shared_info->DisableOptimization(kLiveEdit); |
| 1077 | 1078 |
| 1078 function_wrapper->GetIsolate()->compilation_cache()->Remove(shared_info); | 1079 function_wrapper->GetIsolate()->compilation_cache()->Remove(shared_info); |
| 1079 } | 1080 } |
| 1080 | 1081 |
| 1081 | 1082 |
| 1082 // For a script text change (defined as position_change_array), translates | 1083 // For a script text change (defined as position_change_array), translates |
| 1083 // position in unchanged text to position in changed text. | 1084 // position in unchanged text to position in changed text. |
| 1084 // Text change is a set of non-overlapping regions in text, that have changed | 1085 // Text change is a set of non-overlapping regions in text, that have changed |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1602 JSReceiver::GetElement(isolate, old_shared_array_, i) | 1603 JSReceiver::GetElement(isolate, old_shared_array_, i) |
| 1603 .ToHandleChecked(); | 1604 .ToHandleChecked(); |
| 1604 if (!old_shared.is_identical_to(UnwrapSharedFunctionInfoFromJSValue( | 1605 if (!old_shared.is_identical_to(UnwrapSharedFunctionInfoFromJSValue( |
| 1605 Handle<JSValue>::cast(old_element)))) { | 1606 Handle<JSValue>::cast(old_element)))) { |
| 1606 continue; | 1607 continue; |
| 1607 } | 1608 } |
| 1608 | 1609 |
| 1609 Handle<Object> new_element = | 1610 Handle<Object> new_element = |
| 1610 JSReceiver::GetElement(isolate, new_shared_array_, i) | 1611 JSReceiver::GetElement(isolate, new_shared_array_, i) |
| 1611 .ToHandleChecked(); | 1612 .ToHandleChecked(); |
| 1612 if (new_element->IsUndefined()) return false; | 1613 if (new_element->IsUndefined(isolate)) return false; |
| 1613 Handle<SharedFunctionInfo> new_shared = | 1614 Handle<SharedFunctionInfo> new_shared = |
| 1614 UnwrapSharedFunctionInfoFromJSValue( | 1615 UnwrapSharedFunctionInfoFromJSValue( |
| 1615 Handle<JSValue>::cast(new_element)); | 1616 Handle<JSValue>::cast(new_element)); |
| 1616 if (new_shared->scope_info()->HasNewTarget()) { | 1617 if (new_shared->scope_info()->HasNewTarget()) { |
| 1617 SetElementSloppy( | 1618 SetElementSloppy( |
| 1618 result_, i, | 1619 result_, i, |
| 1619 Handle<Smi>( | 1620 Handle<Smi>( |
| 1620 Smi::FromInt( | 1621 Smi::FromInt( |
| 1621 LiveEdit::FUNCTION_BLOCKED_NO_NEW_TARGET_ON_RESTART), | 1622 LiveEdit::FUNCTION_BLOCKED_NO_NEW_TARGET_ON_RESTART), |
| 1622 isolate)); | 1623 isolate)); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 scope_info_length++; | 2044 scope_info_length++; |
| 2044 | 2045 |
| 2045 current_scope = current_scope->outer_scope(); | 2046 current_scope = current_scope->outer_scope(); |
| 2046 } | 2047 } |
| 2047 | 2048 |
| 2048 return scope_info_list; | 2049 return scope_info_list; |
| 2049 } | 2050 } |
| 2050 | 2051 |
| 2051 } // namespace internal | 2052 } // namespace internal |
| 2052 } // namespace v8 | 2053 } // namespace v8 |
| OLD | NEW |