Revision f230a1cf deps/v8/src/typing.cc
deps/v8/src/typing.cc | ||
---|---|---|
206 | 206 |
} |
207 | 207 |
|
208 | 208 |
|
209 |
void AstTyper::VisitCaseClause(CaseClause* clause) { |
|
210 |
UNREACHABLE(); |
|
211 |
} |
|
212 |
|
|
213 |
|
|
209 | 214 |
void AstTyper::VisitDoWhileStatement(DoWhileStatement* stmt) { |
210 | 215 |
// Collect type feedback. |
211 | 216 |
if (!stmt->cond()->ToBooleanIsTrue()) { |
... | ... | |
247 | 252 |
RECURSE(Visit(stmt->cond())); |
248 | 253 |
} |
249 | 254 |
RECURSE(Visit(stmt->body())); |
250 |
store_.Forget(); // Control may transfer here via 'continue'. |
|
251 | 255 |
if (stmt->next() != NULL) { |
256 |
store_.Forget(); // Control may transfer here via 'continue'. |
|
252 | 257 |
RECURSE(Visit(stmt->next())); |
253 | 258 |
} |
254 | 259 |
store_.Forget(); // Control may transfer here via termination or 'break'. |
... | ... | |
305 | 310 |
} |
306 | 311 |
|
307 | 312 |
|
308 |
void AstTyper::VisitSharedFunctionInfoLiteral(SharedFunctionInfoLiteral* expr) {
|
|
313 |
void AstTyper::VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) {
|
|
309 | 314 |
} |
310 | 315 |
|
311 | 316 |
|
... | ... | |
543 | 548 |
Handle<Type> type, left_type, right_type; |
544 | 549 |
Maybe<int> fixed_right_arg; |
545 | 550 |
oracle()->BinaryType(expr->BinaryOperationFeedbackId(), |
546 |
&left_type, &right_type, &type, &fixed_right_arg); |
|
551 |
&left_type, &right_type, &type, &fixed_right_arg, expr->op());
|
|
547 | 552 |
NarrowLowerType(expr, type); |
548 | 553 |
NarrowLowerType(expr->left(), left_type); |
549 | 554 |
NarrowLowerType(expr->right(), right_type); |
... | ... | |
577 | 582 |
case Token::BIT_AND: { |
578 | 583 |
RECURSE(Visit(expr->left())); |
579 | 584 |
RECURSE(Visit(expr->right())); |
580 |
Type* upper = Type::Union( |
|
581 |
expr->left()->bounds().upper, expr->right()->bounds().upper); |
|
582 |
if (!upper->Is(Type::Signed32())) upper = Type::Signed32(); |
|
583 |
NarrowType(expr, Bounds(Type::Smi(), upper, isolate_)); |
|
585 |
Handle<Type> upper( |
|
586 |
Type::Union( |
|
587 |
expr->left()->bounds().upper, expr->right()->bounds().upper), |
|
588 |
isolate_); |
|
589 |
if (!upper->Is(Type::Signed32())) |
|
590 |
upper = handle(Type::Signed32(), isolate_); |
|
591 |
Handle<Type> lower(Type::Intersect( |
|
592 |
handle(Type::Smi(), isolate_), upper), isolate_); |
|
593 |
NarrowType(expr, Bounds(lower, upper)); |
|
584 | 594 |
break; |
585 | 595 |
} |
586 | 596 |
case Token::BIT_XOR: |
... | ... | |
593 | 603 |
case Token::SHR: |
594 | 604 |
RECURSE(Visit(expr->left())); |
595 | 605 |
RECURSE(Visit(expr->right())); |
596 |
NarrowType(expr, Bounds(Type::Smi(), Type::Unsigned32(), isolate_)); |
|
606 |
// TODO(rossberg): The upper bound would be Unsigned32, but since there |
|
607 |
// is no 'positive Smi' type for the lower bound, we use the smallest |
|
608 |
// union of Smi and Unsigned32 as upper bound instead. |
|
609 |
NarrowType(expr, Bounds(Type::Smi(), Type::Number(), isolate_)); |
|
597 | 610 |
break; |
598 | 611 |
case Token::ADD: { |
599 | 612 |
RECURSE(Visit(expr->left())); |
... | ... | |
601 | 614 |
Bounds l = expr->left()->bounds(); |
602 | 615 |
Bounds r = expr->right()->bounds(); |
603 | 616 |
Type* lower = |
604 |
l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ?
|
|
605 |
Type::Smi() :
|
|
617 |
l.lower->Is(Type::None()) || r.lower->Is(Type::None()) ?
|
|
618 |
Type::None() :
|
|
606 | 619 |
l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ? |
607 |
Type::String() : Type::None(); |
|
620 |
Type::String() : |
|
621 |
l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ? |
|
622 |
Type::Smi() : Type::None(); |
|
608 | 623 |
Type* upper = |
609 |
l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ? |
|
610 |
Type::Number() : |
|
611 | 624 |
l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ? |
612 |
Type::String() : Type::NumberOrString(); |
|
625 |
Type::String() : |
|
626 |
l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ? |
|
627 |
Type::Number() : Type::NumberOrString(); |
|
613 | 628 |
NarrowType(expr, Bounds(lower, upper, isolate_)); |
614 | 629 |
break; |
615 | 630 |
} |
Also available in: Unified diff