Index: src/typing-asm.cc |
diff --git a/src/typing-asm.cc b/src/typing-asm.cc |
index d9678846671ce98161f620281a6874a8529f1d67..7cf380c438cd3f89444f06457fef99ef127e35e2 100644 |
--- a/src/typing-asm.cc |
+++ b/src/typing-asm.cc |
@@ -815,12 +815,16 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) { |
case Token::SAR: { |
// BIT_OR allows Any since it is used as a type coercion. |
// BIT_XOR allows Number since it is used as a type coercion (encoding ~). |
- Type* expectation = |
- expr->op() == Token::BIT_OR |
- ? Type::Any() |
- : expr->op() == Token::BIT_XOR ? Type::Number() : cache_.kInt32; |
- Type* result = |
- expr->op() == Token::SHR ? Type::Unsigned32() : cache_.kInt32; |
+ // SHR allows Number since it is used as a type coercion to uint32. |
+ Type* expectation; |
titzer
2015/11/02 22:57:15
Is it time for a helper function where each case p
bradn
2015/11/03 00:10:24
Done.
|
+ if (expr->op() == Token::BIT_OR) { |
+ expectation = Type::Any(); |
+ } else if (expr->op() == Token::BIT_XOR || |
+ expr->op() == Token::SHR) { |
+ expectation = Type::Number(); |
+ } else { |
+ expectation = cache_.kInt32; |
+ } |
RECURSE(VisitWithExpectation(expr->left(), expectation, |
"left bit operand expected to be integer")); |
int left_intish = intish_; |
@@ -834,6 +838,8 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) { |
FAIL(expr, "too many consecutive additive ops"); |
} |
intish_ = 0; |
+ Type* result = |
+ expr->op() == Token::SHR ? cache_.kUint32 : cache_.kInt32; |
IntersectResult(expr, result); |
return; |
} |
@@ -899,7 +905,10 @@ void AsmTyper::VisitCompareOperation(CompareOperation* expr) { |
Type* right_type = computed_type_; |
Type* type = Type::Union(left_type, right_type, zone()); |
expr->set_combined_type(type); |
- if (type->Is(Type::Integral32()) || type->Is(Type::UntaggedFloat64())) { |
+ if (type->Is(cache_.kInt32) || |
+ type->Is(cache_.kUint32) || |
+ type->Is(cache_.kFloat32) || |
+ type->Is(cache_.kFloat64)) { |
IntersectResult(expr, cache_.kInt32); |
} else { |
FAIL(expr, "ill-typed comparison operation"); |