Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: src/debug/liveedit.cc

Issue 2475433002: Turn Scope::locals_ into a ThreadedList (Closed)
Patch Set: Addressed comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/crankshaft/typing.cc ('k') | src/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
1893 Handle<Object> LiveEditFunctionTracker::SerializeFunctionScope(Scope* scope) { 1893 Handle<Object> LiveEditFunctionTracker::SerializeFunctionScope(Scope* scope) {
1894 Handle<JSArray> scope_info_list = isolate_->factory()->NewJSArray(10); 1894 Handle<JSArray> scope_info_list = isolate_->factory()->NewJSArray(10);
1895 int scope_info_length = 0; 1895 int scope_info_length = 0;
1896 1896
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*>* locals = current_scope->locals(); 1903 for (Variable* var : *current_scope->locals()) {
1904 for (int i = 0; i < locals->length(); i++) {
1905 Variable* var = locals->at(i);
1906 if (!var->IsContextSlot()) continue; 1904 if (!var->IsContextSlot()) continue;
1907 int context_index = var->index() - Context::MIN_CONTEXT_SLOTS; 1905 int context_index = var->index() - Context::MIN_CONTEXT_SLOTS;
1908 int location = scope_info_length + context_index * 2; 1906 int location = scope_info_length + context_index * 2;
1909 SetElementSloppy(scope_info_list, location, var->name()); 1907 SetElementSloppy(scope_info_list, location, var->name());
1910 SetElementSloppy(scope_info_list, location + 1, 1908 SetElementSloppy(scope_info_list, location + 1,
1911 handle(Smi::FromInt(var->index()), isolate_)); 1909 handle(Smi::FromInt(var->index()), isolate_));
1912 } 1910 }
1913 scope_info_length += current_scope->ContextLocalCount() * 2; 1911 scope_info_length += current_scope->ContextLocalCount() * 2;
1914 SetElementSloppy(scope_info_list, scope_info_length, 1912 SetElementSloppy(scope_info_list, scope_info_length,
1915 isolate_->factory()->null_value()); 1913 isolate_->factory()->null_value());
1916 scope_info_length++; 1914 scope_info_length++;
1917 1915
1918 current_scope = current_scope->outer_scope(); 1916 current_scope = current_scope->outer_scope();
1919 } 1917 }
1920 1918
1921 return scope_info_list; 1919 return scope_info_list;
1922 } 1920 }
1923 1921
1924 } // namespace internal 1922 } // namespace internal
1925 } // namespace v8 1923 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/typing.cc ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698