| 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 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 const Operator* op = | 1837 const Operator* op = |
| 1838 javascript()->CallRuntime(Runtime::kInternalSetPrototype); | 1838 javascript()->CallRuntime(Runtime::kInternalSetPrototype); |
| 1839 Node* set_prototype = NewNode(op, receiver, value); | 1839 Node* set_prototype = NewNode(op, receiver, value); |
| 1840 // SetPrototype should not lazy deopt on an object literal. | 1840 // SetPrototype should not lazy deopt on an object literal. |
| 1841 PrepareFrameState(set_prototype, | 1841 PrepareFrameState(set_prototype, |
| 1842 expr->GetIdForPropertySet(property_index)); | 1842 expr->GetIdForPropertySet(property_index)); |
| 1843 break; | 1843 break; |
| 1844 } | 1844 } |
| 1845 case ObjectLiteral::Property::GETTER: | 1845 case ObjectLiteral::Property::GETTER: |
| 1846 if (property->emit_store()) { | 1846 if (property->emit_store()) { |
| 1847 accessor_table.lookup(key)->second->getter = property; | 1847 AccessorTable::Iterator it = accessor_table.lookup(key); |
| 1848 it->second->bailout_id = expr->GetIdForPropertySet(property_index); |
| 1849 it->second->getter = property; |
| 1848 } | 1850 } |
| 1849 break; | 1851 break; |
| 1850 case ObjectLiteral::Property::SETTER: | 1852 case ObjectLiteral::Property::SETTER: |
| 1851 if (property->emit_store()) { | 1853 if (property->emit_store()) { |
| 1852 accessor_table.lookup(key)->second->setter = property; | 1854 AccessorTable::Iterator it = accessor_table.lookup(key); |
| 1855 it->second->bailout_id = expr->GetIdForPropertySet(property_index); |
| 1856 it->second->setter = property; |
| 1853 } | 1857 } |
| 1854 break; | 1858 break; |
| 1855 } | 1859 } |
| 1856 } | 1860 } |
| 1857 | 1861 |
| 1858 // Create nodes to define accessors, using only a single call to the runtime | 1862 // Create nodes to define accessors, using only a single call to the runtime |
| 1859 // for each pair of corresponding getters and setters. | 1863 // for each pair of corresponding getters and setters. |
| 1860 literal = environment()->Top(); // Reload from operand stack. | 1864 literal = environment()->Top(); // Reload from operand stack. |
| 1861 for (AccessorTable::Iterator it = accessor_table.begin(); | 1865 for (AccessorTable::Iterator it = accessor_table.begin(); |
| 1862 it != accessor_table.end(); ++it) { | 1866 it != accessor_table.end(); ++it) { |
| 1863 VisitForValue(it->first); | 1867 VisitForValue(it->first); |
| 1864 VisitObjectLiteralAccessor(literal, it->second->getter); | 1868 VisitObjectLiteralAccessor(literal, it->second->getter); |
| 1865 VisitObjectLiteralAccessor(literal, it->second->setter); | 1869 VisitObjectLiteralAccessor(literal, it->second->setter); |
| 1866 Node* setter = environment()->Pop(); | 1870 Node* setter = environment()->Pop(); |
| 1867 Node* getter = environment()->Pop(); | 1871 Node* getter = environment()->Pop(); |
| 1868 Node* name = environment()->Pop(); | 1872 Node* name = environment()->Pop(); |
| 1869 Node* attr = jsgraph()->Constant(NONE); | 1873 Node* attr = jsgraph()->Constant(NONE); |
| 1870 const Operator* op = | 1874 const Operator* op = |
| 1871 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked); | 1875 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked); |
| 1872 Node* call = NewNode(op, literal, name, getter, setter, attr); | 1876 Node* call = NewNode(op, literal, name, getter, setter, attr); |
| 1873 // This should not lazy deopt on a new literal. | 1877 PrepareFrameState(call, it->second->bailout_id); |
| 1874 PrepareFrameState(call, BailoutId::None()); | |
| 1875 } | 1878 } |
| 1876 | 1879 |
| 1877 // Object literals have two parts. The "static" part on the left contains no | 1880 // Object literals have two parts. The "static" part on the left contains no |
| 1878 // computed property names, and so we can compute its map ahead of time; see | 1881 // computed property names, and so we can compute its map ahead of time; see |
| 1879 // Runtime_CreateObjectLiteralBoilerplate. The second "dynamic" part starts | 1882 // Runtime_CreateObjectLiteralBoilerplate. The second "dynamic" part starts |
| 1880 // with the first computed property name and continues with all properties to | 1883 // with the first computed property name and continues with all properties to |
| 1881 // its right. All the code from above initializes the static component of the | 1884 // its right. All the code from above initializes the static component of the |
| 1882 // object literal, and arranges for the map of the result to reflect the | 1885 // object literal, and arranges for the map of the result to reflect the |
| 1883 // static order in which the keys appear. For the dynamic properties, we | 1886 // static order in which the keys appear. For the dynamic properties, we |
| 1884 // compile them into a series of "SetOwnProperty" runtime calls. This will | 1887 // compile them into a series of "SetOwnProperty" runtime calls. This will |
| (...skipping 2503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4388 // Phi does not exist yet, introduce one. | 4391 // Phi does not exist yet, introduce one. |
| 4389 value = NewPhi(inputs, value, control); | 4392 value = NewPhi(inputs, value, control); |
| 4390 value->ReplaceInput(inputs - 1, other); | 4393 value->ReplaceInput(inputs - 1, other); |
| 4391 } | 4394 } |
| 4392 return value; | 4395 return value; |
| 4393 } | 4396 } |
| 4394 | 4397 |
| 4395 } // namespace compiler | 4398 } // namespace compiler |
| 4396 } // namespace internal | 4399 } // namespace internal |
| 4397 } // namespace v8 | 4400 } // namespace v8 |
| OLD | NEW |