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; | |
347 for (int i = 0; i < properties()->length(); i++) { | 346 for (int i = 0; i < properties()->length(); i++) { |
348 ObjectLiteral::Property* property = properties()->at(i); | 347 ObjectLiteral::Property* property = properties()->at(i); |
349 if (property->IsCompileTimeValue()) continue; | 348 if (property->IsCompileTimeValue()) continue; |
350 saw_computed_name |= property->is_computed_name(); | |
351 | 349 |
352 Expression* value = property->value(); | 350 Expression* value = property->value(); |
353 if (saw_computed_name && | 351 if (property->is_computed_name() && |
354 property->kind() != ObjectLiteral::Property::PROTOTYPE) { | 352 property->kind() != ObjectLiteral::Property::PROTOTYPE) { |
355 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; | 353 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; |
356 } else if (property->emit_store()) { | 354 } else if (property->emit_store()) { |
357 if (property->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL || | 355 if (property->kind() == ObjectLiteral::Property::MATERIALIZED_LITERAL || |
358 property->kind() == ObjectLiteral::Property::COMPUTED) { | 356 property->kind() == ObjectLiteral::Property::COMPUTED) { |
359 Literal* key = property->key()->AsLiteral(); | 357 Literal* key = property->key()->AsLiteral(); |
360 if (key->value()->IsInternalizedString()) ic_slots++; | 358 if (key->value()->IsInternalizedString()) ic_slots++; |
361 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; | 359 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; |
362 } else if (property->kind() == ObjectLiteral::Property::GETTER || | 360 } else if (property->kind() == ObjectLiteral::Property::GETTER || |
363 property->kind() == ObjectLiteral::Property::SETTER) { | 361 property->kind() == ObjectLiteral::Property::SETTER) { |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 bool Literal::Match(void* literal1, void* literal2) { | 1151 bool Literal::Match(void* literal1, void* literal2) { |
1154 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1152 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1155 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1153 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1156 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1154 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1157 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1155 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1158 } | 1156 } |
1159 | 1157 |
1160 | 1158 |
1161 } // namespace internal | 1159 } // namespace internal |
1162 } // namespace v8 | 1160 } // namespace v8 |
OLD | NEW |