Switching foreign function to be marked as functions at call sites.

On further reflection, marking the variable proxy at call sites
for foreign functions as a function is ok. Switching this.

Fixed a few IntersectResults that probably should be an explicit set_bounds.

BUG= https://code.google.com/p/v8/issues/detail?id=4203
TEST=test-asm-validator
R=aseemgarg@chromium.org,titzer@chromium.org
LOG=N

Review URL: https://codereview.chromium.org/1656493002

Cr-Commit-Position: refs/heads/master@{#33623}
This commit is contained in:
bradnelson 2016-01-29 18:38:25 -08:00 committed by Commit bot
parent 43be96989f
commit 83744a4bee
2 changed files with 7 additions and 5 deletions

View File

@ -1000,6 +1000,7 @@ void AsmTyper::VisitCall(Call* expr) {
}
}
intish_ = kMaxUncombinedAdditiveSteps;
expr->expression()->set_bounds(Bounds(Type::Function(zone())));
IntersectResult(expr, expected_type);
} else {
FAIL(expr, "invalid callee");
@ -1135,7 +1136,7 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) {
VisitIntegerBitwiseOperator(expr, Type::Any(zone()), cache_.kAsmInt,
cache_.kAsmSigned, true);
if (expr->left()->IsCall() && expr->op() == Token::BIT_OR) {
IntersectResult(expr->left(), cache_.kAsmSigned);
expr->left()->set_bounds(Bounds(cache_.kAsmSigned));
}
return;
}
@ -1224,7 +1225,7 @@ void AsmTyper::VisitBinaryOperation(BinaryOperation* expr) {
right_type->Is(cache_.kAsmDouble)) {
// For unary +, expressed as x * 1.0
if (expr->left()->IsCall() && expr->op() == Token::MUL) {
IntersectResult(expr->left(), cache_.kAsmDouble);
expr->left()->set_bounds(Bounds(cache_.kAsmDouble));
}
IntersectResult(expr, cache_.kAsmDouble);
return;

View File

@ -16,6 +16,7 @@
#include "test/cctest/expression-type-collector-macros.h"
// Macros for function types.
#define FUNC_BARE_TYPE Bounds(Type::Function(zone))
#define FUNC_V_TYPE Bounds(Type::Function(Type::Undefined(zone), zone))
#define FUNC_I_TYPE Bounds(Type::Function(cache.kAsmSigned, zone))
#define FUNC_F_TYPE Bounds(Type::Function(cache.kAsmFloat, zone))
@ -1727,7 +1728,7 @@ TEST(ForeignFunction) {
CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) {
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) {
CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) {
CHECK_VAR(baz, Bounds(Type::Any(zone)));
CHECK_VAR(baz, FUNC_BARE_TYPE);
CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
}
@ -2128,7 +2129,7 @@ TEST(Imports) {
CHECK_EXPR(FunctionLiteral, FUNC_I_TYPE) {
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) {
CHECK_EXPR(Call, Bounds(cache.kAsmSigned)) {
CHECK_VAR(ffunc, Bounds(Type::Any(zone)));
CHECK_VAR(ffunc, FUNC_BARE_TYPE);
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) {
CHECK_VAR(fint, Bounds(cache.kAsmInt));
CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
@ -2142,7 +2143,7 @@ TEST(Imports) {
CHECK_EXPR(FunctionLiteral, FUNC_D_TYPE) {
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) {
CHECK_EXPR(Call, Bounds(cache.kAsmDouble)) {
CHECK_VAR(ffunc, Bounds(Type::Any(zone)));
CHECK_VAR(ffunc, FUNC_BARE_TYPE);
CHECK_VAR(fdouble, Bounds(cache.kAsmDouble));
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) {
CHECK_VAR(fint, Bounds(cache.kAsmInt));