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

Unified Diff: src/ast/ast.h

Issue 2673383002: [ic] Encode LoadGlobalIC's typeof mode in slot kind instead of code object's flags. (Closed)
Patch Set: Addressed comments and added check to FCG Created 3 years, 10 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/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 5ce553186c67a5ccec72729d6d553b2254602932..74f054612db44d4bfe5e6cb5386549c8446c7d4c 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -129,24 +129,28 @@ AST_NODE_LIST(DEF_FORWARD_DECLARATION)
class FeedbackVectorSlotCache {
public:
- explicit FeedbackVectorSlotCache(Zone* zone)
- : zone_(zone),
- hash_map_(ZoneHashMap::kDefaultHashMapCapacity,
- ZoneAllocationPolicy(zone)) {}
+ typedef std::pair<TypeofMode, Variable*> Key;
- void Put(Variable* variable, FeedbackVectorSlot slot) {
- ZoneHashMap::Entry* entry = hash_map_.LookupOrInsert(
- variable, ComputePointerHash(variable), ZoneAllocationPolicy(zone_));
- entry->value = reinterpret_cast<void*>(slot.ToInt());
+ explicit FeedbackVectorSlotCache(Zone* zone) : map_(zone) {}
+
+ void Put(TypeofMode typeof_mode, Variable* variable,
+ FeedbackVectorSlot slot) {
+ Key key = std::make_pair(typeof_mode, variable);
+ auto entry = std::make_pair(key, slot);
+ map_.insert(entry);
}
- ZoneHashMap::Entry* Get(Variable* variable) const {
- return hash_map_.Lookup(variable, ComputePointerHash(variable));
+ FeedbackVectorSlot Get(TypeofMode typeof_mode, Variable* variable) const {
+ Key key = std::make_pair(typeof_mode, variable);
+ auto iter = map_.find(key);
+ if (iter != map_.end()) {
+ return iter->second;
+ }
+ return FeedbackVectorSlot();
}
private:
- Zone* zone_;
- ZoneHashMap hash_map_;
+ ZoneMap<Key, FeedbackVectorSlot> map_;
};
@@ -1695,7 +1699,7 @@ class VariableProxy final : public Expression {
}
void AssignFeedbackVectorSlots(FeedbackVectorSpec* spec,
- LanguageMode language_mode,
+ TypeofMode typeof_mode,
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot VariableFeedbackSlot() { return variable_feedback_slot_; }
« no previous file with comments | « no previous file | src/ast/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698