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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 1102923002: [strong] Disallow implicit conversions for bitwise ops, shifts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: more test formatting 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index a3fbb669ed3759087c5809d0816ce7d7565bd4d0..054403dd7cea71bc5de78f9a70dca638c0e06a20 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -345,8 +345,7 @@ Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
const Operator* numberOp) {
JSBinopReduction r(this, node);
if (is_strong(OpParameter<LanguageMode>(node))) {
- if (r.left_type()->Is(Type::Number()) &&
- (r.right_type()->Is(Type::Number()))) {
+ if (r.BothInputsAre(Type::Number())) {
return r.ChangeToPureOperator(numberOp, Type::Number());
}
return NoChange();
@@ -359,6 +358,13 @@ Reduction JSTypedLowering::ReduceNumberBinop(Node* node,
Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) {
JSBinopReduction r(this, node);
+ if (is_strong(OpParameter<LanguageMode>(node))) {
+ 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
+ r.ConvertInputsToUI32(kSigned, kSigned);
+ return r.ChangeToPureOperator(intOp, Type::Integral32());
+ }
+ return NoChange();
+ }
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
r.ConvertInputsToNumber(frame_state);
r.ConvertInputsToUI32(kSigned, kSigned);
@@ -370,6 +376,13 @@ Reduction JSTypedLowering::ReduceUI32Shift(Node* node,
Signedness left_signedness,
const Operator* shift_op) {
JSBinopReduction r(this, node);
+ if (is_strong(OpParameter<LanguageMode>(node))) {
+ if (r.BothInputsAre(Type::Number())) {
+ r.ConvertInputsToUI32(left_signedness, kUnsigned);
+ return r.ChangeToPureOperator(shift_op, Type::Integral32());
+ }
+ return NoChange();
+ }
if (r.BothInputsAre(Type::Primitive())) {
r.ConvertInputsForShift(left_signedness);
return r.ChangeToPureOperator(shift_op, Type::Integral32());
« no previous file with comments | « src/builtins.h ('k') | src/ic/ic.cc » ('j') | test/mjsunit/strong/implicit-conversions.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698