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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 336 } |
337 | 337 |
338 | 338 |
339 FeedbackVectorRequirements ObjectLiteral::ComputeFeedbackRequirements( | 339 FeedbackVectorRequirements ObjectLiteral::ComputeFeedbackRequirements( |
340 Isolate* isolate, const ICSlotCache* cache) { | 340 Isolate* isolate, const ICSlotCache* cache) { |
341 if (!FLAG_vector_stores) return FeedbackVectorRequirements(0, 0); | 341 if (!FLAG_vector_stores) return FeedbackVectorRequirements(0, 0); |
342 | 342 |
343 // This logic that computes the number of slots needed for vector store | 343 // This logic that computes the number of slots needed for vector store |
344 // ics must mirror FullCodeGenerator::VisitObjectLiteral. | 344 // ics must mirror FullCodeGenerator::VisitObjectLiteral. |
345 int ic_slots = 0; | 345 int ic_slots = 0; |
| 346 bool saw_computed_name = false; |
346 for (int i = 0; i < properties()->length(); i++) { | 347 for (int i = 0; i < properties()->length(); i++) { |
347 ObjectLiteral::Property* property = properties()->at(i); | 348 ObjectLiteral::Property* property = properties()->at(i); |
348 if (property->IsCompileTimeValue()) continue; | 349 if (property->IsCompileTimeValue()) continue; |
| 350 saw_computed_name |= property->is_computed_name(); |
349 | 351 |
350 Expression* value = property->value(); | 352 Expression* value = property->value(); |
351 if (property->is_computed_name() && | 353 if (saw_computed_name && |
352 property->kind() != ObjectLiteral::Property::PROTOTYPE) { | 354 property->kind() != ObjectLiteral::Property::PROTOTYPE) { |
353 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; | 355 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; |
354 } else if (property->emit_store()) { | 356 } else if (property->emit_store()) { |
355 if (property->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL || | 357 if (property->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL || |
356 property->kind() == ObjectLiteral::Property::COMPUTED) { | 358 property->kind() == ObjectLiteral::Property::COMPUTED) { |
357 Literal* key = property->key()->AsLiteral(); | 359 Literal* key = property->key()->AsLiteral(); |
358 if (key->value()->IsInternalizedString()) ic_slots++; | 360 if (key->value()->IsInternalizedString()) ic_slots++; |
359 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; | 361 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; |
360 } else if (property->kind() == ObjectLiteral::Property::GETTER || | 362 } else if (property->kind() == ObjectLiteral::Property::GETTER || |
361 property->kind() == ObjectLiteral::Property::SETTER) { | 363 property->kind() == ObjectLiteral::Property::SETTER) { |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 bool Literal::Match(void* literal1, void* literal2) { | 1153 bool Literal::Match(void* literal1, void* literal2) { |
1152 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1154 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1153 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1155 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1154 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1156 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1155 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1157 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1156 } | 1158 } |
1157 | 1159 |
1158 | 1160 |
1159 } // namespace internal | 1161 } // namespace internal |
1160 } // namespace v8 | 1162 } // namespace v8 |
OLD | NEW |