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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // This logic that computes the number of slots needed for vector store | 282 // This logic that computes the number of slots needed for vector store |
283 // ICs must mirror FullCodeGenerator::VisitClassLiteral. | 283 // ICs must mirror FullCodeGenerator::VisitClassLiteral. |
284 int ic_slots = 0; | 284 int ic_slots = 0; |
285 for (int i = 0; i < properties()->length(); i++) { | 285 for (int i = 0; i < properties()->length(); i++) { |
286 ObjectLiteral::Property* property = properties()->at(i); | 286 ObjectLiteral::Property* property = properties()->at(i); |
287 | 287 |
288 Expression* value = property->value(); | 288 Expression* value = property->value(); |
289 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; | 289 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; |
290 } | 290 } |
291 | 291 |
| 292 if (scope() != NULL && class_variable_proxy()->var()->IsUnallocated()) { |
| 293 ic_slots++; |
| 294 } |
| 295 |
292 #ifdef DEBUG | 296 #ifdef DEBUG |
293 // FullCodeGenerator::VisitClassLiteral verifies that it consumes slot_count_ | 297 // FullCodeGenerator::VisitClassLiteral verifies that it consumes slot_count_ |
294 // slots. | 298 // slots. |
295 slot_count_ = ic_slots; | 299 slot_count_ = ic_slots; |
296 #endif | 300 #endif |
297 return FeedbackVectorRequirements(0, ic_slots); | 301 return FeedbackVectorRequirements(0, ic_slots); |
298 } | 302 } |
299 | 303 |
300 | 304 |
301 FeedbackVectorICSlot ClassLiteral::SlotForHomeObject(Expression* value, | 305 FeedbackVectorICSlot ClassLiteral::SlotForHomeObject(Expression* value, |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 bool Literal::Match(void* literal1, void* literal2) { | 1142 bool Literal::Match(void* literal1, void* literal2) { |
1139 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1143 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1140 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1144 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1141 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1145 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1142 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1146 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1143 } | 1147 } |
1144 | 1148 |
1145 | 1149 |
1146 } // namespace internal | 1150 } // namespace internal |
1147 } // namespace v8 | 1151 } // namespace v8 |
OLD | NEW |