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

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

Issue 1656493002: Switching foreign function to be marked as functions at call sites. (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 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 // Checking for asm extern types explicitly, as the type system 993 // Checking for asm extern types explicitly, as the type system
994 // doesn't correctly check their inheritance relationship. 994 // doesn't correctly check their inheritance relationship.
995 if (!computed_type_->Is(cache_.kAsmSigned) && 995 if (!computed_type_->Is(cache_.kAsmSigned) &&
996 !computed_type_->Is(cache_.kAsmFixnum) && 996 !computed_type_->Is(cache_.kAsmFixnum) &&
997 !computed_type_->Is(cache_.kAsmDouble)) { 997 !computed_type_->Is(cache_.kAsmDouble)) {
998 FAIL(arg, 998 FAIL(arg,
999 "foreign call argument expected to be int, double, or fixnum"); 999 "foreign call argument expected to be int, double, or fixnum");
1000 } 1000 }
1001 } 1001 }
1002 intish_ = kMaxUncombinedAdditiveSteps; 1002 intish_ = kMaxUncombinedAdditiveSteps;
1003 expr->expression()->set_bounds(Bounds(Type::Function(zone())));
1003 IntersectResult(expr, expected_type); 1004 IntersectResult(expr, expected_type);
1004 } else { 1005 } else {
1005 FAIL(expr, "invalid callee"); 1006 FAIL(expr, "invalid callee");
1006 } 1007 }
1007 } 1008 }
1008 1009
1009 1010
1010 void AsmTyper::VisitCallNew(CallNew* expr) { 1011 void AsmTyper::VisitCallNew(CallNew* expr) {
1011 if (in_function_) { 1012 if (in_function_) {
1012 FAIL(expr, "new not allowed in module function"); 1013 FAIL(expr, "new not allowed in module function");
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 return; 1129 return;
1129 } 1130 }
1130 case Token::OR: 1131 case Token::OR:
1131 case Token::AND: 1132 case Token::AND:
1132 FAIL(expr, "illegal logical operator"); 1133 FAIL(expr, "illegal logical operator");
1133 case Token::BIT_OR: { 1134 case Token::BIT_OR: {
1134 // BIT_OR allows Any since it is used as a type coercion. 1135 // BIT_OR allows Any since it is used as a type coercion.
1135 VisitIntegerBitwiseOperator(expr, Type::Any(zone()), cache_.kAsmInt, 1136 VisitIntegerBitwiseOperator(expr, Type::Any(zone()), cache_.kAsmInt,
1136 cache_.kAsmSigned, true); 1137 cache_.kAsmSigned, true);
1137 if (expr->left()->IsCall() && expr->op() == Token::BIT_OR) { 1138 if (expr->left()->IsCall() && expr->op() == Token::BIT_OR) {
1138 IntersectResult(expr->left(), cache_.kAsmSigned); 1139 expr->left()->set_bounds(Bounds(cache_.kAsmSigned));
1139 } 1140 }
1140 return; 1141 return;
1141 } 1142 }
1142 case Token::BIT_XOR: { 1143 case Token::BIT_XOR: {
1143 // Handle booleans specially to handle de-sugared ! 1144 // Handle booleans specially to handle de-sugared !
1144 Literal* left = expr->left()->AsLiteral(); 1145 Literal* left = expr->left()->AsLiteral();
1145 if (left && left->value()->IsBoolean()) { 1146 if (left && left->value()->IsBoolean()) {
1146 if (left->ToBooleanIsTrue()) { 1147 if (left->ToBooleanIsTrue()) {
1147 left->set_bounds(Bounds(cache_.kSingletonOne)); 1148 left->set_bounds(Bounds(cache_.kSingletonOne));
1148 RECURSE(VisitWithExpectation(expr->right(), cache_.kAsmInt, 1149 RECURSE(VisitWithExpectation(expr->right(), cache_.kAsmInt,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 FAIL(expr, "too many consecutive multiplicative ops"); 1218 FAIL(expr, "too many consecutive multiplicative ops");
1218 } 1219 }
1219 } 1220 }
1220 IntersectResult(expr, cache_.kAsmInt); 1221 IntersectResult(expr, cache_.kAsmInt);
1221 return; 1222 return;
1222 } 1223 }
1223 } else if (expr->op() == Token::MUL && expr->right()->IsLiteral() && 1224 } else if (expr->op() == Token::MUL && expr->right()->IsLiteral() &&
1224 right_type->Is(cache_.kAsmDouble)) { 1225 right_type->Is(cache_.kAsmDouble)) {
1225 // For unary +, expressed as x * 1.0 1226 // For unary +, expressed as x * 1.0
1226 if (expr->left()->IsCall() && expr->op() == Token::MUL) { 1227 if (expr->left()->IsCall() && expr->op() == Token::MUL) {
1227 IntersectResult(expr->left(), cache_.kAsmDouble); 1228 expr->left()->set_bounds(Bounds(cache_.kAsmDouble));
1228 } 1229 }
1229 IntersectResult(expr, cache_.kAsmDouble); 1230 IntersectResult(expr, cache_.kAsmDouble);
1230 return; 1231 return;
1231 } else if (type->Is(cache_.kAsmFloat) && expr->op() != Token::MOD) { 1232 } else if (type->Is(cache_.kAsmFloat) && expr->op() != Token::MOD) {
1232 if (left_intish != 0 || right_intish != 0) { 1233 if (left_intish != 0 || right_intish != 0) {
1233 FAIL(expr, "float operation before required fround"); 1234 FAIL(expr, "float operation before required fround");
1234 } 1235 }
1235 IntersectResult(expr, cache_.kAsmFloat); 1236 IntersectResult(expr, cache_.kAsmFloat);
1236 intish_ = 1; 1237 intish_ = 1;
1237 return; 1238 return;
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 1532
1532 1533
1533 void AsmTyper::VisitRewritableAssignmentExpression( 1534 void AsmTyper::VisitRewritableAssignmentExpression(
1534 RewritableAssignmentExpression* expr) { 1535 RewritableAssignmentExpression* expr) {
1535 RECURSE(Visit(expr->expression())); 1536 RECURSE(Visit(expr->expression()));
1536 } 1537 }
1537 1538
1538 1539
1539 } // namespace internal 1540 } // namespace internal
1540 } // namespace v8 1541 } // 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