| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 } | 340 } |
| 341 #endif | 341 #endif |
| 342 return NoChange(); | 342 return NoChange(); |
| 343 } | 343 } |
| 344 | 344 |
| 345 | 345 |
| 346 Reduction JSTypedLowering::ReduceNumberBinop(Node* node, | 346 Reduction JSTypedLowering::ReduceNumberBinop(Node* node, |
| 347 const Operator* numberOp) { | 347 const Operator* numberOp) { |
| 348 JSBinopReduction r(this, node); | 348 JSBinopReduction r(this, node); |
| 349 if (is_strong(OpParameter<LanguageMode>(node))) { | 349 if (is_strong(OpParameter<LanguageMode>(node))) { |
| 350 if (r.left_type()->Is(Type::Number()) && | 350 if (r.BothInputsAre(Type::Number())) { |
| 351 (r.right_type()->Is(Type::Number()))) { | |
| 352 return r.ChangeToPureOperator(numberOp, Type::Number()); | 351 return r.ChangeToPureOperator(numberOp, Type::Number()); |
| 353 } | 352 } |
| 354 return NoChange(); | 353 return NoChange(); |
| 355 } | 354 } |
| 356 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | 355 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); |
| 357 r.ConvertInputsToNumber(frame_state); | 356 r.ConvertInputsToNumber(frame_state); |
| 358 return r.ChangeToPureOperator(numberOp, Type::Number()); | 357 return r.ChangeToPureOperator(numberOp, Type::Number()); |
| 359 } | 358 } |
| 360 | 359 |
| 361 | 360 |
| 362 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) { | 361 Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) { |
| 363 JSBinopReduction r(this, node); | 362 JSBinopReduction r(this, node); |
| 363 if (is_strong(OpParameter<LanguageMode>(node))) { |
| 364 if (r.BothInputsAre(Type::Number())) { |
| 365 r.ConvertInputsToUI32(kSigned, kSigned); |
| 366 return r.ChangeToPureOperator(intOp, Type::Integral32()); |
| 367 } |
| 368 return NoChange(); |
| 369 } |
| 364 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); | 370 Node* frame_state = NodeProperties::GetFrameStateInput(node, 1); |
| 365 r.ConvertInputsToNumber(frame_state); | 371 r.ConvertInputsToNumber(frame_state); |
| 366 r.ConvertInputsToUI32(kSigned, kSigned); | 372 r.ConvertInputsToUI32(kSigned, kSigned); |
| 367 return r.ChangeToPureOperator(intOp, Type::Integral32()); | 373 return r.ChangeToPureOperator(intOp, Type::Integral32()); |
| 368 } | 374 } |
| 369 | 375 |
| 370 | 376 |
| 371 Reduction JSTypedLowering::ReduceUI32Shift(Node* node, | 377 Reduction JSTypedLowering::ReduceUI32Shift(Node* node, |
| 372 Signedness left_signedness, | 378 Signedness left_signedness, |
| 373 const Operator* shift_op) { | 379 const Operator* shift_op) { |
| 374 JSBinopReduction r(this, node); | 380 JSBinopReduction r(this, node); |
| 375 if (r.BothInputsAre(Type::Primitive())) { | 381 Type* reduce_type = is_strong( |
| 382 OpParameter<LanguageMode>(node)) ? Type::Number() : |
| 383 Type::Primitive(); |
| 384 if (r.BothInputsAre(reduce_type)) { |
| 376 r.ConvertInputsForShift(left_signedness); | 385 r.ConvertInputsForShift(left_signedness); |
| 377 return r.ChangeToPureOperator(shift_op, Type::Integral32()); | 386 return r.ChangeToPureOperator(shift_op, Type::Integral32()); |
| 378 } | 387 } |
| 379 return NoChange(); | 388 return NoChange(); |
| 380 } | 389 } |
| 381 | 390 |
| 382 | 391 |
| 383 Reduction JSTypedLowering::ReduceJSComparison(Node* node) { | 392 Reduction JSTypedLowering::ReduceJSComparison(Node* node) { |
| 384 JSBinopReduction r(this, node); | 393 JSBinopReduction r(this, node); |
| 385 if (r.BothInputsAre(Type::String())) { | 394 if (r.BothInputsAre(Type::String())) { |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 } | 1177 } |
| 1169 | 1178 |
| 1170 | 1179 |
| 1171 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1180 MachineOperatorBuilder* JSTypedLowering::machine() const { |
| 1172 return jsgraph()->machine(); | 1181 return jsgraph()->machine(); |
| 1173 } | 1182 } |
| 1174 | 1183 |
| 1175 } // namespace compiler | 1184 } // namespace compiler |
| 1176 } // namespace internal | 1185 } // namespace internal |
| 1177 } // namespace v8 | 1186 } // namespace v8 |
| OLD | NEW |