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

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

Issue 1676883002: [runtime] Optimize and unify rest parameters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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/compiler/bytecode-graph-builder.h" 5 #include "src/compiler/bytecode-graph-builder.h"
6 6
7 #include "src/compiler/bytecode-branch-analysis.h" 7 #include "src/compiler/bytecode-branch-analysis.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/operator-properties.h" 9 #include "src/compiler/operator-properties.h"
10 #include "src/interpreter/bytecodes.h" 10 #include "src/interpreter/bytecodes.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 bytecode_iterator().GetConstantForIndexOperand(0)); 988 bytecode_iterator().GetConstantForIndexOperand(0));
989 PretenureFlag tenured = 989 PretenureFlag tenured =
990 bytecode_iterator().GetImmediateOperand(1) ? TENURED : NOT_TENURED; 990 bytecode_iterator().GetImmediateOperand(1) ? TENURED : NOT_TENURED;
991 const Operator* op = javascript()->CreateClosure(shared_info, tenured); 991 const Operator* op = javascript()->CreateClosure(shared_info, tenured);
992 Node* closure = NewNode(op); 992 Node* closure = NewNode(op);
993 environment()->BindAccumulator(closure); 993 environment()->BindAccumulator(closure);
994 } 994 }
995 995
996 void BytecodeGraphBuilder::VisitCreateClosureWide() { VisitCreateClosure(); } 996 void BytecodeGraphBuilder::VisitCreateClosureWide() { VisitCreateClosure(); }
997 997
998 void BytecodeGraphBuilder::BuildCreateArguments( 998 void BytecodeGraphBuilder::BuildCreateArguments(CreateArgumentsType type) {
999 CreateArgumentsParameters::Type type, int rest_index) {
1000 FrameStateBeforeAndAfter states(this); 999 FrameStateBeforeAndAfter states(this);
1001 const Operator* op = javascript()->CreateArguments(type, rest_index); 1000 const Operator* op = javascript()->CreateArguments(type);
1002 Node* object = NewNode(op, GetFunctionClosure()); 1001 Node* object = NewNode(op, GetFunctionClosure());
1003 environment()->BindAccumulator(object, &states); 1002 environment()->BindAccumulator(object, &states);
1004 } 1003 }
1005 1004
1006 void BytecodeGraphBuilder::VisitCreateMappedArguments() { 1005 void BytecodeGraphBuilder::VisitCreateMappedArguments() {
1007 BuildCreateArguments(CreateArgumentsParameters::kMappedArguments, 0); 1006 BuildCreateArguments(CreateArgumentsType::kMappedArguments);
1008 } 1007 }
1009 1008
1010 void BytecodeGraphBuilder::VisitCreateUnmappedArguments() { 1009 void BytecodeGraphBuilder::VisitCreateUnmappedArguments() {
1011 BuildCreateArguments(CreateArgumentsParameters::kUnmappedArguments, 0); 1010 BuildCreateArguments(CreateArgumentsType::kUnmappedArguments);
1012 } 1011 }
1013 1012
1014 void BytecodeGraphBuilder::VisitCreateRestArguments() { 1013 void BytecodeGraphBuilder::VisitCreateRestParameter() {
1015 int index = 1014 BuildCreateArguments(CreateArgumentsType::kRestParameter);
1016 Smi::cast(*bytecode_iterator().GetConstantForIndexOperand(0))->value();
1017 BuildCreateArguments(CreateArgumentsParameters::kRestArray, index);
1018 } 1015 }
1019 1016
1020 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) { 1017 void BytecodeGraphBuilder::BuildCreateLiteral(const Operator* op) {
1021 FrameStateBeforeAndAfter states(this); 1018 FrameStateBeforeAndAfter states(this);
1022 Node* literal = NewNode(op, GetFunctionClosure()); 1019 Node* literal = NewNode(op, GetFunctionClosure());
1023 environment()->BindAccumulator(literal, &states); 1020 environment()->BindAccumulator(literal, &states);
1024 } 1021 }
1025 1022
1026 void BytecodeGraphBuilder::BuildCreateRegExpLiteral() { 1023 void BytecodeGraphBuilder::BuildCreateRegExpLiteral() {
1027 Handle<String> constant_pattern = 1024 Handle<String> constant_pattern =
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 // Phi does not exist yet, introduce one. 1832 // Phi does not exist yet, introduce one.
1836 value = NewPhi(inputs, value, control); 1833 value = NewPhi(inputs, value, control);
1837 value->ReplaceInput(inputs - 1, other); 1834 value->ReplaceInput(inputs - 1, other);
1838 } 1835 }
1839 return value; 1836 return value;
1840 } 1837 }
1841 1838
1842 } // namespace compiler 1839 } // namespace compiler
1843 } // namespace internal 1840 } // namespace internal
1844 } // namespace v8 1841 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698