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

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

Issue 565893002: Cleanup and simplify TurboFan generic lowering. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
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/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/js-generic-lowering.h" 9 #include "src/compiler/js-generic-lowering.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
11 #include "src/compiler/node-aux-data-inl.h" 11 #include "src/compiler/node-aux-data-inl.h"
12 #include "src/compiler/node-properties-inl.h" 12 #include "src/compiler/node-properties-inl.h"
13 #include "src/unique.h" 13 #include "src/unique.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 namespace compiler { 17 namespace compiler {
18 18
19 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph, 19 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph)
20 MachineOperatorBuilder* machine)
21 : info_(info), 20 : info_(info),
22 jsgraph_(jsgraph), 21 jsgraph_(jsgraph),
23 linkage_(new (jsgraph->zone()) Linkage(info)), 22 linkage_(new (jsgraph->zone()) Linkage(info)) {}
24 machine_(machine) {}
25 23
26 24
27 void JSGenericLowering::PatchOperator(Node* node, const Operator* op) { 25 void JSGenericLowering::PatchOperator(Node* node, const Operator* op) {
28 node->set_op(op); 26 node->set_op(op);
29 } 27 }
30 28
31 29
32 void JSGenericLowering::PatchInsertInput(Node* node, int index, Node* input) { 30 void JSGenericLowering::PatchInsertInput(Node* node, int index, Node* input) {
33 node->InsertInput(zone(), index, input); 31 node->InsertInput(zone(), index, input);
34 } 32 }
(...skipping 18 matching lines...) Expand all
53 return jsgraph()->HeapConstant(function); 51 return jsgraph()->HeapConstant(function);
54 } 52 }
55 53
56 54
57 Node* JSGenericLowering::ExternalConstant(ExternalReference ref) { 55 Node* JSGenericLowering::ExternalConstant(ExternalReference ref) {
58 return jsgraph()->ExternalConstant(ref); 56 return jsgraph()->ExternalConstant(ref);
59 } 57 }
60 58
61 59
62 Reduction JSGenericLowering::Reduce(Node* node) { 60 Reduction JSGenericLowering::Reduce(Node* node) {
63 Node* replacement = NULL;
64 // Dispatch according to the opcode.
65 switch (node->opcode()) { 61 switch (node->opcode()) {
66 #define DECLARE_CASE(x) \ 62 #define DECLARE_CASE(x) \
67 case IrOpcode::k##x: \ 63 case IrOpcode::k##x: \
68 replacement = Lower##x(node); \ 64 Lower##x(node); \
69 break; 65 break;
70 DECLARE_CASE(Branch) 66 DECLARE_CASE(Branch)
71 JS_OP_LIST(DECLARE_CASE) 67 JS_OP_LIST(DECLARE_CASE)
72 #undef DECLARE_CASE 68 #undef DECLARE_CASE
73 default: 69 default:
74 // Nothing to see. 70 // Nothing to see.
75 return NoChange(); 71 return NoChange();
76 } 72 }
77 DCHECK_EQ(node, replacement); 73 return Changed(node);
78 return Changed(replacement);
79 } 74 }
80 75
81 76
82 #define REPLACE_BINARY_OP_IC_CALL(op, token) \ 77 #define REPLACE_BINARY_OP_IC_CALL(op, token) \
83 Node* JSGenericLowering::Lower##op(Node* node) { \ 78 void JSGenericLowering::Lower##op(Node* node) { \
84 ReplaceWithStubCall(node, CodeFactory::BinaryOpIC(isolate(), token), \ 79 ReplaceWithStubCall(node, CodeFactory::BinaryOpIC(isolate(), token), \
85 CallDescriptor::kPatchableCallSiteWithNop); \ 80 CallDescriptor::kPatchableCallSiteWithNop); \
86 return node; \
87 } 81 }
88 REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR) 82 REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR)
89 REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR) 83 REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR)
90 REPLACE_BINARY_OP_IC_CALL(JSBitwiseAnd, Token::BIT_AND) 84 REPLACE_BINARY_OP_IC_CALL(JSBitwiseAnd, Token::BIT_AND)
91 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL) 85 REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL)
92 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR) 86 REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR)
93 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR) 87 REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR)
94 REPLACE_BINARY_OP_IC_CALL(JSAdd, Token::ADD) 88 REPLACE_BINARY_OP_IC_CALL(JSAdd, Token::ADD)
95 REPLACE_BINARY_OP_IC_CALL(JSSubtract, Token::SUB) 89 REPLACE_BINARY_OP_IC_CALL(JSSubtract, Token::SUB)
96 REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL) 90 REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL)
97 REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV) 91 REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV)
98 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD) 92 REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD)
99 #undef REPLACE_BINARY_OP_IC_CALL 93 #undef REPLACE_BINARY_OP_IC_CALL
100 94
101 95
102 #define REPLACE_FACTORY_CALL(op, FactoryDeclaration) \ 96 #define REPLACE_COMPARE_IC_CALL(op, token, pure) \
103 Node* JSGenericLowering::Lower##op(Node* node) { \ 97 void JSGenericLowering::Lower##op(Node* node) { \
104 Callable callable = FactoryDeclaration; \ 98 ReplaceWithCompareIC(node, token, pure); \
105 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags); \
106 return node; \
107 }
108 REPLACE_FACTORY_CALL(JSToNumber, CodeFactory::ToNumber(isolate()))
109 #undef REPLACE_FACTORY_CALL
110
111
112 #define REPLACE_COMPARE_IC_CALL(op, token, pure) \
113 Node* JSGenericLowering::Lower##op(Node* node) { \
114 ReplaceWithCompareIC(node, token, pure); \
115 return node; \
116 } 99 }
117 REPLACE_COMPARE_IC_CALL(JSEqual, Token::EQ, false) 100 REPLACE_COMPARE_IC_CALL(JSEqual, Token::EQ, false)
118 REPLACE_COMPARE_IC_CALL(JSNotEqual, Token::NE, false) 101 REPLACE_COMPARE_IC_CALL(JSNotEqual, Token::NE, false)
119 REPLACE_COMPARE_IC_CALL(JSStrictEqual, Token::EQ_STRICT, true) 102 REPLACE_COMPARE_IC_CALL(JSStrictEqual, Token::EQ_STRICT, true)
120 REPLACE_COMPARE_IC_CALL(JSStrictNotEqual, Token::NE_STRICT, true) 103 REPLACE_COMPARE_IC_CALL(JSStrictNotEqual, Token::NE_STRICT, true)
121 REPLACE_COMPARE_IC_CALL(JSLessThan, Token::LT, false) 104 REPLACE_COMPARE_IC_CALL(JSLessThan, Token::LT, false)
122 REPLACE_COMPARE_IC_CALL(JSGreaterThan, Token::GT, false) 105 REPLACE_COMPARE_IC_CALL(JSGreaterThan, Token::GT, false)
123 REPLACE_COMPARE_IC_CALL(JSLessThanOrEqual, Token::LTE, false) 106 REPLACE_COMPARE_IC_CALL(JSLessThanOrEqual, Token::LTE, false)
124 REPLACE_COMPARE_IC_CALL(JSGreaterThanOrEqual, Token::GTE, false) 107 REPLACE_COMPARE_IC_CALL(JSGreaterThanOrEqual, Token::GTE, false)
125 #undef REPLACE_COMPARE_IC_CALL 108 #undef REPLACE_COMPARE_IC_CALL
126 109
127 110
128 #define REPLACE_RUNTIME_CALL(op, fun) \ 111 #define REPLACE_RUNTIME_CALL(op, fun) \
129 Node* JSGenericLowering::Lower##op(Node* node) { \ 112 void JSGenericLowering::Lower##op(Node* node) { \
130 ReplaceWithRuntimeCall(node, fun); \ 113 ReplaceWithRuntimeCall(node, fun); \
131 return node; \
132 } 114 }
133 REPLACE_RUNTIME_CALL(JSTypeOf, Runtime::kTypeof) 115 REPLACE_RUNTIME_CALL(JSTypeOf, Runtime::kTypeof)
134 REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort) 116 REPLACE_RUNTIME_CALL(JSCreate, Runtime::kAbort)
135 REPLACE_RUNTIME_CALL(JSCreateFunctionContext, Runtime::kNewFunctionContext) 117 REPLACE_RUNTIME_CALL(JSCreateFunctionContext, Runtime::kNewFunctionContext)
136 REPLACE_RUNTIME_CALL(JSCreateCatchContext, Runtime::kPushCatchContext) 118 REPLACE_RUNTIME_CALL(JSCreateCatchContext, Runtime::kPushCatchContext)
137 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext) 119 REPLACE_RUNTIME_CALL(JSCreateWithContext, Runtime::kPushWithContext)
138 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext) 120 REPLACE_RUNTIME_CALL(JSCreateBlockContext, Runtime::kPushBlockContext)
139 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext) 121 REPLACE_RUNTIME_CALL(JSCreateModuleContext, Runtime::kPushModuleContext)
140 REPLACE_RUNTIME_CALL(JSCreateGlobalContext, Runtime::kAbort) 122 REPLACE_RUNTIME_CALL(JSCreateGlobalContext, Runtime::kAbort)
141 #undef REPLACE_RUNTIME 123 #undef REPLACE_RUNTIME
142 124
143 125
144 #define REPLACE_UNIMPLEMENTED(op) \ 126 #define REPLACE_UNIMPLEMENTED(op) \
145 Node* JSGenericLowering::Lower##op(Node* node) { \ 127 void JSGenericLowering::Lower##op(Node* node) { UNIMPLEMENTED(); }
146 UNIMPLEMENTED(); \
147 return node; \
148 }
149 REPLACE_UNIMPLEMENTED(JSToName) 128 REPLACE_UNIMPLEMENTED(JSToName)
150 REPLACE_UNIMPLEMENTED(JSYield) 129 REPLACE_UNIMPLEMENTED(JSYield)
151 REPLACE_UNIMPLEMENTED(JSDebugger) 130 REPLACE_UNIMPLEMENTED(JSDebugger)
152 #undef REPLACE_UNIMPLEMENTED 131 #undef REPLACE_UNIMPLEMENTED
153 132
154 133
155 static CallDescriptor::Flags FlagsForNode(Node* node) { 134 static CallDescriptor::Flags FlagsForNode(Node* node) {
156 CallDescriptor::Flags result = CallDescriptor::kNoFlags; 135 CallDescriptor::Flags result = CallDescriptor::kNoFlags;
157 if (OperatorProperties::HasFrameStateInput(node->op())) { 136 if (OperatorProperties::HasFrameStateInput(node->op())) {
158 result |= CallDescriptor::kNeedsFrameState; 137 result |= CallDescriptor::kNeedsFrameState;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (!centrystub_constant_.is_set()) { 232 if (!centrystub_constant_.is_set()) {
254 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode())); 233 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode()));
255 } 234 }
256 PatchInsertInput(node, 0, centrystub_constant_.get()); 235 PatchInsertInput(node, 0, centrystub_constant_.get());
257 PatchInsertInput(node, nargs + 1, ref); 236 PatchInsertInput(node, nargs + 1, ref);
258 PatchInsertInput(node, nargs + 2, arity); 237 PatchInsertInput(node, nargs + 2, arity);
259 PatchOperator(node, common()->Call(desc)); 238 PatchOperator(node, common()->Call(desc));
260 } 239 }
261 240
262 241
263 Node* JSGenericLowering::LowerBranch(Node* node) { 242 void JSGenericLowering::LowerBranch(Node* node) {
264 if (!info()->is_typing_enabled()) { 243 if (!info()->is_typing_enabled()) {
265 // TODO(mstarzinger): If typing is enabled then simplified lowering will 244 // TODO(mstarzinger): If typing is enabled then simplified lowering will
266 // have inserted the correct ChangeBoolToBit, otherwise we need to perform 245 // have inserted the correct ChangeBoolToBit, otherwise we need to perform
267 // poor-man's representation inference here and insert manual change. 246 // poor-man's representation inference here and insert manual change.
268 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0), 247 Node* test = graph()->NewNode(machine()->WordEqual(), node->InputAt(0),
269 jsgraph()->TrueConstant()); 248 jsgraph()->TrueConstant());
270 node->ReplaceInput(0, test); 249 node->ReplaceInput(0, test);
271 } 250 }
272 return node;
273 } 251 }
274 252
275 253
276 Node* JSGenericLowering::LowerJSUnaryNot(Node* node) { 254 void JSGenericLowering::LowerJSUnaryNot(Node* node) {
277 Callable callable = CodeFactory::ToBoolean( 255 Callable callable = CodeFactory::ToBoolean(
278 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL); 256 isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
279 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 257 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
280 return node;
281 } 258 }
282 259
283 260
284 Node* JSGenericLowering::LowerJSToBoolean(Node* node) { 261 void JSGenericLowering::LowerJSToBoolean(Node* node) {
285 Callable callable = 262 Callable callable =
286 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL); 263 CodeFactory::ToBoolean(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
287 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 264 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
288 return node;
289 } 265 }
290 266
291 267
292 Node* JSGenericLowering::LowerJSToString(Node* node) { 268 void JSGenericLowering::LowerJSToNumber(Node* node) {
293 ReplaceWithBuiltinCall(node, Builtins::TO_STRING, 1); 269 Callable callable = CodeFactory::ToNumber(isolate());
294 return node; 270 ReplaceWithStubCall(node, callable, CallDescriptor::kNoFlags);
295 } 271 }
296 272
297 273
298 Node* JSGenericLowering::LowerJSToObject(Node* node) { 274 void JSGenericLowering::LowerJSToString(Node* node) {
299 ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1); 275 ReplaceWithBuiltinCall(node, Builtins::TO_STRING, 1);
300 return node;
301 } 276 }
302 277
303 278
304 Node* JSGenericLowering::LowerJSLoadProperty(Node* node) { 279 void JSGenericLowering::LowerJSToObject(Node* node) {
305 Callable callable = CodeFactory::KeyedLoadIC(isolate()); 280 ReplaceWithBuiltinCall(node, Builtins::TO_OBJECT, 1);
306 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
307 return node;
308 } 281 }
309 282
310 283
311 Node* JSGenericLowering::LowerJSLoadNamed(Node* node) { 284 void JSGenericLowering::LowerJSLoadProperty(Node* node) {
312 LoadNamedParameters p = OpParameter<LoadNamedParameters>(node); 285 Callable callable = CodeFactory::KeyedLoadIC(isolate());
313 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name));
314 Callable callable = CodeFactory::LoadIC(isolate(), p.contextual_mode);
315 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 286 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
316 return node;
317 } 287 }
318 288
319 289
320 Node* JSGenericLowering::LowerJSStoreProperty(Node* node) { 290 void JSGenericLowering::LowerJSLoadNamed(Node* node) {
291 LoadNamedParameters p = OpParameter<LoadNamedParameters>(node);
292 Callable callable = CodeFactory::LoadIC(isolate(), p.contextual_mode);
293 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name));
294 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
295 }
296
297
298 void JSGenericLowering::LowerJSStoreProperty(Node* node) {
321 StrictMode strict_mode = OpParameter<StrictMode>(node); 299 StrictMode strict_mode = OpParameter<StrictMode>(node);
322 Callable callable = CodeFactory::KeyedStoreIC(isolate(), strict_mode); 300 Callable callable = CodeFactory::KeyedStoreIC(isolate(), strict_mode);
323 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 301 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
324 return node;
325 } 302 }
326 303
327 304
328 Node* JSGenericLowering::LowerJSStoreNamed(Node* node) { 305 void JSGenericLowering::LowerJSStoreNamed(Node* node) {
329 StoreNamedParameters params = OpParameter<StoreNamedParameters>(node); 306 StoreNamedParameters params = OpParameter<StoreNamedParameters>(node);
330 Callable callable = CodeFactory::StoreIC(isolate(), params.strict_mode); 307 Callable callable = CodeFactory::StoreIC(isolate(), params.strict_mode);
331 PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name)); 308 PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name));
332 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 309 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
333 return node;
334 } 310 }
335 311
336 312
337 Node* JSGenericLowering::LowerJSDeleteProperty(Node* node) { 313 void JSGenericLowering::LowerJSDeleteProperty(Node* node) {
338 StrictMode strict_mode = OpParameter<StrictMode>(node); 314 StrictMode strict_mode = OpParameter<StrictMode>(node);
339 PatchInsertInput(node, 2, SmiConstant(strict_mode)); 315 PatchInsertInput(node, 2, SmiConstant(strict_mode));
340 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3); 316 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3);
341 return node;
342 } 317 }
343 318
344 319
345 Node* JSGenericLowering::LowerJSHasProperty(Node* node) { 320 void JSGenericLowering::LowerJSHasProperty(Node* node) {
346 ReplaceWithBuiltinCall(node, Builtins::IN, 2); 321 ReplaceWithBuiltinCall(node, Builtins::IN, 2);
347 return node;
348 } 322 }
349 323
350 324
351 Node* JSGenericLowering::LowerJSInstanceOf(Node* node) { 325 void JSGenericLowering::LowerJSInstanceOf(Node* node) {
352 InstanceofStub::Flags flags = static_cast<InstanceofStub::Flags>( 326 InstanceofStub::Flags flags = static_cast<InstanceofStub::Flags>(
353 InstanceofStub::kReturnTrueFalseObject | 327 InstanceofStub::kReturnTrueFalseObject |
354 InstanceofStub::kArgsInRegisters); 328 InstanceofStub::kArgsInRegisters);
355 InstanceofStub stub(isolate(), flags); 329 InstanceofStub stub(isolate(), flags);
356 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 330 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
357 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0); 331 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, 0);
358 Node* stub_code = CodeConstant(stub.GetCode()); 332 Node* stub_code = CodeConstant(stub.GetCode());
359 PatchInsertInput(node, 0, stub_code); 333 PatchInsertInput(node, 0, stub_code);
360 PatchOperator(node, common()->Call(desc)); 334 PatchOperator(node, common()->Call(desc));
361 return node;
362 } 335 }
363 336
364 337
365 Node* JSGenericLowering::LowerJSLoadContext(Node* node) { 338 void JSGenericLowering::LowerJSLoadContext(Node* node) {
366 ContextAccess access = OpParameter<ContextAccess>(node); 339 ContextAccess access = OpParameter<ContextAccess>(node);
367 // TODO(mstarzinger): Use simplified operators instead of machine operators 340 // TODO(mstarzinger): Use simplified operators instead of machine operators
368 // here so that load/store optimization can be applied afterwards. 341 // here so that load/store optimization can be applied afterwards.
369 for (int i = 0; i < access.depth(); ++i) { 342 for (int i = 0; i < access.depth(); ++i) {
370 node->ReplaceInput( 343 node->ReplaceInput(
371 0, graph()->NewNode( 344 0, graph()->NewNode(
372 machine()->Load(kMachAnyTagged), 345 machine()->Load(kMachAnyTagged),
373 NodeProperties::GetValueInput(node, 0), 346 NodeProperties::GetValueInput(node, 0),
374 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), 347 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
375 NodeProperties::GetEffectInput(node))); 348 NodeProperties::GetEffectInput(node)));
376 } 349 }
377 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); 350 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
378 PatchOperator(node, machine()->Load(kMachAnyTagged)); 351 PatchOperator(node, machine()->Load(kMachAnyTagged));
379 return node;
380 } 352 }
381 353
382 354
383 Node* JSGenericLowering::LowerJSStoreContext(Node* node) { 355 void JSGenericLowering::LowerJSStoreContext(Node* node) {
384 ContextAccess access = OpParameter<ContextAccess>(node); 356 ContextAccess access = OpParameter<ContextAccess>(node);
385 // TODO(mstarzinger): Use simplified operators instead of machine operators 357 // TODO(mstarzinger): Use simplified operators instead of machine operators
386 // here so that load/store optimization can be applied afterwards. 358 // here so that load/store optimization can be applied afterwards.
387 for (int i = 0; i < access.depth(); ++i) { 359 for (int i = 0; i < access.depth(); ++i) {
388 node->ReplaceInput( 360 node->ReplaceInput(
389 0, graph()->NewNode( 361 0, graph()->NewNode(
390 machine()->Load(kMachAnyTagged), 362 machine()->Load(kMachAnyTagged),
391 NodeProperties::GetValueInput(node, 0), 363 NodeProperties::GetValueInput(node, 0),
392 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), 364 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
393 NodeProperties::GetEffectInput(node))); 365 NodeProperties::GetEffectInput(node)));
394 } 366 }
395 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); 367 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
396 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); 368 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
397 PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged, 369 PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged,
398 kFullWriteBarrier))); 370 kFullWriteBarrier)));
399 return node;
400 } 371 }
401 372
402 373
403 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { 374 void JSGenericLowering::LowerJSCallConstruct(Node* node) {
404 int arity = OpParameter<int>(node); 375 int arity = OpParameter<int>(node);
405 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); 376 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS);
406 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 377 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
407 CallDescriptor* desc = 378 CallDescriptor* desc =
408 linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node)); 379 linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node));
409 Node* stub_code = CodeConstant(stub.GetCode()); 380 Node* stub_code = CodeConstant(stub.GetCode());
410 Node* construct = NodeProperties::GetValueInput(node, 0); 381 Node* construct = NodeProperties::GetValueInput(node, 0);
411 PatchInsertInput(node, 0, stub_code); 382 PatchInsertInput(node, 0, stub_code);
412 PatchInsertInput(node, 1, Int32Constant(arity - 1)); 383 PatchInsertInput(node, 1, Int32Constant(arity - 1));
413 PatchInsertInput(node, 2, construct); 384 PatchInsertInput(node, 2, construct);
414 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); 385 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant());
415 PatchOperator(node, common()->Call(desc)); 386 PatchOperator(node, common()->Call(desc));
416 return node;
417 } 387 }
418 388
419 389
420 Node* JSGenericLowering::LowerJSCallFunction(Node* node) { 390 void JSGenericLowering::LowerJSCallFunction(Node* node) {
421 CallParameters p = OpParameter<CallParameters>(node); 391 CallParameters p = OpParameter<CallParameters>(node);
422 CallFunctionStub stub(isolate(), p.arity - 2, p.flags); 392 CallFunctionStub stub(isolate(), p.arity - 2, p.flags);
423 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 393 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
424 CallDescriptor* desc = 394 CallDescriptor* desc =
425 linkage()->GetStubCallDescriptor(d, p.arity - 1, FlagsForNode(node)); 395 linkage()->GetStubCallDescriptor(d, p.arity - 1, FlagsForNode(node));
426 Node* stub_code = CodeConstant(stub.GetCode()); 396 Node* stub_code = CodeConstant(stub.GetCode());
427 PatchInsertInput(node, 0, stub_code); 397 PatchInsertInput(node, 0, stub_code);
428 PatchOperator(node, common()->Call(desc)); 398 PatchOperator(node, common()->Call(desc));
429 return node;
430 } 399 }
431 400
432 401
433 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { 402 void JSGenericLowering::LowerJSCallRuntime(Node* node) {
434 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 403 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
435 int arity = OperatorProperties::GetValueInputCount(node->op()); 404 int arity = OperatorProperties::GetValueInputCount(node->op());
436 ReplaceWithRuntimeCall(node, function, arity); 405 ReplaceWithRuntimeCall(node, function, arity);
437 return node;
438 } 406 }
439 407
440 } // namespace compiler 408 } // namespace compiler
441 } // namespace internal 409 } // namespace internal
442 } // namespace v8 410 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698