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

Side by Side Diff: src/ast.h

Issue 1279763006: Fasterify ICSlotCache (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: lil' moar whitespace Created 5 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 | « no previous file | src/ast.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 #ifndef V8_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 int slots() const { return slots_; } 146 int slots() const { return slots_; }
147 int ic_slots() const { return ic_slots_; } 147 int ic_slots() const { return ic_slots_; }
148 148
149 private: 149 private:
150 int slots_; 150 int slots_;
151 int ic_slots_; 151 int ic_slots_;
152 }; 152 };
153 153
154 154
155 class VariableICSlotPair final { 155 class ICSlotCache {
156 public: 156 public:
157 VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot) 157 explicit ICSlotCache(Zone* zone)
158 : variable_(variable), slot_(slot) {} 158 : zone_(zone),
159 VariableICSlotPair() 159 hash_map_(HashMap::PointersMatch, ZoneHashMap::kDefaultHashMapCapacity,
160 : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {} 160 ZoneAllocationPolicy(zone)) {}
161 161
162 Variable* variable() const { return variable_; } 162 void Put(Variable* variable, FeedbackVectorICSlot slot) {
163 FeedbackVectorICSlot slot() const { return slot_; } 163 ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert(
164 variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_));
165 entry->value = reinterpret_cast<void*>(slot.ToInt());
166 }
167
168 ZoneHashMap::Entry* Get(Variable* variable) const {
169 return hash_map_.Lookup(variable, ComputePointerHash(variable));
170 }
164 171
165 private: 172 private:
166 Variable* variable_; 173 Zone* zone_;
167 FeedbackVectorICSlot slot_; 174 ZoneHashMap hash_map_;
168 }; 175 };
169 176
170 177
171 typedef List<VariableICSlotPair> ICSlotCache;
172
173
174 class AstProperties final BASE_EMBEDDED { 178 class AstProperties final BASE_EMBEDDED {
175 public: 179 public:
176 enum Flag { 180 enum Flag {
177 kNoFlags = 0, 181 kNoFlags = 0,
178 kDontSelfOptimize = 1 << 0, 182 kDontSelfOptimize = 1 << 0,
179 kDontCrankshaft = 1 << 1 183 kDontCrankshaft = 1 << 1
180 }; 184 };
181 185
182 typedef base::Flags<Flag> Flags; 186 typedef base::Flags<Flag> Flags;
183 187
(...skipping 3441 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 3629
3626 private: 3630 private:
3627 Zone* zone_; 3631 Zone* zone_;
3628 AstValueFactory* ast_value_factory_; 3632 AstValueFactory* ast_value_factory_;
3629 }; 3633 };
3630 3634
3631 3635
3632 } } // namespace v8::internal 3636 } } // namespace v8::internal
3633 3637
3634 #endif // V8_AST_H_ 3638 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698