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

Side by Side Diff: src/typing-asm.cc

Issue 1691723004: Only allow |0 and *1.0 for asm validator foreign variables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-asm-validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698