OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/interpreter/bytecode-flags.h" | 10 #include "src/interpreter/bytecode-flags.h" |
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 expr->flags()); | 1603 expr->flags()); |
1604 execution_result()->SetResultInAccumulator(); | 1604 execution_result()->SetResultInAccumulator(); |
1605 } | 1605 } |
1606 | 1606 |
1607 void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1607 void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1608 // Copy the literal boilerplate. | 1608 // Copy the literal boilerplate. |
1609 uint8_t flags = CreateObjectLiteralFlags::Encode( | 1609 uint8_t flags = CreateObjectLiteralFlags::Encode( |
1610 FastCloneShallowObjectStub::IsSupported(expr), | 1610 FastCloneShallowObjectStub::IsSupported(expr), |
1611 FastCloneShallowObjectStub::PropertiesCount(expr->properties_count()), | 1611 FastCloneShallowObjectStub::PropertiesCount(expr->properties_count()), |
1612 expr->ComputeFlags()); | 1612 expr->ComputeFlags()); |
1613 builder()->CreateObjectLiteral(expr->constant_properties(), | |
1614 expr->literal_index(), flags); | |
1615 | |
1616 // Allocate in the outer scope since this register is used to return the | 1613 // Allocate in the outer scope since this register is used to return the |
1617 // expression's results to the caller. | 1614 // expression's results to the caller. |
1618 Register literal = register_allocator()->outer()->NewRegister(); | 1615 Register literal = register_allocator()->outer()->NewRegister(); |
1619 builder()->StoreAccumulatorInRegister(literal); | 1616 builder()->CreateObjectLiteral(expr->constant_properties(), |
| 1617 expr->literal_index(), flags, literal); |
1620 | 1618 |
1621 // Store computed values into the literal. | 1619 // Store computed values into the literal. |
1622 int property_index = 0; | 1620 int property_index = 0; |
1623 AccessorTable accessor_table(zone()); | 1621 AccessorTable accessor_table(zone()); |
1624 for (; property_index < expr->properties()->length(); property_index++) { | 1622 for (; property_index < expr->properties()->length(); property_index++) { |
1625 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1623 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
1626 if (property->is_computed_name()) break; | 1624 if (property->is_computed_name()) break; |
1627 if (property->IsCompileTimeValue()) continue; | 1625 if (property->IsCompileTimeValue()) continue; |
1628 | 1626 |
1629 RegisterAllocationScope inner_register_scope(this); | 1627 RegisterAllocationScope inner_register_scope(this); |
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3272 return execution_context()->scope()->language_mode(); | 3270 return execution_context()->scope()->language_mode(); |
3273 } | 3271 } |
3274 | 3272 |
3275 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3273 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3276 return TypeFeedbackVector::GetIndex(slot); | 3274 return TypeFeedbackVector::GetIndex(slot); |
3277 } | 3275 } |
3278 | 3276 |
3279 } // namespace interpreter | 3277 } // namespace interpreter |
3280 } // namespace internal | 3278 } // namespace internal |
3281 } // namespace v8 | 3279 } // namespace v8 |
OLD | NEW |