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 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1473 builder() | 1473 builder() |
1474 ->LoadLiteral(Smi::FromInt(DONT_ENUM)) | 1474 ->LoadLiteral(Smi::FromInt(DONT_ENUM)) |
1475 .StoreAccumulatorInRegister(attr); | 1475 .StoreAccumulatorInRegister(attr); |
1476 attr_assigned = true; | 1476 attr_assigned = true; |
1477 } | 1477 } |
1478 | 1478 |
1479 switch (property->kind()) { | 1479 switch (property->kind()) { |
1480 case ClassLiteral::Property::METHOD: { | 1480 case ClassLiteral::Property::METHOD: { |
1481 builder() | 1481 builder() |
1482 ->LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) | 1482 ->LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) |
1483 .StoreAccumulatorInRegister(set_function_name) | 1483 .StoreAccumulatorInRegister(set_function_name); |
1484 .CallRuntime(Runtime::kDefineDataPropertyInLiteral, args); | 1484 builder()->LoadAccumulatorWithRegister(value); |
rmcilroy
2016/11/17 17:18:17
nit - rather than having value to be in the accumu
Franzi
2016/11/18 09:11:53
Done.
| |
1485 builder()->StoreDataPropertyInLiteral(receiver, key, attr, | |
rmcilroy
2016/11/17 17:18:17
nit - just chain the builder calls together like t
Franzi
2016/11/18 09:11:53
Done.
| |
1486 set_function_name); | |
1485 break; | 1487 break; |
1486 } | 1488 } |
1487 case ClassLiteral::Property::GETTER: { | 1489 case ClassLiteral::Property::GETTER: { |
1488 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, | 1490 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, |
1489 args.Truncate(4)); | 1491 args.Truncate(4)); |
1490 break; | 1492 break; |
1491 } | 1493 } |
1492 case ClassLiteral::Property::SETTER: { | 1494 case ClassLiteral::Property::SETTER: { |
1493 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, | 1495 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, |
1494 args.Truncate(4)); | 1496 args.Truncate(4)); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1692 builder()->MoveRegister(literal, args[0]); | 1694 builder()->MoveRegister(literal, args[0]); |
1693 VisitForRegisterValue(property->value(), args[1]); | 1695 VisitForRegisterValue(property->value(), args[1]); |
1694 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); | 1696 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); |
1695 continue; | 1697 continue; |
1696 } | 1698 } |
1697 | 1699 |
1698 switch (property->kind()) { | 1700 switch (property->kind()) { |
1699 case ObjectLiteral::Property::CONSTANT: | 1701 case ObjectLiteral::Property::CONSTANT: |
1700 case ObjectLiteral::Property::COMPUTED: | 1702 case ObjectLiteral::Property::COMPUTED: |
1701 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { | 1703 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { |
1702 RegisterList args = register_allocator()->NewRegisterList(5); | 1704 RegisterList args = register_allocator()->NewRegisterList(5); |
rmcilroy
2016/11/17 17:18:17
These no longer need to be a sequence of consecuti
Franzi
2016/11/18 09:11:53
Done.
| |
1703 builder()->MoveRegister(literal, args[0]); | 1705 builder()->MoveRegister(literal, args[0]); |
1704 VisitForAccumulatorValue(property->key()); | 1706 VisitForAccumulatorValue(property->key()); |
1705 builder()->ConvertAccumulatorToName(args[1]); | 1707 builder()->ConvertAccumulatorToName(args[1]); |
1706 VisitForRegisterValue(property->value(), args[2]); | 1708 VisitForRegisterValue(property->value(), args[2]); |
1707 VisitSetHomeObject(args[2], literal, property); | 1709 VisitSetHomeObject(args[2], literal, property); |
1708 builder() | 1710 builder() |
1709 ->LoadLiteral(Smi::FromInt(NONE)) | 1711 ->LoadLiteral(Smi::FromInt(NONE)) |
1710 .StoreAccumulatorInRegister(args[3]) | 1712 .StoreAccumulatorInRegister(args[3]) |
1711 .LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) | 1713 .LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) |
1712 .StoreAccumulatorInRegister(args[4]); | 1714 .StoreAccumulatorInRegister(args[4]); |
1713 builder()->CallRuntime(Runtime::kDefineDataPropertyInLiteral, args); | 1715 builder()->LoadAccumulatorWithRegister(args[2]); |
1716 builder()->StoreDataPropertyInLiteral(args[0], args[1], args[3], | |
rmcilroy
2016/11/17 17:18:17
ditto
Franzi
2016/11/18 09:11:53
Done.
| |
1717 args[4]); | |
1714 break; | 1718 break; |
1715 } | 1719 } |
1716 case ObjectLiteral::Property::GETTER: | 1720 case ObjectLiteral::Property::GETTER: |
1717 case ObjectLiteral::Property::SETTER: { | 1721 case ObjectLiteral::Property::SETTER: { |
1718 RegisterList args = register_allocator()->NewRegisterList(4); | 1722 RegisterList args = register_allocator()->NewRegisterList(4); |
1719 builder()->MoveRegister(literal, args[0]); | 1723 builder()->MoveRegister(literal, args[0]); |
1720 VisitForAccumulatorValue(property->key()); | 1724 VisitForAccumulatorValue(property->key()); |
1721 builder()->ConvertAccumulatorToName(args[1]); | 1725 builder()->ConvertAccumulatorToName(args[1]); |
1722 VisitForRegisterValue(property->value(), args[2]); | 1726 VisitForRegisterValue(property->value(), args[2]); |
1723 VisitSetHomeObject(args[2], literal, property); | 1727 VisitSetHomeObject(args[2], literal, property); |
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3185 } | 3189 } |
3186 | 3190 |
3187 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3191 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
3188 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3192 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
3189 : Runtime::kStoreKeyedToSuper_Sloppy; | 3193 : Runtime::kStoreKeyedToSuper_Sloppy; |
3190 } | 3194 } |
3191 | 3195 |
3192 } // namespace interpreter | 3196 } // namespace interpreter |
3193 } // namespace internal | 3197 } // namespace internal |
3194 } // namespace v8 | 3198 } // namespace v8 |
OLD | NEW |