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

Unified Diff: src/ast.h

Issue 1282143003: Version 4.5.103.22 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.5
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8-version.h ('k') | src/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index e5842c292e57b139f7073dd3f05c9508aa2db411..115c59ff80e92a50dedcea451f9cfc2c529273b8 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -154,25 +154,29 @@ class FeedbackVectorRequirements {
};
-class VariableICSlotPair final {
+class ICSlotCache {
public:
- VariableICSlotPair(Variable* variable, FeedbackVectorICSlot slot)
- : variable_(variable), slot_(slot) {}
- VariableICSlotPair()
- : variable_(NULL), slot_(FeedbackVectorICSlot::Invalid()) {}
+ explicit ICSlotCache(Zone* zone)
+ : zone_(zone),
+ hash_map_(HashMap::PointersMatch, ZoneHashMap::kDefaultHashMapCapacity,
+ ZoneAllocationPolicy(zone)) {}
- Variable* variable() const { return variable_; }
- FeedbackVectorICSlot slot() const { return slot_; }
+ void Put(Variable* variable, FeedbackVectorICSlot slot) {
+ ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert(
+ variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_));
+ entry->value = reinterpret_cast<void*>(slot.ToInt());
+ }
+
+ ZoneHashMap::Entry* Get(Variable* variable) const {
+ return hash_map_.Lookup(variable, ComputePointerHash(variable));
+ }
private:
- Variable* variable_;
- FeedbackVectorICSlot slot_;
+ Zone* zone_;
+ ZoneHashMap hash_map_;
};
-typedef List<VariableICSlotPair> ICSlotCache;
-
-
class AstProperties final BASE_EMBEDDED {
public:
class Flags : public EnumSet<AstPropertiesFlag, int> {};
« no previous file with comments | « include/v8-version.h ('k') | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698