| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 RECURSE(Visit(arg)); | 396 RECURSE(Visit(arg)); |
| 397 } | 397 } |
| 398 | 398 |
| 399 // We don't know anything about the type. | 399 // We don't know anything about the type. |
| 400 } | 400 } |
| 401 | 401 |
| 402 | 402 |
| 403 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { | 403 void AstTyper::VisitUnaryOperation(UnaryOperation* expr) { |
| 404 RECURSE(Visit(expr->expression())); | 404 RECURSE(Visit(expr->expression())); |
| 405 | 405 |
| 406 // Collect type feedback. | |
| 407 Handle<Type> op_type = oracle()->UnaryType(expr->UnaryOperationFeedbackId()); | |
| 408 NarrowLowerType(expr->expression(), op_type); | |
| 409 if (expr->op() == Token::NOT) { | 406 if (expr->op() == Token::NOT) { |
| 410 // TODO(rossberg): only do in test or value context. | 407 // TODO(rossberg): only do in test or value context. |
| 411 expr->expression()->RecordToBooleanTypeFeedback(oracle()); | 408 expr->expression()->RecordToBooleanTypeFeedback(oracle()); |
| 412 } | 409 } |
| 413 | 410 |
| 414 switch (expr->op()) { | 411 switch (expr->op()) { |
| 415 case Token::NOT: | 412 case Token::NOT: |
| 416 case Token::DELETE: | 413 case Token::DELETE: |
| 417 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); | 414 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); |
| 418 break; | 415 break; |
| 419 case Token::VOID: | 416 case Token::VOID: |
| 420 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); | 417 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); |
| 421 break; | 418 break; |
| 422 case Token::BIT_NOT: | |
| 423 NarrowType(expr, Bounds(Type::Smi(), Type::Signed32(), isolate_)); | |
| 424 break; | |
| 425 case Token::TYPEOF: | 419 case Token::TYPEOF: |
| 426 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); | 420 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); |
| 427 break; | 421 break; |
| 428 default: | 422 default: |
| 429 UNREACHABLE(); | 423 UNREACHABLE(); |
| 430 } | 424 } |
| 431 } | 425 } |
| 432 | 426 |
| 433 | 427 |
| 434 void AstTyper::VisitCountOperation(CountOperation* expr) { | 428 void AstTyper::VisitCountOperation(CountOperation* expr) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 576 void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
| 583 } | 577 } |
| 584 | 578 |
| 585 | 579 |
| 586 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 580 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
| 587 RECURSE(Visit(stmt->body())); | 581 RECURSE(Visit(stmt->body())); |
| 588 } | 582 } |
| 589 | 583 |
| 590 | 584 |
| 591 } } // namespace v8::internal | 585 } } // namespace v8::internal |
| OLD | NEW |