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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 } | 1417 } |
1418 | 1418 |
1419 VisitForStackValue(lit->constructor()); | 1419 VisitForStackValue(lit->constructor()); |
1420 | 1420 |
1421 __ Push(script()); | 1421 __ Push(script()); |
1422 __ Push(Smi::FromInt(lit->start_position())); | 1422 __ Push(Smi::FromInt(lit->start_position())); |
1423 __ Push(Smi::FromInt(lit->end_position())); | 1423 __ Push(Smi::FromInt(lit->end_position())); |
1424 | 1424 |
1425 __ CallRuntime(Runtime::kDefineClass, 6); | 1425 __ CallRuntime(Runtime::kDefineClass, 6); |
1426 PrepareForBailoutForId(lit->CreateLiteralId(), TOS_REG); | 1426 PrepareForBailoutForId(lit->CreateLiteralId(), TOS_REG); |
1427 EmitClassDefineProperties(lit); | 1427 |
| 1428 int store_slot_index = 0; |
| 1429 EmitClassDefineProperties(lit, &store_slot_index); |
1428 | 1430 |
1429 if (lit->scope() != NULL) { | 1431 if (lit->scope() != NULL) { |
1430 DCHECK_NOT_NULL(lit->class_variable_proxy()); | 1432 DCHECK_NOT_NULL(lit->class_variable_proxy()); |
| 1433 FeedbackVectorICSlot slot = FLAG_vector_stores |
| 1434 ? lit->GetNthSlot(store_slot_index++) |
| 1435 : FeedbackVectorICSlot::Invalid(); |
1431 EmitVariableAssignment(lit->class_variable_proxy()->var(), | 1436 EmitVariableAssignment(lit->class_variable_proxy()->var(), |
1432 Token::INIT_CONST); | 1437 Token::INIT_CONST, slot); |
1433 } | 1438 } |
| 1439 |
| 1440 // Verify that compilation exactly consumed the number of store ic slots |
| 1441 // that the ClassLiteral node had to offer. |
| 1442 DCHECK(!FLAG_vector_stores || store_slot_index == lit->slot_count()); |
1434 } | 1443 } |
1435 | 1444 |
1436 context()->Plug(result_register()); | 1445 context()->Plug(result_register()); |
1437 } | 1446 } |
1438 | 1447 |
1439 | 1448 |
1440 void FullCodeGenerator::VisitNativeFunctionLiteral( | 1449 void FullCodeGenerator::VisitNativeFunctionLiteral( |
1441 NativeFunctionLiteral* expr) { | 1450 NativeFunctionLiteral* expr) { |
1442 Comment cmnt(masm_, "[ NativeFunctionLiteral"); | 1451 Comment cmnt(masm_, "[ NativeFunctionLiteral"); |
1443 | 1452 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1706 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
1698 codegen_->scope_ = saved_scope_; | 1707 codegen_->scope_ = saved_scope_; |
1699 } | 1708 } |
1700 | 1709 |
1701 | 1710 |
1702 #undef __ | 1711 #undef __ |
1703 | 1712 |
1704 | 1713 |
1705 } // namespace internal | 1714 } // namespace internal |
1706 } // namespace v8 | 1715 } // namespace v8 |
OLD | NEW |