Chromium Code Reviews| Index: src/typing-asm.cc |
| diff --git a/src/typing-asm.cc b/src/typing-asm.cc |
| index ddb608fc2cf3154e12282598bfbfd15f83e67867..18b9fe6ace71da3d37523992612699388941b237 100644 |
| --- a/src/typing-asm.cc |
| +++ b/src/typing-asm.cc |
| @@ -1213,19 +1213,24 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) { |
| Type* type = Type::Union(left_type, right_type, zone()); |
| if (type->Is(cache_.kAsmInt)) { |
| if (expr->op() == Token::MUL) { |
| - Literal* right = expr->right()->AsLiteral(); |
| - if (!right) { |
| - FAIL(expr, "direct integer multiply forbidden"); |
| - } |
| - if (!right->value()->IsNumber()) { |
| - FAIL(expr, "multiply must be by an integer"); |
| - } |
| int32_t i; |
| - if (!right->value()->ToInt32(&i)) { |
| - FAIL(expr, "multiply must be a signed integer"); |
| + Literal* left = expr->left()->AsLiteral(); |
| + Literal* right = expr->right()->AsLiteral(); |
| + if (left != nullptr && left->value()->IsNumber() && |
| + left->value()->ToInt32(&i)) { |
| + if (right_intish != 0) { |
| + FAIL(expr, "intish not allowed in multiply"); |
| + } |
| + } else if (right != nullptr && right->value()->IsNumber() && |
| + right->value()->ToInt32(&i)) { |
| + if (left_intish != 0) { |
| + FAIL(expr, "intish not allowed in multiply"); |
| + } |
| + } else { |
| + FAIL(expr, "multiply must be by an literal integer"); |
|
titzer
2016/02/23 15:52:18
by "an integer literal" ?
bradn
2016/02/23 16:27:09
Done.
|
| } |
| i = abs(i); |
| - if (i >= 1 << 20) { |
| + if (i >= (1 << 20)) { |
| FAIL(expr, "multiply must be by value in -2^20 < n < 2^20"); |
| } |
| intish_ = i; |