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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. | 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) { | 407 if (expr->op() == Token::NOT) { |
410 // TODO(rossberg): only do in test or value context. | 408 // TODO(rossberg): only do in test or value context. |
411 expr->expression()->RecordToBooleanTypeFeedback(oracle()); | 409 expr->expression()->RecordToBooleanTypeFeedback(oracle()); |
412 } | 410 } |
413 | 411 |
414 switch (expr->op()) { | 412 switch (expr->op()) { |
415 case Token::NOT: | 413 case Token::NOT: |
416 case Token::DELETE: | 414 case Token::DELETE: |
417 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); | 415 NarrowType(expr, Bounds(Type::Boolean(), isolate_)); |
418 break; | 416 break; |
419 case Token::VOID: | 417 case Token::VOID: |
420 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); | 418 NarrowType(expr, Bounds(Type::Undefined(), isolate_)); |
421 break; | 419 break; |
422 case Token::BIT_NOT: | |
423 NarrowType(expr, Bounds(Type::Smi(), Type::Signed32(), isolate_)); | |
424 break; | |
425 case Token::TYPEOF: | 420 case Token::TYPEOF: |
426 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); | 421 NarrowType(expr, Bounds(Type::InternalizedString(), isolate_)); |
427 break; | 422 break; |
428 default: | 423 default: |
429 UNREACHABLE(); | 424 UNREACHABLE(); |
430 } | 425 } |
431 } | 426 } |
432 | 427 |
433 | 428 |
434 void AstTyper::VisitCountOperation(CountOperation* expr) { | 429 void AstTyper::VisitCountOperation(CountOperation* expr) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 void AstTyper::VisitModuleUrl(ModuleUrl* module) { | 577 void AstTyper::VisitModuleUrl(ModuleUrl* module) { |
583 } | 578 } |
584 | 579 |
585 | 580 |
586 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { | 581 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { |
587 RECURSE(Visit(stmt->body())); | 582 RECURSE(Visit(stmt->body())); |
588 } | 583 } |
589 | 584 |
590 | 585 |
591 } } // namespace v8::internal | 586 } } // namespace v8::internal |
OLD | NEW |