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