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 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 ObjectLiteral::Property* property = expr->properties()->at(i); | 1382 ObjectLiteral::Property* property = expr->properties()->at(i); |
1383 | 1383 |
1384 // Set-up receiver. | 1384 // Set-up receiver. |
1385 Register new_receiver = property->is_static() ? literal : prototype; | 1385 Register new_receiver = property->is_static() ? literal : prototype; |
1386 if (new_receiver != old_receiver) { | 1386 if (new_receiver != old_receiver) { |
1387 builder()->MoveRegister(new_receiver, receiver); | 1387 builder()->MoveRegister(new_receiver, receiver); |
1388 old_receiver = new_receiver; | 1388 old_receiver = new_receiver; |
1389 } | 1389 } |
1390 | 1390 |
1391 VisitForAccumulatorValue(property->key()); | 1391 VisitForAccumulatorValue(property->key()); |
1392 builder()->CastAccumulatorToName().StoreAccumulatorInRegister(key); | 1392 builder()->CastAccumulatorToName(key); |
1393 // The static prototype property is read only. We handle the non computed | 1393 // The static prototype property is read only. We handle the non computed |
1394 // property name case in the parser. Since this is the only case where we | 1394 // property name case in the parser. Since this is the only case where we |
1395 // need to check for an own read only property we special case this so we do | 1395 // need to check for an own read only property we special case this so we do |
1396 // not need to do this for every property. | 1396 // not need to do this for every property. |
1397 if (property->is_static() && property->is_computed_name()) { | 1397 if (property->is_static() && property->is_computed_name()) { |
1398 VisitClassLiteralStaticPrototypeWithComputedName(key); | 1398 VisitClassLiteralStaticPrototypeWithComputedName(key); |
1399 } | 1399 } |
1400 VisitForAccumulatorValue(property->value()); | 1400 VisitForAccumulatorValue(property->value()); |
1401 builder()->StoreAccumulatorInRegister(value); | 1401 builder()->StoreAccumulatorInRegister(value); |
1402 | 1402 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1668 Register literal_argument = register_allocator()->NextConsecutiveRegister(); | 1668 Register literal_argument = register_allocator()->NextConsecutiveRegister(); |
1669 Register key = register_allocator()->NextConsecutiveRegister(); | 1669 Register key = register_allocator()->NextConsecutiveRegister(); |
1670 Register value = register_allocator()->NextConsecutiveRegister(); | 1670 Register value = register_allocator()->NextConsecutiveRegister(); |
1671 Register attr = register_allocator()->NextConsecutiveRegister(); | 1671 Register attr = register_allocator()->NextConsecutiveRegister(); |
1672 DCHECK(Register::AreContiguous(literal_argument, key, value, attr)); | 1672 DCHECK(Register::AreContiguous(literal_argument, key, value, attr)); |
1673 Register set_function_name = | 1673 Register set_function_name = |
1674 register_allocator()->NextConsecutiveRegister(); | 1674 register_allocator()->NextConsecutiveRegister(); |
1675 | 1675 |
1676 builder()->MoveRegister(literal, literal_argument); | 1676 builder()->MoveRegister(literal, literal_argument); |
1677 VisitForAccumulatorValue(property->key()); | 1677 VisitForAccumulatorValue(property->key()); |
1678 builder()->CastAccumulatorToName().StoreAccumulatorInRegister(key); | 1678 builder()->CastAccumulatorToName(key); |
1679 VisitForAccumulatorValue(property->value()); | 1679 VisitForAccumulatorValue(property->value()); |
1680 builder()->StoreAccumulatorInRegister(value); | 1680 builder()->StoreAccumulatorInRegister(value); |
1681 VisitSetHomeObject(value, literal, property); | 1681 VisitSetHomeObject(value, literal, property); |
1682 builder()->LoadLiteral(Smi::FromInt(NONE)).StoreAccumulatorInRegister(attr); | 1682 builder()->LoadLiteral(Smi::FromInt(NONE)).StoreAccumulatorInRegister(attr); |
1683 switch (property->kind()) { | 1683 switch (property->kind()) { |
1684 case ObjectLiteral::Property::CONSTANT: | 1684 case ObjectLiteral::Property::CONSTANT: |
1685 case ObjectLiteral::Property::COMPUTED: | 1685 case ObjectLiteral::Property::COMPUTED: |
1686 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1686 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1687 builder() | 1687 builder() |
1688 ->LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) | 1688 ->LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3178 return execution_context()->scope()->language_mode(); | 3178 return execution_context()->scope()->language_mode(); |
3179 } | 3179 } |
3180 | 3180 |
3181 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3181 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3182 return TypeFeedbackVector::GetIndex(slot); | 3182 return TypeFeedbackVector::GetIndex(slot); |
3183 } | 3183 } |
3184 | 3184 |
3185 } // namespace interpreter | 3185 } // namespace interpreter |
3186 } // namespace internal | 3186 } // namespace internal |
3187 } // namespace v8 | 3187 } // namespace v8 |
OLD | NEW |