OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 } | 412 } |
413 | 413 |
414 switch (expr->op()) { | 414 switch (expr->op()) { |
415 case Token::NOT: | 415 case Token::NOT: |
416 case Token::DELETE: | 416 case Token::DELETE: |
417 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); | 417 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); |
418 break; | 418 break; |
419 case Token::VOID: | 419 case Token::VOID: |
420 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); | 420 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); |
421 break; | 421 break; |
422 case Token::ADD: | |
423 case Token::SUB: { | |
424 Type* upper = *expr->expression()->bounds().upper; | |
425 if (!upper->Is(Type::Number())) upper = Type::Number(); | |
426 NarrowType(expr, Bounds(Type::Smi(), upper, isolate_)); | |
427 break; | |
428 } | |
429 case Token::BIT_NOT: | 422 case Token::BIT_NOT: |
430 NarrowType(expr, Bounds(Type::Smi(), Type::Signed32(), isolate_)); | 423 NarrowType(expr, Bounds(Type::Smi(), Type::Signed32(), isolate_)); |
431 break; | 424 break; |
432 case Token::TYPEOF: | 425 case Token::TYPEOF: |
433 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); | 426 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); |
434 break; | 427 break; |
435 default: | 428 default: |
436 UNREACHABLE(); | 429 UNREACHABLE(); |
437 } | 430 } |
438 } | 431 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 582 void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
590 } | 583 } |
591 | 584 |
592 | 585 |
593 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 586 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
594 RECURSE(Visit(stmt->body())); | 587 RECURSE(Visit(stmt->body())); |
595 } | 588 } |
596 | 589 |
597 | 590 |
598 } } // namespace v8::internal | 591 } } // namespace v8::internal |
OLD | NEW |