Chromium Code Reviews| Index: src/typing-asm.cc |
| diff --git a/src/typing-asm.cc b/src/typing-asm.cc |
| index 986926f5a794c7c2d8bd245402529e24db88636e..af67a9e0c2200d2ccea803f3e25d4a6b6bbdbd42 100644 |
| --- a/src/typing-asm.cc |
| +++ b/src/typing-asm.cc |
| @@ -988,8 +988,16 @@ void AsmTyper::VisitCall(Call* expr) { |
| } |
| } |
| // Handle polymorphic stdlib functions specially. |
| - if (standard_member == kMathCeil || standard_member == kMathFloor || |
| - standard_member == kMathSqrt) { |
| + if (standard_member == kMathFround) { |
| + if (!args->at(0)->bounds().upper->Is(cache_.kAsmFloat) && |
|
titzer
2016/03/21 07:59:44
Cache args->at(0)->bounds().upper?
bradn
2016/03/21 20:31:08
Done.
|
| + !args->at(0)->bounds().upper->Is(cache_.kAsmDouble) && |
| + !args->at(0)->bounds().upper->Is(cache_.kAsmSigned) && |
| + !args->at(0)->bounds().upper->Is(cache_.kAsmUnsigned)) { |
| + FAIL(expr, "illegal function argument type"); |
| + } |
| + } else if (standard_member == kMathCeil || |
| + standard_member == kMathFloor || |
| + standard_member == kMathSqrt) { |
| if (!args->at(0)->bounds().upper->Is(cache_.kAsmFloat) && |
| !args->at(0)->bounds().upper->Is(cache_.kAsmDouble)) { |
| FAIL(expr, "illegal function argument type"); |
| @@ -1156,13 +1164,16 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) { |
| FAIL(expr, "illegal logical operator"); |
| case Token::BIT_OR: { |
| // BIT_OR allows Any since it is used as a type coercion. |
| - VisitIntegerBitwiseOperator(expr, Type::Any(), cache_.kAsmIntQ, |
| - cache_.kAsmSigned, true); |
| + RECURSE(VisitIntegerBitwiseOperator(expr, Type::Any(), cache_.kAsmIntQ, |
| + cache_.kAsmSigned, true)); |
| if (expr->left()->IsCall() && expr->op() == Token::BIT_OR && |
| Type::Number()->Is(expr->left()->bounds().upper)) { |
| // Force the return types of foreign functions. |
| expr->left()->set_bounds(Bounds(cache_.kAsmSigned)); |
| } |
| + if (in_function_ && !expr->left()->bounds().upper->Is(cache_.kAsmIntQ)) { |
| + FAIL(expr->left(), "intish required"); |
| + } |
| return; |
| } |
| case Token::BIT_XOR: { |
| @@ -1180,20 +1191,20 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) { |
| } |
| } |
| // BIT_XOR allows Any since it is used as a type coercion (via ~~). |
| - VisitIntegerBitwiseOperator(expr, Type::Any(), cache_.kAsmIntQ, |
| - cache_.kAsmSigned, true); |
| + RECURSE(VisitIntegerBitwiseOperator(expr, Type::Any(), cache_.kAsmIntQ, |
| + cache_.kAsmSigned, true)); |
| return; |
| } |
| case Token::SHR: { |
| - VisitIntegerBitwiseOperator(expr, cache_.kAsmIntQ, cache_.kAsmIntQ, |
| - cache_.kAsmUnsigned, false); |
| + RECURSE(VisitIntegerBitwiseOperator( |
| + expr, cache_.kAsmIntQ, cache_.kAsmIntQ, cache_.kAsmUnsigned, false)); |
| return; |
| } |
| case Token::SHL: |
| case Token::SAR: |
| case Token::BIT_AND: { |
| - VisitIntegerBitwiseOperator(expr, cache_.kAsmIntQ, cache_.kAsmIntQ, |
| - cache_.kAsmSigned, false); |
| + RECURSE(VisitIntegerBitwiseOperator( |
| + expr, cache_.kAsmIntQ, cache_.kAsmIntQ, cache_.kAsmSigned, false)); |
| return; |
| } |
| case Token::ADD: |