| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
| 6 | 6 |
| 7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
| 9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
| (...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 case ObjectLiteral::Property::PROTOTYPE: { | 1786 case ObjectLiteral::Property::PROTOTYPE: { |
| 1787 environment()->Push(environment()->Top()); // Duplicate receiver. | 1787 environment()->Push(environment()->Top()); // Duplicate receiver. |
| 1788 VisitForValue(property->value()); | 1788 VisitForValue(property->value()); |
| 1789 Node* value = environment()->Pop(); | 1789 Node* value = environment()->Pop(); |
| 1790 Node* receiver = environment()->Pop(); | 1790 Node* receiver = environment()->Pop(); |
| 1791 DCHECK(property->emit_store()); | 1791 DCHECK(property->emit_store()); |
| 1792 const Operator* op = | 1792 const Operator* op = |
| 1793 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); | 1793 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); |
| 1794 Node* set_prototype = NewNode(op, receiver, value); | 1794 Node* set_prototype = NewNode(op, receiver, value); |
| 1795 // SetPrototype should not lazy deopt on an object literal. | 1795 // SetPrototype should not lazy deopt on an object literal. |
| 1796 PrepareFrameState(set_prototype, BailoutId::None()); | 1796 PrepareFrameState(set_prototype, |
| 1797 expr->GetIdForPropertySet(property_index)); |
| 1797 break; | 1798 break; |
| 1798 } | 1799 } |
| 1799 case ObjectLiteral::Property::GETTER: | 1800 case ObjectLiteral::Property::GETTER: |
| 1800 if (property->emit_store()) { | 1801 if (property->emit_store()) { |
| 1801 accessor_table.lookup(key)->second->getter = property; | 1802 accessor_table.lookup(key)->second->getter = property; |
| 1802 } | 1803 } |
| 1803 break; | 1804 break; |
| 1804 case ObjectLiteral::Property::SETTER: | 1805 case ObjectLiteral::Property::SETTER: |
| 1805 if (property->emit_store()) { | 1806 if (property->emit_store()) { |
| 1806 accessor_table.lookup(key)->second->setter = property; | 1807 accessor_table.lookup(key)->second->setter = property; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1841 ObjectLiteral::Property* property = expr->properties()->at(property_index); | 1842 ObjectLiteral::Property* property = expr->properties()->at(property_index); |
| 1842 | 1843 |
| 1843 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { | 1844 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) { |
| 1844 environment()->Push(environment()->Top()); // Duplicate receiver. | 1845 environment()->Push(environment()->Top()); // Duplicate receiver. |
| 1845 VisitForValue(property->value()); | 1846 VisitForValue(property->value()); |
| 1846 Node* value = environment()->Pop(); | 1847 Node* value = environment()->Pop(); |
| 1847 Node* receiver = environment()->Pop(); | 1848 Node* receiver = environment()->Pop(); |
| 1848 const Operator* op = | 1849 const Operator* op = |
| 1849 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); | 1850 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); |
| 1850 Node* call = NewNode(op, receiver, value); | 1851 Node* call = NewNode(op, receiver, value); |
| 1851 PrepareFrameState(call, BailoutId::None()); | 1852 PrepareFrameState(call, expr->GetIdForPropertySet(property_index)); |
| 1852 continue; | 1853 continue; |
| 1853 } | 1854 } |
| 1854 | 1855 |
| 1855 environment()->Push(environment()->Top()); // Duplicate receiver. | 1856 environment()->Push(environment()->Top()); // Duplicate receiver. |
| 1856 VisitForValue(property->key()); | 1857 VisitForValue(property->key()); |
| 1857 Node* name = BuildToName(environment()->Pop(), | 1858 Node* name = BuildToName(environment()->Pop(), |
| 1858 expr->GetIdForProperty(property_index)); | 1859 expr->GetIdForPropertyName(property_index)); |
| 1859 environment()->Push(name); | 1860 environment()->Push(name); |
| 1860 VisitForValue(property->value()); | 1861 VisitForValue(property->value()); |
| 1861 Node* value = environment()->Pop(); | 1862 Node* value = environment()->Pop(); |
| 1862 Node* key = environment()->Pop(); | 1863 Node* key = environment()->Pop(); |
| 1863 Node* receiver = environment()->Pop(); | 1864 Node* receiver = environment()->Pop(); |
| 1864 BuildSetHomeObject(value, receiver, property); | 1865 BuildSetHomeObject(value, receiver, property); |
| 1865 switch (property->kind()) { | 1866 switch (property->kind()) { |
| 1866 case ObjectLiteral::Property::CONSTANT: | 1867 case ObjectLiteral::Property::CONSTANT: |
| 1867 case ObjectLiteral::Property::COMPUTED: | 1868 case ObjectLiteral::Property::COMPUTED: |
| 1868 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { | 1869 case ObjectLiteral::Property::MATERIALIZED_LITERAL: { |
| (...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4356 // Phi does not exist yet, introduce one. | 4357 // Phi does not exist yet, introduce one. |
| 4357 value = NewPhi(inputs, value, control); | 4358 value = NewPhi(inputs, value, control); |
| 4358 value->ReplaceInput(inputs - 1, other); | 4359 value->ReplaceInput(inputs - 1, other); |
| 4359 } | 4360 } |
| 4360 return value; | 4361 return value; |
| 4361 } | 4362 } |
| 4362 | 4363 |
| 4363 } // namespace compiler | 4364 } // namespace compiler |
| 4364 } // namespace internal | 4365 } // namespace internal |
| 4365 } // namespace v8 | 4366 } // namespace v8 |
| OLD | NEW |