Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 2207413002: [turbofan] Fix missing bailout for accessors in literals. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/ast.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 const Operator* op = 1802 const Operator* op =
1803 javascript()->CallRuntime(Runtime::kInternalSetPrototype); 1803 javascript()->CallRuntime(Runtime::kInternalSetPrototype);
1804 Node* set_prototype = NewNode(op, receiver, value); 1804 Node* set_prototype = NewNode(op, receiver, value);
1805 // SetPrototype should not lazy deopt on an object literal. 1805 // SetPrototype should not lazy deopt on an object literal.
1806 PrepareFrameState(set_prototype, 1806 PrepareFrameState(set_prototype,
1807 expr->GetIdForPropertySet(property_index)); 1807 expr->GetIdForPropertySet(property_index));
1808 break; 1808 break;
1809 } 1809 }
1810 case ObjectLiteral::Property::GETTER: 1810 case ObjectLiteral::Property::GETTER:
1811 if (property->emit_store()) { 1811 if (property->emit_store()) {
1812 accessor_table.lookup(key)->second->getter = property; 1812 AccessorTable::Iterator it = accessor_table.lookup(key);
1813 it->second->bailout_id = expr->GetIdForPropertySet(property_index);
1814 it->second->getter = property;
1813 } 1815 }
1814 break; 1816 break;
1815 case ObjectLiteral::Property::SETTER: 1817 case ObjectLiteral::Property::SETTER:
1816 if (property->emit_store()) { 1818 if (property->emit_store()) {
1817 accessor_table.lookup(key)->second->setter = property; 1819 AccessorTable::Iterator it = accessor_table.lookup(key);
1820 it->second->bailout_id = expr->GetIdForPropertySet(property_index);
1821 it->second->setter = property;
1818 } 1822 }
1819 break; 1823 break;
1820 } 1824 }
1821 } 1825 }
1822 1826
1823 // Create nodes to define accessors, using only a single call to the runtime 1827 // Create nodes to define accessors, using only a single call to the runtime
1824 // for each pair of corresponding getters and setters. 1828 // for each pair of corresponding getters and setters.
1825 literal = environment()->Top(); // Reload from operand stack. 1829 literal = environment()->Top(); // Reload from operand stack.
1826 for (AccessorTable::Iterator it = accessor_table.begin(); 1830 for (AccessorTable::Iterator it = accessor_table.begin();
1827 it != accessor_table.end(); ++it) { 1831 it != accessor_table.end(); ++it) {
1828 VisitForValue(it->first); 1832 VisitForValue(it->first);
1829 VisitObjectLiteralAccessor(literal, it->second->getter); 1833 VisitObjectLiteralAccessor(literal, it->second->getter);
1830 VisitObjectLiteralAccessor(literal, it->second->setter); 1834 VisitObjectLiteralAccessor(literal, it->second->setter);
1831 Node* setter = environment()->Pop(); 1835 Node* setter = environment()->Pop();
1832 Node* getter = environment()->Pop(); 1836 Node* getter = environment()->Pop();
1833 Node* name = environment()->Pop(); 1837 Node* name = environment()->Pop();
1834 Node* attr = jsgraph()->Constant(NONE); 1838 Node* attr = jsgraph()->Constant(NONE);
1835 const Operator* op = 1839 const Operator* op =
1836 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked); 1840 javascript()->CallRuntime(Runtime::kDefineAccessorPropertyUnchecked);
1837 Node* call = NewNode(op, literal, name, getter, setter, attr); 1841 Node* call = NewNode(op, literal, name, getter, setter, attr);
1838 // This should not lazy deopt on a new literal. 1842 PrepareFrameState(call, it->second->bailout_id);
1839 PrepareFrameState(call, BailoutId::None());
1840 } 1843 }
1841 1844
1842 // Object literals have two parts. The "static" part on the left contains no 1845 // Object literals have two parts. The "static" part on the left contains no
1843 // computed property names, and so we can compute its map ahead of time; see 1846 // computed property names, and so we can compute its map ahead of time; see
1844 // Runtime_CreateObjectLiteralBoilerplate. The second "dynamic" part starts 1847 // Runtime_CreateObjectLiteralBoilerplate. The second "dynamic" part starts
1845 // with the first computed property name and continues with all properties to 1848 // with the first computed property name and continues with all properties to
1846 // its right. All the code from above initializes the static component of the 1849 // its right. All the code from above initializes the static component of the
1847 // object literal, and arranges for the map of the result to reflect the 1850 // object literal, and arranges for the map of the result to reflect the
1848 // static order in which the keys appear. For the dynamic properties, we 1851 // static order in which the keys appear. For the dynamic properties, we
1849 // compile them into a series of "SetOwnProperty" runtime calls. This will 1852 // compile them into a series of "SetOwnProperty" runtime calls. This will
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after
4317 // Phi does not exist yet, introduce one. 4320 // Phi does not exist yet, introduce one.
4318 value = NewPhi(inputs, value, control); 4321 value = NewPhi(inputs, value, control);
4319 value->ReplaceInput(inputs - 1, other); 4322 value->ReplaceInput(inputs - 1, other);
4320 } 4323 }
4321 return value; 4324 return value;
4322 } 4325 }
4323 4326
4324 } // namespace compiler 4327 } // namespace compiler
4325 } // namespace internal 4328 } // namespace internal
4326 } // namespace v8 4329 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698