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/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compilation-cache.h" | 9 #include "src/compilation-cache.h" |
10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
(...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1897 // Saves some description of scope. It stores name and indexes of | 1897 // Saves some description of scope. It stores name and indexes of |
1898 // variables in the whole scope chain. Null-named slots delimit | 1898 // variables in the whole scope chain. Null-named slots delimit |
1899 // scopes of this chain. | 1899 // scopes of this chain. |
1900 Scope* current_scope = scope; | 1900 Scope* current_scope = scope; |
1901 while (current_scope != NULL) { | 1901 while (current_scope != NULL) { |
1902 HandleScope handle_scope(isolate_); | 1902 HandleScope handle_scope(isolate_); |
1903 ZoneList<Variable*> stack_list(current_scope->StackLocalCount(), zone_); | 1903 ZoneList<Variable*> stack_list(current_scope->StackLocalCount(), zone_); |
1904 ZoneList<Variable*> context_list(current_scope->ContextLocalCount(), zone_); | 1904 ZoneList<Variable*> context_list(current_scope->ContextLocalCount(), zone_); |
1905 ZoneList<Variable*> globals_list(current_scope->ContextGlobalCount(), | 1905 ZoneList<Variable*> globals_list(current_scope->ContextGlobalCount(), |
1906 zone_); | 1906 zone_); |
1907 current_scope->CollectStackAndContextLocals(&stack_list, &context_list, | 1907 current_scope->CollectVariables(&stack_list, &context_list, &globals_list); |
1908 &globals_list); | |
1909 for (int i = 0; i < context_list.length(); i++) { | 1908 for (int i = 0; i < context_list.length(); i++) { |
1910 int context_index = context_list[i]->index() - Context::MIN_CONTEXT_SLOTS; | 1909 int context_index = context_list[i]->index() - Context::MIN_CONTEXT_SLOTS; |
1911 int location = scope_info_length + context_index * 2; | 1910 int location = scope_info_length + context_index * 2; |
1912 SetElementSloppy(scope_info_list, location, context_list[i]->name()); | 1911 SetElementSloppy(scope_info_list, location, context_list[i]->name()); |
1913 SetElementSloppy( | 1912 SetElementSloppy( |
1914 scope_info_list, location + 1, | 1913 scope_info_list, location + 1, |
1915 handle(Smi::FromInt(context_list[i]->index()), isolate_)); | 1914 handle(Smi::FromInt(context_list[i]->index()), isolate_)); |
1916 } | 1915 } |
1917 scope_info_length += context_list.length() * 2; | 1916 scope_info_length += context_list.length() * 2; |
1918 SetElementSloppy(scope_info_list, scope_info_length, | 1917 SetElementSloppy(scope_info_list, scope_info_length, |
1919 Handle<Object>(isolate_->heap()->null_value(), isolate_)); | 1918 Handle<Object>(isolate_->heap()->null_value(), isolate_)); |
1920 scope_info_length++; | 1919 scope_info_length++; |
1921 | 1920 |
1922 current_scope = current_scope->outer_scope(); | 1921 current_scope = current_scope->outer_scope(); |
1923 } | 1922 } |
1924 | 1923 |
1925 return scope_info_list; | 1924 return scope_info_list; |
1926 } | 1925 } |
1927 | 1926 |
1928 } // namespace internal | 1927 } // namespace internal |
1929 } // namespace v8 | 1928 } // namespace v8 |
OLD | NEW |