OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/debug-scopes.h" | 5 #include "src/debug/debug-scopes.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/debug/debug.h" | 10 #include "src/debug/debug.h" |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 // This method copies structure of MaterializeClosure method above. | 728 // This method copies structure of MaterializeClosure method above. |
729 bool ScopeIterator::SetClosureVariableValue(Handle<String> variable_name, | 729 bool ScopeIterator::SetClosureVariableValue(Handle<String> variable_name, |
730 Handle<Object> new_value) { | 730 Handle<Object> new_value) { |
731 DCHECK(CurrentContext()->IsFunctionContext()); | 731 DCHECK(CurrentContext()->IsFunctionContext()); |
732 return SetContextVariableValue(CurrentScopeInfo(), CurrentContext(), | 732 return SetContextVariableValue(CurrentScopeInfo(), CurrentContext(), |
733 variable_name, new_value); | 733 variable_name, new_value); |
734 } | 734 } |
735 | 735 |
736 bool ScopeIterator::SetScriptVariableValue(Handle<String> variable_name, | 736 bool ScopeIterator::SetScriptVariableValue(Handle<String> variable_name, |
737 Handle<Object> new_value) { | 737 Handle<Object> new_value) { |
| 738 Handle<String> internalized_variable_name = |
| 739 isolate_->factory()->InternalizeString(variable_name); |
738 Handle<Context> context = CurrentContext(); | 740 Handle<Context> context = CurrentContext(); |
739 Handle<ScriptContextTable> script_contexts( | 741 Handle<ScriptContextTable> script_contexts( |
740 context->global_object()->native_context()->script_context_table()); | 742 context->global_object()->native_context()->script_context_table()); |
741 ScriptContextTable::LookupResult lookup_result; | 743 ScriptContextTable::LookupResult lookup_result; |
742 if (ScriptContextTable::Lookup(script_contexts, variable_name, | 744 if (ScriptContextTable::Lookup(script_contexts, internalized_variable_name, |
743 &lookup_result)) { | 745 &lookup_result)) { |
744 Handle<Context> script_context = ScriptContextTable::GetContext( | 746 Handle<Context> script_context = ScriptContextTable::GetContext( |
745 script_contexts, lookup_result.context_index); | 747 script_contexts, lookup_result.context_index); |
746 script_context->set(lookup_result.slot_index, *new_value); | 748 script_context->set(lookup_result.slot_index, *new_value); |
747 return true; | 749 return true; |
748 } | 750 } |
749 | 751 |
750 return false; | 752 return false; |
751 } | 753 } |
752 | 754 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); | 858 DCHECK((beg_pos >= 0 && end_pos >= 0) || inner_scope->is_hidden()); |
857 if (beg_pos <= position && position < end_pos) { | 859 if (beg_pos <= position && position < end_pos) { |
858 GetNestedScopeChain(isolate, inner_scope, position); | 860 GetNestedScopeChain(isolate, inner_scope, position); |
859 return; | 861 return; |
860 } | 862 } |
861 } | 863 } |
862 } | 864 } |
863 | 865 |
864 } // namespace internal | 866 } // namespace internal |
865 } // namespace v8 | 867 } // namespace v8 |
OLD | NEW |