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/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
9 #include "src/builtins/builtins-constructor.h" | 9 #include "src/builtins/builtins-constructor.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1498 .StoreAccumulatorInRegister(attr); | 1498 .StoreAccumulatorInRegister(attr); |
1499 attr_assigned = true; | 1499 attr_assigned = true; |
1500 } | 1500 } |
1501 | 1501 |
1502 switch (property->kind()) { | 1502 switch (property->kind()) { |
1503 case ClassLiteral::Property::METHOD: { | 1503 case ClassLiteral::Property::METHOD: { |
1504 DataPropertyInLiteralFlags flags = DataPropertyInLiteralFlag::kDontEnum; | 1504 DataPropertyInLiteralFlags flags = DataPropertyInLiteralFlag::kDontEnum; |
1505 if (property->NeedsSetFunctionName()) { | 1505 if (property->NeedsSetFunctionName()) { |
1506 flags |= DataPropertyInLiteralFlag::kSetFunctionName; | 1506 flags |= DataPropertyInLiteralFlag::kSetFunctionName; |
1507 } | 1507 } |
1508 builder()->StoreDataPropertyInLiteral(receiver, key, value, flags); | 1508 |
1509 FeedbackVectorSlot slot = property->GetSlot( | |
1510 FunctionLiteral::NeedsHomeObject(property->value()) ? 1 : 0); | |
1511 DCHECK(!slot.IsInvalid()); | |
1512 | |
1513 builder() | |
1514 ->LoadAccumulatorWithRegister(value) | |
1515 .StoreDataPropertyInLiteral(receiver, key, flags, | |
1516 feedback_index(slot)); | |
1509 break; | 1517 break; |
1510 } | 1518 } |
1511 case ClassLiteral::Property::GETTER: { | 1519 case ClassLiteral::Property::GETTER: { |
1512 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, args); | 1520 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, args); |
1513 break; | 1521 break; |
1514 } | 1522 } |
1515 case ClassLiteral::Property::SETTER: { | 1523 case ClassLiteral::Property::SETTER: { |
1516 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, args); | 1524 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, args); |
1517 break; | 1525 break; |
1518 } | 1526 } |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1740 | 1748 |
1741 Register value = VisitForRegisterValue(property->value()); | 1749 Register value = VisitForRegisterValue(property->value()); |
1742 VisitSetHomeObject(value, literal, property); | 1750 VisitSetHomeObject(value, literal, property); |
1743 | 1751 |
1744 DataPropertyInLiteralFlags data_property_flags = | 1752 DataPropertyInLiteralFlags data_property_flags = |
1745 DataPropertyInLiteralFlag::kNoFlags; | 1753 DataPropertyInLiteralFlag::kNoFlags; |
1746 if (property->NeedsSetFunctionName()) { | 1754 if (property->NeedsSetFunctionName()) { |
1747 data_property_flags |= DataPropertyInLiteralFlag::kSetFunctionName; | 1755 data_property_flags |= DataPropertyInLiteralFlag::kSetFunctionName; |
1748 } | 1756 } |
1749 | 1757 |
1750 builder()->StoreDataPropertyInLiteral(literal, key, value, | 1758 FeedbackVectorSlot slot = property->GetSlot( |
1751 data_property_flags); | 1759 FunctionLiteral::NeedsHomeObject(property->value()) ? 1 : 0); |
mvstanton
2017/01/04 14:21:47
nit: It occurs to me how sad it is to have to pepp
Franzi
2017/01/04 14:51:09
You're right. Hiding the offset in Set/GetStoreDat
| |
1760 DCHECK(!slot.IsInvalid()); | |
1761 | |
1762 builder() | |
1763 ->LoadAccumulatorWithRegister(value) | |
1764 .StoreDataPropertyInLiteral(literal, key, data_property_flags, | |
1765 feedback_index(slot)); | |
1752 break; | 1766 break; |
1753 } | 1767 } |
1754 case ObjectLiteral::Property::GETTER: | 1768 case ObjectLiteral::Property::GETTER: |
1755 case ObjectLiteral::Property::SETTER: { | 1769 case ObjectLiteral::Property::SETTER: { |
1756 RegisterList args = register_allocator()->NewRegisterList(4); | 1770 RegisterList args = register_allocator()->NewRegisterList(4); |
1757 builder()->MoveRegister(literal, args[0]); | 1771 builder()->MoveRegister(literal, args[0]); |
1758 VisitForAccumulatorValue(property->key()); | 1772 VisitForAccumulatorValue(property->key()); |
1759 builder()->ConvertAccumulatorToName(args[1]); | 1773 builder()->ConvertAccumulatorToName(args[1]); |
1760 VisitForRegisterValue(property->value(), args[2]); | 1774 VisitForRegisterValue(property->value(), args[2]); |
1761 VisitSetHomeObject(args[2], literal, property); | 1775 VisitSetHomeObject(args[2], literal, property); |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3309 } | 3323 } |
3310 | 3324 |
3311 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3325 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3312 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3326 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3313 : Runtime::kStoreKeyedToSuper_Sloppy; | 3327 : Runtime::kStoreKeyedToSuper_Sloppy; |
3314 } | 3328 } |
3315 | 3329 |
3316 } // namespace interpreter | 3330 } // namespace interpreter |
3317 } // namespace internal | 3331 } // namespace internal |
3318 } // namespace v8 | 3332 } // namespace v8 |
OLD | NEW |