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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | 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 f9d7af1e0d70d624d2f88372b75facba3e6f27ee..b9e79270da1a895d4fc20dc90acd83c3fd1a1f80 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -152,25 +152,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:
enum Flag {
« 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