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

Side by Side Diff: src/ast.cc

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 | « src/ast.h ('k') | src/ast-numbering.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.h" 5 #include "src/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 #include "src/builtins.h" 8 #include "src/builtins.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 set_var(var); 95 set_var(var);
96 set_is_resolved(); 96 set_is_resolved();
97 var->set_is_used(); 97 var->set_is_used();
98 } 98 }
99 99
100 100
101 void VariableProxy::SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, 101 void VariableProxy::SetFirstFeedbackICSlot(FeedbackVectorICSlot slot,
102 ICSlotCache* cache) { 102 ICSlotCache* cache) {
103 variable_feedback_slot_ = slot; 103 variable_feedback_slot_ = slot;
104 if (var()->IsUnallocated()) { 104 if (var()->IsUnallocated()) {
105 cache->Add(VariableICSlotPair(var(), slot)); 105 cache->Put(var(), slot);
106 } 106 }
107 } 107 }
108 108
109 109
110 FeedbackVectorRequirements VariableProxy::ComputeFeedbackRequirements( 110 FeedbackVectorRequirements VariableProxy::ComputeFeedbackRequirements(
111 Isolate* isolate, const ICSlotCache* cache) { 111 Isolate* isolate, const ICSlotCache* cache) {
112 if (UsesVariableFeedbackSlot()) { 112 if (UsesVariableFeedbackSlot()) {
113 // VariableProxies that point to the same Variable within a function can 113 // VariableProxies that point to the same Variable within a function can
114 // make their loads from the same IC slot. 114 // make their loads from the same IC slot.
115 if (var()->IsUnallocated()) { 115 if (var()->IsUnallocated()) {
116 for (int i = 0; i < cache->length(); i++) { 116 ZoneHashMap::Entry* entry = cache->Get(var());
117 VariableICSlotPair& pair = cache->at(i); 117 if (entry != NULL) {
118 if (pair.variable() == var()) { 118 variable_feedback_slot_ = FeedbackVectorICSlot(
119 variable_feedback_slot_ = pair.slot(); 119 static_cast<int>(reinterpret_cast<intptr_t>(entry->value)));
120 return FeedbackVectorRequirements(0, 0); 120 return FeedbackVectorRequirements(0, 0);
121 }
122 } 121 }
123 } 122 }
124 return FeedbackVectorRequirements(0, 1); 123 return FeedbackVectorRequirements(0, 1);
125 } 124 }
126 return FeedbackVectorRequirements(0, 0); 125 return FeedbackVectorRequirements(0, 0);
127 } 126 }
128 127
129 128
130 static int GetStoreICSlots(Expression* expr) { 129 static int GetStoreICSlots(Expression* expr) {
131 int ic_slots = 0; 130 int ic_slots = 0;
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 bool Literal::Match(void* literal1, void* literal2) { 1150 bool Literal::Match(void* literal1, void* literal2) {
1152 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1151 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1153 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1152 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1154 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1153 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1155 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1154 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1156 } 1155 }
1157 1156
1158 1157
1159 } // namespace internal 1158 } // namespace internal
1160 } // namespace v8 1159 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/ast-numbering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698