OLD | NEW |
---|---|
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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-typed-lowering.h" | 7 #include "src/compiler/js-typed-lowering.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/operator-properties.h" | 10 #include "src/compiler/operator-properties.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
338 } | 338 } |
339 #endif | 339 #endif |
340 return NoChange(); | 340 return NoChange(); |
341 } | 341 } |
342 | 342 |
343 | 343 |
344 Reduction JSTypedLowering::ReduceNumberBinop(Node* node, | 344 Reduction JSTypedLowering::ReduceNumberBinop(Node* node, |
345 const Operator* numberOp) { | 345 const Operator* numberOp) { |
346 JSBinopReduction r(this, node); | 346 JSBinopReduction r(this, node); |
347 if (is_strong(OpParameter<LanguageMode>(node))) { | 347 if (is_strong(OpParameter<LanguageMode>(node))) { |
348 if (r.left_type()->Is(Type::Number()) && | 348 if (r.BothInputsAre(Type::Number())) { |
349 (r.right_type()->Is(Type::Number()))) { | |
350 return r.ChangeToPureOperator(numberOp, Type::Number()); | 349 return r.ChangeToPureOperator(numberOp, Type::Number()); |
351 } | 350 } |
352 return NoChange(); | 351 return NoChange(); |
353 } | 352 } |
354 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | 353 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); |
355 r.ConvertInputsToNumber(frame_state); | 354 r.ConvertInputsToNumber(frame_state); |
356 return r.ChangeToPureOperator(numberOp, Type::Number()); | 355 return r.ChangeToPureOperator(numberOp, Type::Number()); |
357 } | 356 } |
358 | 357 |
359 | 358 |
360 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) { | 359 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) { |
361 JSBinopReduction r(this, node); | 360 JSBinopReduction r(this, node); |
361 if (is_strong(OpParameter<LanguageMode>(node))) { | |
362 if (r.BothInputsAre(Type::Number())) { | |
arv (Not doing code reviews)
2015/04/24 15:39:42
Let me make sure I understand this. If the operand
conradw
2015/04/27 11:20:47
Yes. Without this case the Binop call could be low
| |
363 r.ConvertInputsToUI32(kSigned, kSigned); | |
364 return r.ChangeToPureOperator(intOp, Type::Integral32()); | |
365 } | |
366 return NoChange(); | |
367 } | |
362 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | 368 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); |
363 r.ConvertInputsToNumber(frame_state); | 369 r.ConvertInputsToNumber(frame_state); |
364 r.ConvertInputsToUI32(kSigned, kSigned); | 370 r.ConvertInputsToUI32(kSigned, kSigned); |
365 return r.ChangeToPureOperator(intOp, Type::Integral32()); | 371 return r.ChangeToPureOperator(intOp, Type::Integral32()); |
366 } | 372 } |
367 | 373 |
368 | 374 |
369 Reduction JSTypedLowering::ReduceUI32Shift(Node* node, | 375 Reduction JSTypedLowering::ReduceUI32Shift(Node* node, |
370 Signedness left_signedness, | 376 Signedness left_signedness, |
371 const Operator* shift_op) { | 377 const Operator* shift_op) { |
372 JSBinopReduction r(this, node); | 378 JSBinopReduction r(this, node); |
379 if (is_strong(OpParameter<LanguageMode>(node))) { | |
380 if (r.BothInputsAre(Type::Number())) { | |
381 r.ConvertInputsToUI32(left_signedness, kUnsigned); | |
382 return r.ChangeToPureOperator(shift_op, Type::Integral32()); | |
383 } | |
384 return NoChange(); | |
385 } | |
373 if (r.BothInputsAre(Type::Primitive())) { | 386 if (r.BothInputsAre(Type::Primitive())) { |
374 r.ConvertInputsForShift(left_signedness); | 387 r.ConvertInputsForShift(left_signedness); |
375 return r.ChangeToPureOperator(shift_op, Type::Integral32()); | 388 return r.ChangeToPureOperator(shift_op, Type::Integral32()); |
376 } | 389 } |
377 return NoChange(); | 390 return NoChange(); |
378 } | 391 } |
379 | 392 |
380 | 393 |
381 Reduction JSTypedLowering::ReduceJSComparison(Node* node) { | 394 Reduction JSTypedLowering::ReduceJSComparison(Node* node) { |
382 JSBinopReduction r(this, node); | 395 JSBinopReduction r(this, node); |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1076 } | 1089 } |
1077 | 1090 |
1078 | 1091 |
1079 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1092 MachineOperatorBuilder* JSTypedLowering::machine() const { |
1080 return jsgraph()->machine(); | 1093 return jsgraph()->machine(); |
1081 } | 1094 } |
1082 | 1095 |
1083 } // namespace compiler | 1096 } // namespace compiler |
1084 } // namespace internal | 1097 } // namespace internal |
1085 } // namespace v8 | 1098 } // namespace v8 |
OLD | NEW |