| 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/ast.h" | 5 #include "src/ast/ast.h" |
| 6 | 6 |
| 7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
| 8 | 8 |
| 9 #include "src/ast/compile-time-value.h" | 9 #include "src/ast/compile-time-value.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 Kind kind, bool is_static, | 360 Kind kind, bool is_static, |
| 361 bool is_computed_name) | 361 bool is_computed_name) |
| 362 : LiteralProperty(key, value, is_computed_name), | 362 : LiteralProperty(key, value, is_computed_name), |
| 363 kind_(kind), | 363 kind_(kind), |
| 364 is_static_(is_static) {} | 364 is_static_(is_static) {} |
| 365 | 365 |
| 366 void ClassLiteral::AssignFeedbackVectorSlots(Isolate* isolate, | 366 void ClassLiteral::AssignFeedbackVectorSlots(Isolate* isolate, |
| 367 FeedbackVectorSpec* spec, | 367 FeedbackVectorSpec* spec, |
| 368 FeedbackVectorSlotCache* cache) { | 368 FeedbackVectorSlotCache* cache) { |
| 369 // This logic that computes the number of slots needed for vector store | 369 // This logic that computes the number of slots needed for vector store |
| 370 // ICs must mirror FullCodeGenerator::VisitClassLiteral. | 370 // ICs must mirror BytecodeGenerator::VisitClassLiteral. |
| 371 prototype_slot_ = spec->AddLoadICSlot(); | 371 if (FunctionLiteral::NeedsHomeObject(constructor())) { |
| 372 home_object_slot_ = spec->AddStoreICSlot(); |
| 373 } |
| 374 |
| 372 if (NeedsProxySlot()) { | 375 if (NeedsProxySlot()) { |
| 373 proxy_slot_ = spec->AddStoreICSlot(); | 376 proxy_slot_ = spec->AddStoreICSlot(); |
| 374 } | 377 } |
| 375 | 378 |
| 376 for (int i = 0; i < properties()->length(); i++) { | 379 for (int i = 0; i < properties()->length(); i++) { |
| 377 ClassLiteral::Property* property = properties()->at(i); | 380 ClassLiteral::Property* property = properties()->at(i); |
| 378 Expression* value = property->value(); | 381 Expression* value = property->value(); |
| 379 if (FunctionLiteral::NeedsHomeObject(value)) { | 382 if (FunctionLiteral::NeedsHomeObject(value)) { |
| 380 property->SetSlot(spec->AddStoreICSlot()); | 383 property->SetSlot(spec->AddStoreICSlot()); |
| 381 } | 384 } |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 // static | 964 // static |
| 962 bool Literal::Match(void* literal1, void* literal2) { | 965 bool Literal::Match(void* literal1, void* literal2) { |
| 963 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 966 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 964 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 967 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 965 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 968 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 966 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 969 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 967 } | 970 } |
| 968 | 971 |
| 969 } // namespace internal | 972 } // namespace internal |
| 970 } // namespace v8 | 973 } // namespace v8 |
| OLD | NEW |