Chromium Code Reviews| 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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 .StoreAccumulatorInRegister(set_function_name); |
|
Leszek Swirski
2016/11/17 16:58:48
you don't need this twice.
Franzi
2016/11/17 17:06:10
Good catch! Thanks.
| |
| 1485 builder()->LoadAccumulatorWithRegister(value); | |
| 1486 builder()->StoreDataPropertyInLiteral(receiver, key, attr, | |
| 1487 set_function_name); | |
| 1485 break; | 1488 break; |
| 1486 } | 1489 } |
| 1487 case ClassLiteral::Property::GETTER: { | 1490 case ClassLiteral::Property::GETTER: { |
| 1488 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, | 1491 builder()->CallRuntime(Runtime::kDefineGetterPropertyUnchecked, |
| 1489 args.Truncate(4)); | 1492 args.Truncate(4)); |
| 1490 break; | 1493 break; |
| 1491 } | 1494 } |
| 1492 case ClassLiteral::Property::SETTER: { | 1495 case ClassLiteral::Property::SETTER: { |
| 1493 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, | 1496 builder()->CallRuntime(Runtime::kDefineSetterPropertyUnchecked, |
| 1494 args.Truncate(4)); | 1497 args.Truncate(4)); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1703 builder()->MoveRegister(literal, args[0]); | 1706 builder()->MoveRegister(literal, args[0]); |
| 1704 VisitForAccumulatorValue(property->key()); | 1707 VisitForAccumulatorValue(property->key()); |
| 1705 builder()->ConvertAccumulatorToName(args[1]); | 1708 builder()->ConvertAccumulatorToName(args[1]); |
| 1706 VisitForRegisterValue(property->value(), args[2]); | 1709 VisitForRegisterValue(property->value(), args[2]); |
| 1707 VisitSetHomeObject(args[2], literal, property); | 1710 VisitSetHomeObject(args[2], literal, property); |
| 1708 builder() | 1711 builder() |
| 1709 ->LoadLiteral(Smi::FromInt(NONE)) | 1712 ->LoadLiteral(Smi::FromInt(NONE)) |
| 1710 .StoreAccumulatorInRegister(args[3]) | 1713 .StoreAccumulatorInRegister(args[3]) |
| 1711 .LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) | 1714 .LoadLiteral(Smi::FromInt(property->NeedsSetFunctionName())) |
| 1712 .StoreAccumulatorInRegister(args[4]); | 1715 .StoreAccumulatorInRegister(args[4]); |
| 1713 builder()->CallRuntime(Runtime::kDefineDataPropertyInLiteral, args); | 1716 builder()->LoadAccumulatorWithRegister(args[2]); |
| 1717 builder()->StoreDataPropertyInLiteral(args[0], args[1], args[3], | |
| 1718 args[4]); | |
| 1714 break; | 1719 break; |
| 1715 } | 1720 } |
| 1716 case ObjectLiteral::Property::GETTER: | 1721 case ObjectLiteral::Property::GETTER: |
| 1717 case ObjectLiteral::Property::SETTER: { | 1722 case ObjectLiteral::Property::SETTER: { |
| 1718 RegisterList args = register_allocator()->NewRegisterList(4); | 1723 RegisterList args = register_allocator()->NewRegisterList(4); |
| 1719 builder()->MoveRegister(literal, args[0]); | 1724 builder()->MoveRegister(literal, args[0]); |
| 1720 VisitForAccumulatorValue(property->key()); | 1725 VisitForAccumulatorValue(property->key()); |
| 1721 builder()->ConvertAccumulatorToName(args[1]); | 1726 builder()->ConvertAccumulatorToName(args[1]); |
| 1722 VisitForRegisterValue(property->value(), args[2]); | 1727 VisitForRegisterValue(property->value(), args[2]); |
| 1723 VisitSetHomeObject(args[2], literal, property); | 1728 VisitSetHomeObject(args[2], literal, property); |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3185 } | 3190 } |
| 3186 | 3191 |
| 3187 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3192 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
| 3188 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3193 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
| 3189 : Runtime::kStoreKeyedToSuper_Sloppy; | 3194 : Runtime::kStoreKeyedToSuper_Sloppy; |
| 3190 } | 3195 } |
| 3191 | 3196 |
| 3192 } // namespace interpreter | 3197 } // namespace interpreter |
| 3193 } // namespace internal | 3198 } // namespace internal |
| 3194 } // namespace v8 | 3199 } // namespace v8 |
| OLD | NEW |