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

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

Issue 1104453006: [turbofan] Introduce explicit JSCreateLiteral[Array|Object]. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 7 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 | « no previous file | src/compiler/js-generic-lowering.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/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 1653
1654 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { 1654 void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
1655 Node* closure = GetFunctionClosure(); 1655 Node* closure = GetFunctionClosure();
1656 1656
1657 // Create node to deep-copy the literal boilerplate. 1657 // Create node to deep-copy the literal boilerplate.
1658 expr->BuildConstantProperties(isolate()); 1658 expr->BuildConstantProperties(isolate());
1659 Node* literals_array = 1659 Node* literals_array =
1660 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); 1660 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset);
1661 Node* literal_index = jsgraph()->Constant(expr->literal_index()); 1661 Node* literal_index = jsgraph()->Constant(expr->literal_index());
1662 Node* constants = jsgraph()->Constant(expr->constant_properties()); 1662 Node* constants = jsgraph()->Constant(expr->constant_properties());
1663 Node* flags = jsgraph()->Constant(expr->ComputeFlags(true));
1664 const Operator* op = 1663 const Operator* op =
1665 javascript()->CallRuntime(Runtime::kInlineCreateObjectLiteral, 4); 1664 javascript()->CreateLiteralObject(expr->ComputeFlags(true));
1666 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); 1665 Node* literal = NewNode(op, literals_array, literal_index, constants);
1667 PrepareFrameState(literal, expr->CreateLiteralId(), 1666 PrepareFrameState(literal, expr->CreateLiteralId(),
1668 OutputFrameStateCombine::Push()); 1667 OutputFrameStateCombine::Push());
1669 1668
1670 // The object is expected on the operand stack during computation of the 1669 // The object is expected on the operand stack during computation of the
1671 // property values and is the value of the entire expression. 1670 // property values and is the value of the entire expression.
1672 environment()->Push(literal); 1671 environment()->Push(literal);
1673 1672
1674 // Mark all computed expressions that are bound to a key that is shadowed by 1673 // Mark all computed expressions that are bound to a key that is shadowed by
1675 // a later occurrence of the same key. For the marked expressions, no store 1674 // a later occurrence of the same key. For the marked expressions, no store
1676 // code is emitted. 1675 // code is emitted.
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 1844
1846 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) { 1845 void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
1847 Node* closure = GetFunctionClosure(); 1846 Node* closure = GetFunctionClosure();
1848 1847
1849 // Create node to deep-copy the literal boilerplate. 1848 // Create node to deep-copy the literal boilerplate.
1850 expr->BuildConstantElements(isolate()); 1849 expr->BuildConstantElements(isolate());
1851 Node* literals_array = 1850 Node* literals_array =
1852 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset); 1851 BuildLoadObjectField(closure, JSFunction::kLiteralsOffset);
1853 Node* literal_index = jsgraph()->Constant(expr->literal_index()); 1852 Node* literal_index = jsgraph()->Constant(expr->literal_index());
1854 Node* constants = jsgraph()->Constant(expr->constant_elements()); 1853 Node* constants = jsgraph()->Constant(expr->constant_elements());
1855 Node* flags = jsgraph()->Constant(expr->ComputeFlags(true));
1856 const Operator* op = 1854 const Operator* op =
1857 javascript()->CallRuntime(Runtime::kInlineCreateArrayLiteral, 4); 1855 javascript()->CreateLiteralArray(expr->ComputeFlags(true));
1858 Node* literal = NewNode(op, literals_array, literal_index, constants, flags); 1856 Node* literal = NewNode(op, literals_array, literal_index, constants);
1859 PrepareFrameState(literal, expr->CreateLiteralId(), 1857 PrepareFrameState(literal, expr->CreateLiteralId(),
1860 OutputFrameStateCombine::Push()); 1858 OutputFrameStateCombine::Push());
1861 1859
1862 // The array and the literal index are both expected on the operand stack 1860 // The array and the literal index are both expected on the operand stack
1863 // during computation of the element values. 1861 // during computation of the element values.
1864 environment()->Push(literal); 1862 environment()->Push(literal);
1865 environment()->Push(literal_index); 1863 environment()->Push(literal_index);
1866 1864
1867 // Create nodes to evaluate all the non-constant subexpressions and to store 1865 // Create nodes to evaluate all the non-constant subexpressions and to store
1868 // them into the newly cloned array. 1866 // them into the newly cloned array.
(...skipping 1713 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 // Phi does not exist yet, introduce one. 3580 // Phi does not exist yet, introduce one.
3583 value = NewPhi(inputs, value, control); 3581 value = NewPhi(inputs, value, control);
3584 value->ReplaceInput(inputs - 1, other); 3582 value->ReplaceInput(inputs - 1, other);
3585 } 3583 }
3586 return value; 3584 return value;
3587 } 3585 }
3588 3586
3589 } // namespace compiler 3587 } // namespace compiler
3590 } // namespace internal 3588 } // namespace internal
3591 } // namespace v8 3589 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/js-generic-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698