| 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/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
| (...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1493 | 1493 |
| 1494 if (!attr_assigned) { | 1494 if (!attr_assigned) { |
| 1495 builder() | 1495 builder() |
| 1496 ->LoadLiteral(Smi::FromInt(DONT_ENUM)) | 1496 ->LoadLiteral(Smi::FromInt(DONT_ENUM)) |
| 1497 .StoreAccumulatorInRegister(attr); | 1497 .StoreAccumulatorInRegister(attr); |
| 1498 attr_assigned = true; | 1498 attr_assigned = true; |
| 1499 } | 1499 } |
| 1500 | 1500 |
| 1501 switch (property->kind()) { | 1501 switch (property->kind()) { |
| 1502 case ClassLiteral::Property::METHOD: { | 1502 case ClassLiteral::Property::METHOD: { |
| 1503 builder() | 1503 DataPropertyInLiteralFlags flags = DataPropertyInLiteralFlag::kDontEnum; |
| 1504 ->LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) | 1504 if (property->NeedsSetFunctionName()) { |
| 1505 .StoreDataPropertyInLiteral(receiver, key, value, attr); | 1505 flags |= DataPropertyInLiteralFlag::kSetFunctionName; |
| 1506 } |
| 1507 builder()->StoreDataPropertyInLiteral(receiver, key, value, flags); |
| 1506 break; | 1508 break; |
| 1507 } | 1509 } |
| 1508 case ClassLiteral::Property::GETTER: { | 1510 case ClassLiteral::Property::GETTER: { |
| 1509 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, args); | 1511 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, args); |
| 1510 break; | 1512 break; |
| 1511 } | 1513 } |
| 1512 case ClassLiteral::Property::SETTER: { | 1514 case ClassLiteral::Property::SETTER: { |
| 1513 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, args); | 1515 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, args); |
| 1514 break; | 1516 break; |
| 1515 } | 1517 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 case ObjectLiteral::Property::CONSTANT: | 1732 case ObjectLiteral::Property::CONSTANT: |
| 1731 case ObjectLiteral::Property::COMPUTED: | 1733 case ObjectLiteral::Property::COMPUTED: |
| 1732 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { | 1734 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { |
| 1733 Register key = register_allocator()->NewRegister(); | 1735 Register key = register_allocator()->NewRegister(); |
| 1734 VisitForAccumulatorValue(property->key()); | 1736 VisitForAccumulatorValue(property->key()); |
| 1735 builder()->ConvertAccumulatorToName(key); | 1737 builder()->ConvertAccumulatorToName(key); |
| 1736 | 1738 |
| 1737 Register value = VisitForRegisterValue(property->value()); | 1739 Register value = VisitForRegisterValue(property->value()); |
| 1738 VisitSetHomeObject(value, literal, property); | 1740 VisitSetHomeObject(value, literal, property); |
| 1739 | 1741 |
| 1740 Register attr = register_allocator()->NewRegister(); | 1742 DataPropertyInLiteralFlags data_property_flags = |
| 1743 DataPropertyInLiteralFlag::kNoFlags; |
| 1744 if (property->NeedsSetFunctionName()) { |
| 1745 data_property_flags |= DataPropertyInLiteralFlag::kSetFunctionName; |
| 1746 } |
| 1741 | 1747 |
| 1742 builder() | 1748 builder()->StoreDataPropertyInLiteral(literal, key, value, |
| 1743 ->LoadLiteral(Smi::FromInt(NONE)) | 1749 data_property_flags); |
| 1744 .StoreAccumulatorInRegister(attr) | |
| 1745 .LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) | |
| 1746 .StoreDataPropertyInLiteral(literal, key, value, attr); | |
| 1747 break; | 1750 break; |
| 1748 } | 1751 } |
| 1749 case ObjectLiteral::Property::GETTER: | 1752 case ObjectLiteral::Property::GETTER: |
| 1750 case ObjectLiteral::Property::SETTER: { | 1753 case ObjectLiteral::Property::SETTER: { |
| 1751 RegisterList args = register_allocator()->NewRegisterList(4); | 1754 RegisterList args = register_allocator()->NewRegisterList(4); |
| 1752 builder()->MoveRegister(literal, args[0]); | 1755 builder()->MoveRegister(literal, args[0]); |
| 1753 VisitForAccumulatorValue(property->key()); | 1756 VisitForAccumulatorValue(property->key()); |
| 1754 builder()->ConvertAccumulatorToName(args[1]); | 1757 builder()->ConvertAccumulatorToName(args[1]); |
| 1755 VisitForRegisterValue(property->value(), args[2]); | 1758 VisitForRegisterValue(property->value(), args[2]); |
| 1756 VisitSetHomeObject(args[2], literal, property); | 1759 VisitSetHomeObject(args[2], literal, property); |
| (...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3289 } | 3292 } |
| 3290 | 3293 |
| 3291 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3294 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
| 3292 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3295 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
| 3293 : Runtime::kStoreKeyedToSuper_Sloppy; | 3296 : Runtime::kStoreKeyedToSuper_Sloppy; |
| 3294 } | 3297 } |
| 3295 | 3298 |
| 3296 } // namespace interpreter | 3299 } // namespace interpreter |
| 3297 } // namespace internal | 3300 } // namespace internal |
| 3298 } // namespace v8 | 3301 } // namespace v8 |
| OLD | NEW |