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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // This logic that computes the number of slots needed for vector store | 301 // This logic that computes the number of slots needed for vector store |
302 // ICs must mirror FullCodeGenerator::VisitClassLiteral. | 302 // ICs must mirror FullCodeGenerator::VisitClassLiteral. |
303 int ic_slots = 0; | 303 int ic_slots = 0; |
304 for (int i = 0; i < properties()->length(); i++) { | 304 for (int i = 0; i < properties()->length(); i++) { |
305 ObjectLiteral::Property* property = properties()->at(i); | 305 ObjectLiteral::Property* property = properties()->at(i); |
306 | 306 |
307 Expression* value = property->value(); | 307 Expression* value = property->value(); |
308 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; | 308 if (FunctionLiteral::NeedsHomeObject(value)) ic_slots++; |
309 } | 309 } |
310 | 310 |
| 311 if (scope() != NULL && class_variable_proxy()->var()->IsUnallocated()) { |
| 312 ic_slots++; |
| 313 } |
| 314 |
311 #ifdef DEBUG | 315 #ifdef DEBUG |
312 // FullCodeGenerator::VisitClassLiteral verifies that it consumes slot_count_ | 316 // FullCodeGenerator::VisitClassLiteral verifies that it consumes slot_count_ |
313 // slots. | 317 // slots. |
314 slot_count_ = ic_slots; | 318 slot_count_ = ic_slots; |
315 #endif | 319 #endif |
316 return FeedbackVectorRequirements(0, ic_slots); | 320 return FeedbackVectorRequirements(0, ic_slots); |
317 } | 321 } |
318 | 322 |
319 | 323 |
320 FeedbackVectorICSlot ClassLiteral::SlotForHomeObject(Expression* value, | 324 FeedbackVectorICSlot ClassLiteral::SlotForHomeObject(Expression* value, |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 bool Literal::Match(void* literal1, void* literal2) { | 1160 bool Literal::Match(void* literal1, void* literal2) { |
1157 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1161 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1158 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1162 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1159 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1163 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
1160 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1164 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1161 } | 1165 } |
1162 | 1166 |
1163 | 1167 |
1164 } // namespace internal | 1168 } // namespace internal |
1165 } // namespace v8 | 1169 } // namespace v8 |
OLD | NEW |