| 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 1725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1736 ->LoadLiteral(Smi::FromInt(SLOPPY)) | 1736 ->LoadLiteral(Smi::FromInt(SLOPPY)) |
| 1737 .StoreAccumulatorInRegister(args[3]) | 1737 .StoreAccumulatorInRegister(args[3]) |
| 1738 .CallRuntime(Runtime::kSetProperty, args); | 1738 .CallRuntime(Runtime::kSetProperty, args); |
| 1739 Register value = args[2]; | 1739 Register value = args[2]; |
| 1740 VisitSetHomeObject(value, literal, property); | 1740 VisitSetHomeObject(value, literal, property); |
| 1741 } | 1741 } |
| 1742 } | 1742 } |
| 1743 break; | 1743 break; |
| 1744 } | 1744 } |
| 1745 case ObjectLiteral::Property::PROTOTYPE: { | 1745 case ObjectLiteral::Property::PROTOTYPE: { |
| 1746 if (property->IsNullPrototype()) break; |
| 1746 DCHECK(property->emit_store()); | 1747 DCHECK(property->emit_store()); |
| 1747 RegisterList args = register_allocator()->NewRegisterList(2); | 1748 RegisterList args = register_allocator()->NewRegisterList(2); |
| 1748 builder()->MoveRegister(literal, args[0]); | 1749 builder()->MoveRegister(literal, args[0]); |
| 1749 VisitForRegisterValue(property->value(), args[1]); | 1750 VisitForRegisterValue(property->value(), args[1]); |
| 1750 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); | 1751 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); |
| 1751 break; | 1752 break; |
| 1752 } | 1753 } |
| 1753 case ObjectLiteral::Property::GETTER: | 1754 case ObjectLiteral::Property::GETTER: |
| 1754 if (property->emit_store()) { | 1755 if (property->emit_store()) { |
| 1755 accessor_table.lookup(key)->second->getter = property; | 1756 accessor_table.lookup(key)->second->getter = property; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1785 // with the first computed property name and continues with all properties to | 1786 // with the first computed property name and continues with all properties to |
| 1786 // its right. All the code from above initializes the static component of the | 1787 // its right. All the code from above initializes the static component of the |
| 1787 // object literal, and arranges for the map of the result to reflect the | 1788 // object literal, and arranges for the map of the result to reflect the |
| 1788 // static order in which the keys appear. For the dynamic properties, we | 1789 // static order in which the keys appear. For the dynamic properties, we |
| 1789 // compile them into a series of "SetOwnProperty" runtime calls. This will | 1790 // compile them into a series of "SetOwnProperty" runtime calls. This will |
| 1790 // preserve insertion order. | 1791 // preserve insertion order. |
| 1791 for (; property_index < expr->properties()->length(); property_index++) { | 1792 for (; property_index < expr->properties()->length(); property_index++) { |
| 1792 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1793 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
| 1793 RegisterAllocationScope inner_register_scope(this); | 1794 RegisterAllocationScope inner_register_scope(this); |
| 1794 | 1795 |
| 1795 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { | 1796 if (property->IsPrototype()) { |
| 1797 // __proto__:null is handled by CreateObjectLiteral. |
| 1798 if (property->IsNullPrototype()) continue; |
| 1796 DCHECK(property->emit_store()); | 1799 DCHECK(property->emit_store()); |
| 1797 RegisterList args = register_allocator()->NewRegisterList(2); | 1800 RegisterList args = register_allocator()->NewRegisterList(2); |
| 1798 builder()->MoveRegister(literal, args[0]); | 1801 builder()->MoveRegister(literal, args[0]); |
| 1799 VisitForRegisterValue(property->value(), args[1]); | 1802 VisitForRegisterValue(property->value(), args[1]); |
| 1800 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); | 1803 builder()->CallRuntime(Runtime::kInternalSetPrototype, args); |
| 1801 continue; | 1804 continue; |
| 1802 } | 1805 } |
| 1803 | 1806 |
| 1804 switch (property->kind()) { | 1807 switch (property->kind()) { |
| 1805 case ObjectLiteral::Property::CONSTANT: | 1808 case ObjectLiteral::Property::CONSTANT: |
| (...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3519 } | 3522 } |
| 3520 | 3523 |
| 3521 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { | 3524 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { |
| 3522 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict | 3525 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict |
| 3523 : Runtime::kStoreKeyedToSuper_Sloppy; | 3526 : Runtime::kStoreKeyedToSuper_Sloppy; |
| 3524 } | 3527 } |
| 3525 | 3528 |
| 3526 } // namespace interpreter | 3529 } // namespace interpreter |
| 3527 } // namespace internal | 3530 } // namespace internal |
| 3528 } // namespace v8 | 3531 } // namespace v8 |
| OLD | NEW |