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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 (IsVariableProxy() && AsVariableProxy()->is_this()); | 64 (IsVariableProxy() && AsVariableProxy()->is_this()); |
65 } | 65 } |
66 | 66 |
67 | 67 |
68 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position, | 68 VariableProxy::VariableProxy(Zone* zone, Variable* var, int start_position, |
69 int end_position) | 69 int end_position) |
70 : Expression(zone, start_position), | 70 : Expression(zone, start_position), |
71 bit_field_(IsThisField::encode(var->is_this()) | | 71 bit_field_(IsThisField::encode(var->is_this()) | |
72 IsAssignedField::encode(false) | | 72 IsAssignedField::encode(false) | |
73 IsResolvedField::encode(false)), | 73 IsResolvedField::encode(false)), |
74 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | |
75 raw_name_(var->raw_name()), | 74 raw_name_(var->raw_name()), |
76 end_position_(end_position) { | 75 end_position_(end_position) { |
77 BindTo(var); | 76 BindTo(var); |
78 } | 77 } |
79 | 78 |
80 | 79 |
81 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, | 80 VariableProxy::VariableProxy(Zone* zone, const AstRawString* name, |
82 Variable::Kind variable_kind, int start_position, | 81 Variable::Kind variable_kind, int start_position, |
83 int end_position) | 82 int end_position) |
84 : Expression(zone, start_position), | 83 : Expression(zone, start_position), |
85 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | | 84 bit_field_(IsThisField::encode(variable_kind == Variable::THIS) | |
86 IsAssignedField::encode(false) | | 85 IsAssignedField::encode(false) | |
87 IsResolvedField::encode(false)), | 86 IsResolvedField::encode(false)), |
88 variable_feedback_slot_(FeedbackVectorICSlot::Invalid()), | |
89 raw_name_(name), | 87 raw_name_(name), |
90 end_position_(end_position) {} | 88 end_position_(end_position) {} |
91 | 89 |
92 | 90 |
93 void VariableProxy::BindTo(Variable* var) { | 91 void VariableProxy::BindTo(Variable* var) { |
94 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); | 92 DCHECK((is_this() && var->is_this()) || raw_name() == var->raw_name()); |
95 set_var(var); | 93 set_var(var); |
96 set_is_resolved(); | 94 set_is_resolved(); |
97 var->set_is_used(); | 95 var->set_is_used(); |
98 } | 96 } |
99 | 97 |
100 | 98 |
101 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, | 99 void VariableProxy::AssignFeedbackVectorSlots(Isolate* isolate, |
102 FeedbackVectorSpec* spec, | 100 FeedbackVectorSpec* spec, |
103 ICSlotCache* cache) { | 101 FeedbackVectorSlotCache* cache) { |
104 if (UsesVariableFeedbackSlot()) { | 102 if (UsesVariableFeedbackSlot()) { |
105 // VariableProxies that point to the same Variable within a function can | 103 // VariableProxies that point to the same Variable within a function can |
106 // make their loads from the same IC slot. | 104 // make their loads from the same IC slot. |
107 if (var()->IsUnallocated()) { | 105 if (var()->IsUnallocated()) { |
108 ZoneHashMap::Entry* entry = cache->Get(var()); | 106 ZoneHashMap::Entry* entry = cache->Get(var()); |
109 if (entry != NULL) { | 107 if (entry != NULL) { |
110 variable_feedback_slot_ = FeedbackVectorICSlot( | 108 variable_feedback_slot_ = FeedbackVectorSlot( |
111 static_cast<int>(reinterpret_cast<intptr_t>(entry->value))); | 109 static_cast<int>(reinterpret_cast<intptr_t>(entry->value))); |
112 return; | 110 return; |
113 } | 111 } |
114 } | 112 } |
115 variable_feedback_slot_ = spec->AddLoadICSlot(); | 113 variable_feedback_slot_ = spec->AddLoadICSlot(); |
116 if (var()->IsUnallocated()) { | 114 if (var()->IsUnallocated()) { |
117 cache->Put(var(), variable_feedback_slot_); | 115 cache->Put(var(), variable_feedback_slot_); |
118 } | 116 } |
119 } | 117 } |
120 } | 118 } |
121 | 119 |
122 | 120 |
123 static void AssignVectorSlots(Expression* expr, FeedbackVectorSpec* spec, | 121 static void AssignVectorSlots(Expression* expr, FeedbackVectorSpec* spec, |
124 FeedbackVectorICSlot* out_slot) { | 122 FeedbackVectorSlot* out_slot) { |
125 if (FLAG_vector_stores) { | 123 if (FLAG_vector_stores) { |
126 Property* property = expr->AsProperty(); | 124 Property* property = expr->AsProperty(); |
127 LhsKind assign_type = Property::GetAssignType(property); | 125 LhsKind assign_type = Property::GetAssignType(property); |
128 if ((assign_type == VARIABLE && | 126 if ((assign_type == VARIABLE && |
129 expr->AsVariableProxy()->var()->IsUnallocated()) || | 127 expr->AsVariableProxy()->var()->IsUnallocated()) || |
130 assign_type == NAMED_PROPERTY || assign_type == KEYED_PROPERTY) { | 128 assign_type == NAMED_PROPERTY || assign_type == KEYED_PROPERTY) { |
131 // TODO(ishell): consider using ICSlotCache for variables here. | 129 // TODO(ishell): consider using ICSlotCache for variables here. |
132 FeedbackVectorSlotKind kind = assign_type == KEYED_PROPERTY | 130 FeedbackVectorSlotKind kind = assign_type == KEYED_PROPERTY |
133 ? FeedbackVectorSlotKind::KEYED_STORE_IC | 131 ? FeedbackVectorSlotKind::KEYED_STORE_IC |
134 : FeedbackVectorSlotKind::STORE_IC; | 132 : FeedbackVectorSlotKind::STORE_IC; |
135 *out_slot = spec->AddSlot(kind); | 133 *out_slot = spec->AddSlot(kind); |
136 } | 134 } |
137 } | 135 } |
138 } | 136 } |
139 | 137 |
140 | 138 |
141 void ForEachStatement::AssignFeedbackVectorSlots(Isolate* isolate, | 139 void ForEachStatement::AssignFeedbackVectorSlots( |
142 FeedbackVectorSpec* spec, | 140 Isolate* isolate, FeedbackVectorSpec* spec, |
143 ICSlotCache* cache) { | 141 FeedbackVectorSlotCache* cache) { |
144 AssignVectorSlots(each(), spec, &each_slot_); | 142 AssignVectorSlots(each(), spec, &each_slot_); |
145 } | 143 } |
146 | 144 |
147 | 145 |
148 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, | 146 Assignment::Assignment(Zone* zone, Token::Value op, Expression* target, |
149 Expression* value, int pos) | 147 Expression* value, int pos) |
150 : Expression(zone, pos), | 148 : Expression(zone, pos), |
151 bit_field_( | 149 bit_field_( |
152 IsUninitializedField::encode(false) | KeyTypeField::encode(ELEMENT) | | 150 IsUninitializedField::encode(false) | KeyTypeField::encode(ELEMENT) | |
153 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)), | 151 StoreModeField::encode(STANDARD_STORE) | TokenField::encode(op)), |
154 target_(target), | 152 target_(target), |
155 value_(value), | 153 value_(value), |
156 binary_operation_(NULL), | 154 binary_operation_(NULL) {} |
157 slot_(FeedbackVectorICSlot::Invalid()) {} | |
158 | 155 |
159 | 156 |
160 void Assignment::AssignFeedbackVectorSlots(Isolate* isolate, | 157 void Assignment::AssignFeedbackVectorSlots(Isolate* isolate, |
161 FeedbackVectorSpec* spec, | 158 FeedbackVectorSpec* spec, |
162 ICSlotCache* cache) { | 159 FeedbackVectorSlotCache* cache) { |
163 AssignVectorSlots(target(), spec, &slot_); | 160 AssignVectorSlots(target(), spec, &slot_); |
164 } | 161 } |
165 | 162 |
166 | 163 |
167 void CountOperation::AssignFeedbackVectorSlots(Isolate* isolate, | 164 void CountOperation::AssignFeedbackVectorSlots(Isolate* isolate, |
168 FeedbackVectorSpec* spec, | 165 FeedbackVectorSpec* spec, |
169 ICSlotCache* cache) { | 166 FeedbackVectorSlotCache* cache) { |
170 AssignVectorSlots(expression(), spec, &slot_); | 167 AssignVectorSlots(expression(), spec, &slot_); |
171 } | 168 } |
172 | 169 |
173 | 170 |
174 Token::Value Assignment::binary_op() const { | 171 Token::Value Assignment::binary_op() const { |
175 switch (op()) { | 172 switch (op()) { |
176 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; | 173 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; |
177 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; | 174 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; |
178 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; | 175 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; |
179 case Token::ASSIGN_SHL: return Token::SHL; | 176 case Token::ASSIGN_SHL: return Token::SHL; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope()); | 217 DCHECK_NOT_NULL(expr->AsFunctionLiteral()->scope()); |
221 return expr->AsFunctionLiteral()->scope()->NeedsHomeObject(); | 218 return expr->AsFunctionLiteral()->scope()->NeedsHomeObject(); |
222 } | 219 } |
223 | 220 |
224 | 221 |
225 ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value, | 222 ObjectLiteralProperty::ObjectLiteralProperty(Expression* key, Expression* value, |
226 Kind kind, bool is_static, | 223 Kind kind, bool is_static, |
227 bool is_computed_name) | 224 bool is_computed_name) |
228 : key_(key), | 225 : key_(key), |
229 value_(value), | 226 value_(value), |
230 slot_(FeedbackVectorICSlot::Invalid()), | |
231 kind_(kind), | 227 kind_(kind), |
232 emit_store_(true), | 228 emit_store_(true), |
233 is_static_(is_static), | 229 is_static_(is_static), |
234 is_computed_name_(is_computed_name) {} | 230 is_computed_name_(is_computed_name) {} |
235 | 231 |
236 | 232 |
237 ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory, | 233 ObjectLiteralProperty::ObjectLiteralProperty(AstValueFactory* ast_value_factory, |
238 Expression* key, Expression* value, | 234 Expression* key, Expression* value, |
239 bool is_static, | 235 bool is_static, |
240 bool is_computed_name) | 236 bool is_computed_name) |
241 : key_(key), | 237 : key_(key), |
242 value_(value), | 238 value_(value), |
243 slot_(FeedbackVectorICSlot::Invalid()), | |
244 emit_store_(true), | 239 emit_store_(true), |
245 is_static_(is_static), | 240 is_static_(is_static), |
246 is_computed_name_(is_computed_name) { | 241 is_computed_name_(is_computed_name) { |
247 if (!is_computed_name && | 242 if (!is_computed_name && |
248 key->AsLiteral()->raw_value()->EqualsString( | 243 key->AsLiteral()->raw_value()->EqualsString( |
249 ast_value_factory->proto_string())) { | 244 ast_value_factory->proto_string())) { |
250 kind_ = PROTOTYPE; | 245 kind_ = PROTOTYPE; |
251 } else if (value_->AsMaterializedLiteral() != NULL) { | 246 } else if (value_->AsMaterializedLiteral() != NULL) { |
252 kind_ = MATERIALIZED_LITERAL; | 247 kind_ = MATERIALIZED_LITERAL; |
253 } else if (value_->IsLiteral()) { | 248 } else if (value_->IsLiteral()) { |
254 kind_ = CONSTANT; | 249 kind_ = CONSTANT; |
255 } else { | 250 } else { |
256 kind_ = COMPUTED; | 251 kind_ = COMPUTED; |
257 } | 252 } |
258 } | 253 } |
259 | 254 |
260 | 255 |
261 void ClassLiteral::AssignFeedbackVectorSlots(Isolate* isolate, | 256 void ClassLiteral::AssignFeedbackVectorSlots(Isolate* isolate, |
262 FeedbackVectorSpec* spec, | 257 FeedbackVectorSpec* spec, |
263 ICSlotCache* cache) { | 258 FeedbackVectorSlotCache* cache) { |
264 if (!FLAG_vector_stores) return; | 259 if (!FLAG_vector_stores) return; |
265 | 260 |
266 // This logic that computes the number of slots needed for vector store | 261 // This logic that computes the number of slots needed for vector store |
267 // ICs must mirror FullCodeGenerator::VisitClassLiteral. | 262 // ICs must mirror FullCodeGenerator::VisitClassLiteral. |
268 if (NeedsProxySlot()) { | 263 if (NeedsProxySlot()) { |
269 slot_ = spec->AddStoreICSlot(); | 264 slot_ = spec->AddStoreICSlot(); |
270 } | 265 } |
271 | 266 |
272 for (int i = 0; i < properties()->length(); i++) { | 267 for (int i = 0; i < properties()->length(); i++) { |
273 ObjectLiteral::Property* property = properties()->at(i); | 268 ObjectLiteral::Property* property = properties()->at(i); |
274 Expression* value = property->value(); | 269 Expression* value = property->value(); |
275 if (FunctionLiteral::NeedsHomeObject(value)) { | 270 if (FunctionLiteral::NeedsHomeObject(value)) { |
276 property->set_slot(spec->AddStoreICSlot()); | 271 property->SetSlot(spec->AddStoreICSlot()); |
277 } | 272 } |
278 } | 273 } |
279 } | 274 } |
280 | 275 |
281 | 276 |
282 bool ObjectLiteral::Property::IsCompileTimeValue() { | 277 bool ObjectLiteral::Property::IsCompileTimeValue() { |
283 return kind_ == CONSTANT || | 278 return kind_ == CONSTANT || |
284 (kind_ == MATERIALIZED_LITERAL && | 279 (kind_ == MATERIALIZED_LITERAL && |
285 CompileTimeValue::IsCompileTimeValue(value_)); | 280 CompileTimeValue::IsCompileTimeValue(value_)); |
286 } | 281 } |
287 | 282 |
288 | 283 |
289 void ObjectLiteral::Property::set_emit_store(bool emit_store) { | 284 void ObjectLiteral::Property::set_emit_store(bool emit_store) { |
290 emit_store_ = emit_store; | 285 emit_store_ = emit_store; |
291 } | 286 } |
292 | 287 |
293 | 288 |
294 bool ObjectLiteral::Property::emit_store() { | 289 bool ObjectLiteral::Property::emit_store() { |
295 return emit_store_; | 290 return emit_store_; |
296 } | 291 } |
297 | 292 |
298 | 293 |
299 void ObjectLiteral::AssignFeedbackVectorSlots(Isolate* isolate, | 294 void ObjectLiteral::AssignFeedbackVectorSlots(Isolate* isolate, |
300 FeedbackVectorSpec* spec, | 295 FeedbackVectorSpec* spec, |
301 ICSlotCache* cache) { | 296 FeedbackVectorSlotCache* cache) { |
302 if (!FLAG_vector_stores) return; | 297 if (!FLAG_vector_stores) return; |
303 | 298 |
304 // This logic that computes the number of slots needed for vector store | 299 // This logic that computes the number of slots needed for vector store |
305 // ics must mirror FullCodeGenerator::VisitObjectLiteral. | 300 // ics must mirror FullCodeGenerator::VisitObjectLiteral. |
306 int property_index = 0; | 301 int property_index = 0; |
307 for (; property_index < properties()->length(); property_index++) { | 302 for (; property_index < properties()->length(); property_index++) { |
308 ObjectLiteral::Property* property = properties()->at(property_index); | 303 ObjectLiteral::Property* property = properties()->at(property_index); |
309 if (property->is_computed_name()) break; | 304 if (property->is_computed_name()) break; |
310 if (property->IsCompileTimeValue()) continue; | 305 if (property->IsCompileTimeValue()) continue; |
311 | 306 |
312 Literal* key = property->key()->AsLiteral(); | 307 Literal* key = property->key()->AsLiteral(); |
313 Expression* value = property->value(); | 308 Expression* value = property->value(); |
314 switch (property->kind()) { | 309 switch (property->kind()) { |
315 case ObjectLiteral::Property::CONSTANT: | 310 case ObjectLiteral::Property::CONSTANT: |
316 UNREACHABLE(); | 311 UNREACHABLE(); |
317 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 312 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
318 // Fall through. | 313 // Fall through. |
319 case ObjectLiteral::Property::COMPUTED: | 314 case ObjectLiteral::Property::COMPUTED: |
320 // It is safe to use [[Put]] here because the boilerplate already | 315 // It is safe to use [[Put]] here because the boilerplate already |
321 // contains computed properties with an uninitialized value. | 316 // contains computed properties with an uninitialized value. |
322 if (key->value()->IsInternalizedString()) { | 317 if (key->value()->IsInternalizedString()) { |
323 if (property->emit_store()) { | 318 if (property->emit_store()) { |
324 property->set_slot(spec->AddStoreICSlot()); | 319 property->SetSlot(spec->AddStoreICSlot()); |
325 if (FunctionLiteral::NeedsHomeObject(value)) { | 320 if (FunctionLiteral::NeedsHomeObject(value)) { |
326 spec->AddStoreICSlot(); | 321 property->SetSlot(spec->AddStoreICSlot(), 1); |
327 } | 322 } |
328 } | 323 } |
329 break; | 324 break; |
330 } | 325 } |
331 if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) { | 326 if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) { |
332 property->set_slot(spec->AddStoreICSlot()); | 327 property->SetSlot(spec->AddStoreICSlot()); |
333 } | 328 } |
334 break; | 329 break; |
335 case ObjectLiteral::Property::PROTOTYPE: | 330 case ObjectLiteral::Property::PROTOTYPE: |
336 break; | 331 break; |
337 case ObjectLiteral::Property::GETTER: | 332 case ObjectLiteral::Property::GETTER: |
338 if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) { | 333 if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) { |
339 property->set_slot(spec->AddStoreICSlot()); | 334 property->SetSlot(spec->AddStoreICSlot()); |
340 } | 335 } |
341 break; | 336 break; |
342 case ObjectLiteral::Property::SETTER: | 337 case ObjectLiteral::Property::SETTER: |
343 if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) { | 338 if (property->emit_store() && FunctionLiteral::NeedsHomeObject(value)) { |
344 property->set_slot(spec->AddStoreICSlot()); | 339 property->SetSlot(spec->AddStoreICSlot()); |
345 } | 340 } |
346 break; | 341 break; |
347 } | 342 } |
348 } | 343 } |
349 | 344 |
350 for (; property_index < properties()->length(); property_index++) { | 345 for (; property_index < properties()->length(); property_index++) { |
351 ObjectLiteral::Property* property = properties()->at(property_index); | 346 ObjectLiteral::Property* property = properties()->at(property_index); |
352 | 347 |
353 Expression* value = property->value(); | 348 Expression* value = property->value(); |
354 if (property->kind() != ObjectLiteral::Property::PROTOTYPE) { | 349 if (property->kind() != ObjectLiteral::Property::PROTOTYPE) { |
355 if (FunctionLiteral::NeedsHomeObject(value)) { | 350 if (FunctionLiteral::NeedsHomeObject(value)) { |
356 property->set_slot(spec->AddStoreICSlot()); | 351 property->SetSlot(spec->AddStoreICSlot()); |
357 } | 352 } |
358 } | 353 } |
359 } | 354 } |
360 } | 355 } |
361 | 356 |
362 | 357 |
363 void ObjectLiteral::CalculateEmitStore(Zone* zone) { | 358 void ObjectLiteral::CalculateEmitStore(Zone* zone) { |
364 const auto GETTER = ObjectLiteral::Property::GETTER; | 359 const auto GETTER = ObjectLiteral::Property::GETTER; |
365 const auto SETTER = ObjectLiteral::Property::SETTER; | 360 const auto SETTER = ObjectLiteral::Property::SETTER; |
366 | 361 |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 | 708 |
714 | 709 |
715 bool Call::IsUsingCallFeedbackSlot(Isolate* isolate) const { | 710 bool Call::IsUsingCallFeedbackSlot(Isolate* isolate) const { |
716 // SuperConstructorCall uses a CallConstructStub, which wants | 711 // SuperConstructorCall uses a CallConstructStub, which wants |
717 // a Slot, in addition to any IC slots requested elsewhere. | 712 // a Slot, in addition to any IC slots requested elsewhere. |
718 return GetCallType(isolate) == SUPER_CALL; | 713 return GetCallType(isolate) == SUPER_CALL; |
719 } | 714 } |
720 | 715 |
721 | 716 |
722 void Call::AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 717 void Call::AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
723 ICSlotCache* cache) { | 718 FeedbackVectorSlotCache* cache) { |
724 if (IsUsingCallFeedbackICSlot(isolate)) { | 719 if (IsUsingCallFeedbackICSlot(isolate)) { |
725 ic_slot_ = spec->AddCallICSlot(); | 720 ic_slot_ = spec->AddCallICSlot(); |
726 } | 721 } |
727 if (IsUsingCallFeedbackSlot(isolate)) { | 722 if (IsUsingCallFeedbackSlot(isolate)) { |
728 slot_ = spec->AddStubSlot(); | 723 stub_slot_ = spec->AddGeneralSlot(); |
729 } | 724 } |
730 } | 725 } |
731 | 726 |
732 | 727 |
733 Call::CallType Call::GetCallType(Isolate* isolate) const { | 728 Call::CallType Call::GetCallType(Isolate* isolate) const { |
734 VariableProxy* proxy = expression()->AsVariableProxy(); | 729 VariableProxy* proxy = expression()->AsVariableProxy(); |
735 if (proxy != NULL) { | 730 if (proxy != NULL) { |
736 if (proxy->var()->is_possibly_eval(isolate)) { | 731 if (proxy->var()->is_possibly_eval(isolate)) { |
737 return POSSIBLY_EVAL_CALL; | 732 return POSSIBLY_EVAL_CALL; |
738 } else if (proxy->var()->IsUnallocatedOrGlobalSlot()) { | 733 } else if (proxy->var()->IsUnallocatedOrGlobalSlot()) { |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 bool Literal::Match(void* literal1, void* literal2) { | 1123 bool Literal::Match(void* literal1, void* literal2) { |
1129 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1124 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1130 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1125 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1131 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1126 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1132 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1127 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1133 } | 1128 } |
1134 | 1129 |
1135 | 1130 |
1136 } // namespace internal | 1131 } // namespace internal |
1137 } // namespace v8 | 1132 } // namespace v8 |
OLD | NEW |