| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/typing-asm.h" | 5 #include "src/typing-asm.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "src/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 1103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 | 1114 |
| 1115 void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) { | 1115 void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) { |
| 1116 if (!in_function_) { | 1116 if (!in_function_) { |
| 1117 if (expr->op() != Token::BIT_OR && expr->op() != Token::MUL) { | 1117 if (expr->op() != Token::BIT_OR && expr->op() != Token::MUL) { |
| 1118 FAIL(expr, "illegal binary operator inside module body"); | 1118 FAIL(expr, "illegal binary operator inside module body"); |
| 1119 } | 1119 } |
| 1120 if (!(expr->left()->IsProperty() || expr->left()->IsVariableProxy()) || | 1120 if (!(expr->left()->IsProperty() || expr->left()->IsVariableProxy()) || |
| 1121 !expr->right()->IsLiteral()) { | 1121 !expr->right()->IsLiteral()) { |
| 1122 FAIL(expr, "illegal computation inside module body"); | 1122 FAIL(expr, "illegal computation inside module body"); |
| 1123 } | 1123 } |
| 1124 DCHECK(expr->right()->AsLiteral() != nullptr); |
| 1125 const AstValue* right_value = expr->right()->AsLiteral()->raw_value(); |
| 1126 if (expr->op() == Token::BIT_OR) { |
| 1127 if (right_value->AsNumber() != 0.0 || right_value->ContainsDot()) { |
| 1128 FAIL(expr, "illegal integer annotation value"); |
| 1129 } |
| 1130 } |
| 1131 if (expr->op() == Token::MUL) { |
| 1132 if (right_value->AsNumber() != 1.0 && right_value->ContainsDot()) { |
| 1133 FAIL(expr, "illegal double annotation value"); |
| 1134 } |
| 1135 } |
| 1124 } | 1136 } |
| 1125 switch (expr->op()) { | 1137 switch (expr->op()) { |
| 1126 case Token::COMMA: { | 1138 case Token::COMMA: { |
| 1127 RECURSE(VisitWithExpectation(expr->left(), Type::Any(), | 1139 RECURSE(VisitWithExpectation(expr->left(), Type::Any(), |
| 1128 "left comma operand expected to be any")); | 1140 "left comma operand expected to be any")); |
| 1129 RECURSE(VisitWithExpectation(expr->right(), Type::Any(), | 1141 RECURSE(VisitWithExpectation(expr->right(), Type::Any(), |
| 1130 "right comma operand expected to be any")); | 1142 "right comma operand expected to be any")); |
| 1131 IntersectResult(expr, computed_type_); | 1143 IntersectResult(expr, computed_type_); |
| 1132 return; | 1144 return; |
| 1133 } | 1145 } |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 | 1547 |
| 1536 | 1548 |
| 1537 void AsmTyper::VisitRewritableAssignmentExpression( | 1549 void AsmTyper::VisitRewritableAssignmentExpression( |
| 1538 RewritableAssignmentExpression* expr) { | 1550 RewritableAssignmentExpression* expr) { |
| 1539 RECURSE(Visit(expr->expression())); | 1551 RECURSE(Visit(expr->expression())); |
| 1540 } | 1552 } |
| 1541 | 1553 |
| 1542 | 1554 |
| 1543 } // namespace internal | 1555 } // namespace internal |
| 1544 } // namespace v8 | 1556 } // namespace v8 |
| OLD | NEW |