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.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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 set_var(var); | 89 set_var(var); |
90 set_is_resolved(); | 90 set_is_resolved(); |
91 var->set_is_used(); | 91 var->set_is_used(); |
92 } | 92 } |
93 | 93 |
94 | 94 |
95 void VariableProxy::SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, | 95 void VariableProxy::SetFirstFeedbackICSlot(FeedbackVectorICSlot slot, |
96 ICSlotCache* cache) { | 96 ICSlotCache* cache) { |
97 variable_feedback_slot_ = slot; | 97 variable_feedback_slot_ = slot; |
98 if (var()->IsUnallocated()) { | 98 if (var()->IsUnallocated()) { |
99 cache->Add(VariableICSlotPair(var(), slot)); | 99 cache->Put(var(), slot); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 FeedbackVectorRequirements VariableProxy::ComputeFeedbackRequirements( | 104 FeedbackVectorRequirements VariableProxy::ComputeFeedbackRequirements( |
105 Isolate* isolate, const ICSlotCache* cache) { | 105 Isolate* isolate, const ICSlotCache* cache) { |
106 if (UsesVariableFeedbackSlot()) { | 106 if (UsesVariableFeedbackSlot()) { |
107 // VariableProxies that point to the same Variable within a function can | 107 // VariableProxies that point to the same Variable within a function can |
108 // make their loads from the same IC slot. | 108 // make their loads from the same IC slot. |
109 if (var()->IsUnallocated()) { | 109 if (var()->IsUnallocated()) { |
110 for (int i = 0; i < cache->length(); i++) { | 110 ZoneHashMap::Entry* entry = cache->Get(var()); |
111 VariableICSlotPair& pair = cache->at(i); | 111 if (entry != NULL) { |
112 if (pair.variable() == var()) { | 112 variable_feedback_slot_ = FeedbackVectorICSlot( |
113 variable_feedback_slot_ = pair.slot(); | 113 static_cast<int>(reinterpret_cast<intptr_t>(entry->value))); |
114 return FeedbackVectorRequirements(0, 0); | 114 return FeedbackVectorRequirements(0, 0); |
115 } | |
116 } | 115 } |
117 } | 116 } |
118 return FeedbackVectorRequirements(0, 1); | 117 return FeedbackVectorRequirements(0, 1); |
119 } | 118 } |
120 return FeedbackVectorRequirements(0, 0); | 119 return FeedbackVectorRequirements(0, 0); |
121 } | 120 } |
122 | 121 |
123 | 122 |
124 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, | 123 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, |
125 Expression* value, int pos) | 124 Expression* value, int pos) |
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 // static | 1002 // static |
1004 bool Literal::Match(void* literal1, void* literal2) { | 1003 bool Literal::Match(void* literal1, void* literal2) { |
1005 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1004 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1006 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1005 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1007 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1006 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1008 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1007 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1009 } | 1008 } |
1010 | 1009 |
1011 | 1010 |
1012 } } // namespace v8::internal | 1011 } } // namespace v8::internal |
OLD | NEW |