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

Side by Side Diff: src/ast/scopes.cc

Issue 2226803003: Replace SloppyBlockFunctionMap::Vector with linked list through SloppyBlockFunctionStatement (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months 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/ast/scopes.h ('k') | src/parsing/parser.cc » ('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/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 SloppyBlockFunctionMap::SloppyBlockFunctionMap(Zone* zone) 60 SloppyBlockFunctionMap::SloppyBlockFunctionMap(Zone* zone)
61 : ZoneHashMap(ZoneHashMap::PointersMatch, 8, ZoneAllocationPolicy(zone)) {} 61 : ZoneHashMap(ZoneHashMap::PointersMatch, 8, ZoneAllocationPolicy(zone)) {}
62 62
63 void SloppyBlockFunctionMap::Declare(Zone* zone, const AstRawString* name, 63 void SloppyBlockFunctionMap::Declare(Zone* zone, const AstRawString* name,
64 SloppyBlockFunctionStatement* stmt) { 64 SloppyBlockFunctionStatement* stmt) {
65 // AstRawStrings are unambiguous, i.e., the same string is always represented 65 // AstRawStrings are unambiguous, i.e., the same string is always represented
66 // by the same AstRawString*. 66 // by the same AstRawString*.
67 Entry* p = 67 Entry* p =
68 ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name), name->hash(), 68 ZoneHashMap::LookupOrInsert(const_cast<AstRawString*>(name), name->hash(),
69 ZoneAllocationPolicy(zone)); 69 ZoneAllocationPolicy(zone));
70 if (p->value == nullptr) { 70 stmt->set_next(static_cast<SloppyBlockFunctionStatement*>(p->value));
71 p->value = new (zone->New(sizeof(Vector))) Vector(zone); 71 p->value = stmt;
72 }
73 Vector* delegates = static_cast<Vector*>(p->value);
74 delegates->push_back(stmt);
75 } 72 }
76 73
77 74
78 // ---------------------------------------------------------------------------- 75 // ----------------------------------------------------------------------------
79 // Implementation of Scope 76 // Implementation of Scope
80 77
81 Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type) 78 Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type)
82 : zone_(zone), 79 : zone_(zone),
83 outer_scope_(outer_scope), 80 outer_scope_(outer_scope),
84 variables_(zone), 81 variables_(zone),
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1782 function != NULL && function->proxy()->var()->IsContextSlot(); 1779 function != NULL && function->proxy()->var()->IsContextSlot();
1783 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1780 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1784 (is_function_var_in_context ? 1 : 0); 1781 (is_function_var_in_context ? 1 : 0);
1785 } 1782 }
1786 1783
1787 1784
1788 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1785 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1789 1786
1790 } // namespace internal 1787 } // namespace internal
1791 } // namespace v8 1788 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/scopes.h ('k') | src/parsing/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698