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

Side by Side Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1106613003: [turbofan] Unify frame state inputs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comment. Created 5 years, 8 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/compiler/js-inlining.cc ('k') | src/compiler/js-type-feedback.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
2 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
3 // 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
4 // found in the LICENSE file. 3 // found in the LICENSE file.
5 4
6 #include "src/compiler/js-intrinsic-lowering.h" 5 #include "src/compiler/js-intrinsic-lowering.h"
7 6
8 #include <stack> 7 #include <stack>
9 8
10 #include "src/code-factory.h" 9 #include "src/code-factory.h"
11 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
12 #include "src/compiler/js-graph.h" 11 #include "src/compiler/js-graph.h"
13 #include "src/compiler/linkage.h" 12 #include "src/compiler/linkage.h"
14 #include "src/compiler/node-matchers.h" 13 #include "src/compiler/node-matchers.h"
15 #include "src/compiler/node-properties.h" 14 #include "src/compiler/node-properties.h"
15 #include "src/compiler/operator-properties.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 namespace compiler { 19 namespace compiler {
20 20
21 JSIntrinsicLowering::JSIntrinsicLowering(JSGraph* jsgraph) 21 JSIntrinsicLowering::JSIntrinsicLowering(JSGraph* jsgraph)
22 : jsgraph_(jsgraph), simplified_(jsgraph->zone()) {} 22 : jsgraph_(jsgraph), simplified_(jsgraph->zone()) {}
23 23
24 24
25 Reduction JSIntrinsicLowering::Reduce(Node* node) { 25 Reduction JSIntrinsicLowering::Reduce(Node* node) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 int flags = FastD2I(mflags.Value()); 107 int flags = FastD2I(mflags.Value());
108 108
109 // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the 109 // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the
110 // initial length limit for arrays with "fast" elements kind. 110 // initial length limit for arrays with "fast" elements kind.
111 if ((flags & ArrayLiteral::kShallowElements) != 0 && 111 if ((flags & ArrayLiteral::kShallowElements) != 0 &&
112 length < JSObject::kInitialMaxFastElementArray) { 112 length < JSObject::kInitialMaxFastElementArray) {
113 Isolate* isolate = jsgraph()->isolate(); 113 Isolate* isolate = jsgraph()->isolate();
114 Callable callable = CodeFactory::FastCloneShallowArray(isolate); 114 Callable callable = CodeFactory::FastCloneShallowArray(isolate);
115 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 115 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
116 isolate, graph()->zone(), callable.descriptor(), 0, 116 isolate, graph()->zone(), callable.descriptor(), 0,
117 FLAG_turbo_deoptimization ? CallDescriptor::kNeedsFrameState 117 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0)
118 : CallDescriptor::kNoFlags); 118 ? CallDescriptor::kNeedsFrameState
119 : CallDescriptor::kNoFlags);
119 const Operator* new_op = common()->Call(desc); 120 const Operator* new_op = common()->Call(desc);
120 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 121 Node* stub_code = jsgraph()->HeapConstant(callable.code());
121 node->RemoveInput(3); // Remove flags input from node. 122 node->RemoveInput(3); // Remove flags input from node.
122 node->InsertInput(graph()->zone(), 0, stub_code); 123 node->InsertInput(graph()->zone(), 0, stub_code);
123 node->set_op(new_op); 124 node->set_op(new_op);
124 return Changed(node); 125 return Changed(node);
125 } 126 }
126 127
127 return NoChange(); 128 return NoChange();
128 } 129 }
129 130
130 131
131 Reduction JSIntrinsicLowering::ReduceCreateObjectLiteral(Node* node) { 132 Reduction JSIntrinsicLowering::ReduceCreateObjectLiteral(Node* node) {
132 HeapObjectMatcher<FixedArray> mconst(NodeProperties::GetValueInput(node, 2)); 133 HeapObjectMatcher<FixedArray> mconst(NodeProperties::GetValueInput(node, 2));
133 NumberMatcher mflags(NodeProperties::GetValueInput(node, 3)); 134 NumberMatcher mflags(NodeProperties::GetValueInput(node, 3));
134 // Constants are pairs, see ObjectLiteral::properties_count(). 135 // Constants are pairs, see ObjectLiteral::properties_count().
135 int length = mconst.Value().handle()->length() / 2; 136 int length = mconst.Value().handle()->length() / 2;
136 int flags = FastD2I(mflags.Value()); 137 int flags = FastD2I(mflags.Value());
137 138
138 // Use the FastCloneShallowObjectStub only for shallow boilerplates without 139 // Use the FastCloneShallowObjectStub only for shallow boilerplates without
139 // elements up to the number of properties that the stubs can handle. 140 // elements up to the number of properties that the stubs can handle.
140 if ((flags & ObjectLiteral::kShallowProperties) != 0 && 141 if ((flags & ObjectLiteral::kShallowProperties) != 0 &&
141 length <= FastCloneShallowObjectStub::kMaximumClonedProperties) { 142 length <= FastCloneShallowObjectStub::kMaximumClonedProperties) {
142 Isolate* isolate = jsgraph()->isolate(); 143 Isolate* isolate = jsgraph()->isolate();
143 Callable callable = CodeFactory::FastCloneShallowObject(isolate, length); 144 Callable callable = CodeFactory::FastCloneShallowObject(isolate, length);
144 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 145 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
145 isolate, graph()->zone(), callable.descriptor(), 0, 146 isolate, graph()->zone(), callable.descriptor(), 0,
146 FLAG_turbo_deoptimization ? CallDescriptor::kNeedsFrameState 147 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0)
147 : CallDescriptor::kNoFlags); 148 ? CallDescriptor::kNeedsFrameState
149 : CallDescriptor::kNoFlags);
148 const Operator* new_op = common()->Call(desc); 150 const Operator* new_op = common()->Call(desc);
149 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 151 Node* stub_code = jsgraph()->HeapConstant(callable.code());
150 node->InsertInput(graph()->zone(), 0, stub_code); 152 node->InsertInput(graph()->zone(), 0, stub_code);
151 node->set_op(new_op); 153 node->set_op(new_op);
152 return Changed(node); 154 return Changed(node);
153 } 155 }
154 156
155 return NoChange(); 157 return NoChange();
156 } 158 }
157 159
158 160
159 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { 161 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
162 // TODO(jarin): This should not depend on the global flag.
160 if (!FLAG_turbo_deoptimization) return NoChange(); 163 if (!FLAG_turbo_deoptimization) return NoChange();
161 164
162 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); 165 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0);
163 DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState); 166 DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState);
164 167
165 Node* effect = NodeProperties::GetEffectInput(node); 168 Node* effect = NodeProperties::GetEffectInput(node);
166 Node* control = NodeProperties::GetControlInput(node); 169 Node* control = NodeProperties::GetControlInput(node);
167 170
168 // We are making the continuation after the call dead. To 171 // We are making the continuation after the call dead. To
169 // model this, we generate if (true) statement with deopt 172 // model this, we generate if (true) statement with deopt
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 } 489 }
487 490
488 491
489 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { 492 MachineOperatorBuilder* JSIntrinsicLowering::machine() const {
490 return jsgraph()->machine(); 493 return jsgraph()->machine();
491 } 494 }
492 495
493 } // namespace compiler 496 } // namespace compiler
494 } // namespace internal 497 } // namespace internal
495 } // namespace v8 498 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-inlining.cc ('k') | src/compiler/js-type-feedback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698