| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 Expression* arg = args->at(i); | 490 Expression* arg = args->at(i); |
| 491 RECURSE(Visit(arg)); | 491 RECURSE(Visit(arg)); |
| 492 } | 492 } |
| 493 | 493 |
| 494 // We don't know anything about the result type. | 494 // We don't know anything about the result type. |
| 495 } | 495 } |
| 496 | 496 |
| 497 | 497 |
| 498 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { | 498 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { |
| 499 // Collect type feedback. | 499 // Collect type feedback. |
| 500 Handle<Type> op_type = oracle()->UnaryType(expr->UnaryOperationFeedbackId()); | |
| 501 NarrowLowerType(expr->expression(), op_type); | |
| 502 if (expr->op() == Token::NOT) { | 500 if (expr->op() == Token::NOT) { |
| 503 // TODO(rossberg): only do in test or value context. | 501 // TODO(rossberg): only do in test or value context. |
| 504 expr->expression()->RecordToBooleanTypeFeedback(oracle()); | 502 expr->expression()->RecordToBooleanTypeFeedback(oracle()); |
| 505 } | 503 } |
| 506 | 504 |
| 507 RECURSE(Visit(expr->expression())); | 505 RECURSE(Visit(expr->expression())); |
| 508 | 506 |
| 509 switch (expr->op()) { | 507 switch (expr->op()) { |
| 510 case Token::NOT: | 508 case Token::NOT: |
| 511 case Token::DELETE: | 509 case Token::DELETE: |
| 512 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); | 510 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); |
| 513 break; | 511 break; |
| 514 case Token::VOID: | 512 case Token::VOID: |
| 515 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); | 513 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); |
| 516 break; | 514 break; |
| 517 case Token::BIT_NOT: | |
| 518 NarrowType(expr, Bounds(Type::Smi(), Type::Signed32(), isolate_)); | |
| 519 break; | |
| 520 case Token::TYPEOF: | 515 case Token::TYPEOF: |
| 521 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); | 516 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); |
| 522 break; | 517 break; |
| 523 default: | 518 default: |
| 524 UNREACHABLE(); | 519 UNREACHABLE(); |
| 525 } | 520 } |
| 526 } | 521 } |
| 527 | 522 |
| 528 | 523 |
| 529 void AstTyper::VisitCountOperation(CountOperation* expr) { | 524 void AstTyper::VisitCountOperation(CountOperation* expr) { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 697 void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
| 703 } | 698 } |
| 704 | 699 |
| 705 | 700 |
| 706 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 701 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
| 707 RECURSE(Visit(stmt->body())); | 702 RECURSE(Visit(stmt->body())); |
| 708 } | 703 } |
| 709 | 704 |
| 710 | 705 |
| 711 } } // namespace v8::internal | 706 } } // namespace v8::internal |
| OLD | NEW |