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 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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->CollectStackAndContextLocals(&stack_list, &context_list, |
1908 &globals_list); | 1908 &globals_list); |
1909 context_list.Sort(&Variable::CompareIndex); | |
1910 | |
1911 for (int i = 0; i < context_list.length(); i++) { | 1909 for (int i = 0; i < context_list.length(); i++) { |
1912 SetElementSloppy(scope_info_list, scope_info_length, | 1910 int context_index = context_list[i]->index() - Context::MIN_CONTEXT_SLOTS; |
1913 context_list[i]->name()); | 1911 int location = scope_info_length + context_index * 2; |
1914 scope_info_length++; | 1912 SetElementSloppy(scope_info_list, location, context_list[i]->name()); |
1915 SetElementSloppy( | 1913 SetElementSloppy( |
1916 scope_info_list, scope_info_length, | 1914 scope_info_list, location + 1, |
1917 Handle<Smi>(Smi::FromInt(context_list[i]->index()), isolate_)); | 1915 handle(Smi::FromInt(context_list[i]->index()), isolate_)); |
1918 scope_info_length++; | |
1919 } | 1916 } |
| 1917 scope_info_length += context_list.length() * 2; |
1920 SetElementSloppy(scope_info_list, scope_info_length, | 1918 SetElementSloppy(scope_info_list, scope_info_length, |
1921 Handle<Object>(isolate_->heap()->null_value(), isolate_)); | 1919 Handle<Object>(isolate_->heap()->null_value(), isolate_)); |
1922 scope_info_length++; | 1920 scope_info_length++; |
1923 | 1921 |
1924 current_scope = current_scope->outer_scope(); | 1922 current_scope = current_scope->outer_scope(); |
1925 } | 1923 } |
1926 | 1924 |
1927 return scope_info_list; | 1925 return scope_info_list; |
1928 } | 1926 } |
1929 | 1927 |
1930 } // namespace internal | 1928 } // namespace internal |
1931 } // namespace v8 | 1929 } // namespace v8 |
OLD | NEW |