OLD | NEW |
---|---|
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/ast.h" | 5 #include "src/ast/ast.h" |
6 | 6 |
7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
8 | 8 |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 var->set_is_used(); | 113 var->set_is_used(); |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, | 117 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, |
118 FeedbackVectorSpec* spec, | 118 FeedbackVectorSpec* spec, |
119 FeedbackVectorSlotCache* cache) { | 119 FeedbackVectorSlotCache* cache) { |
120 if (UsesVariableFeedbackSlot()) { | 120 if (UsesVariableFeedbackSlot()) { |
121 // VariableProxies that point to the same Variable within a function can | 121 // VariableProxies that point to the same Variable within a function can |
122 // make their loads from the same IC slot. | 122 // make their loads from the same IC slot. |
123 if (var()->IsUnallocated()) { | 123 if (var()->IsUnallocated() || var()->mode() == DYNAMIC_GLOBAL) { |
124 ZoneHashMap::Entry* entry = cache->Get(var()); | 124 ZoneHashMap::Entry* entry = cache->Get(var()); |
125 if (entry != NULL) { | 125 if (entry != NULL) { |
126 variable_feedback_slot_ = FeedbackVectorSlot( | 126 variable_feedback_slot_ = FeedbackVectorSlot( |
127 static_cast<int>(reinterpret_cast<intptr_t>(entry->value))); | 127 static_cast<int>(reinterpret_cast<intptr_t>(entry->value))); |
128 return; | 128 return; |
129 } | 129 } |
130 } | 130 variable_feedback_slot_ = spec->AddLoadGlobalICSlot(); |
131 variable_feedback_slot_ = spec->AddLoadICSlot(); | |
132 if (var()->IsUnallocated()) { | |
133 cache->Put(var(), variable_feedback_slot_); | 131 cache->Put(var(), variable_feedback_slot_); |
132 } else { | |
133 variable_feedback_slot_ = spec->AddLoadICSlot(); | |
mvstanton
2016/06/13 14:06:41
This is confusing, because it looks like it's sayi
| |
134 } | 134 } |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 static void AssignVectorSlots(Expression* expr, FeedbackVectorSpec* spec, | 139 static void AssignVectorSlots(Expression* expr, FeedbackVectorSpec* spec, |
140 FeedbackVectorSlot* out_slot) { | 140 FeedbackVectorSlot* out_slot) { |
141 Property* property = expr->AsProperty(); | 141 Property* property = expr->AsProperty(); |
142 LhsKind assign_type = Property::GetAssignType(property); | 142 LhsKind assign_type = Property::GetAssignType(property); |
143 if ((assign_type == VARIABLE && | 143 if ((assign_type == VARIABLE && |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1134 bool Literal::Match(void* literal1, void* literal2) { | 1134 bool Literal::Match(void* literal1, void* literal2) { |
1135 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1135 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1136 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1136 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1137 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1137 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1138 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1138 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1139 } | 1139 } |
1140 | 1140 |
1141 | 1141 |
1142 } // namespace internal | 1142 } // namespace internal |
1143 } // namespace v8 | 1143 } // namespace v8 |
OLD | NEW |