Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: src/typing.cc

Issue 23618002: Hydrogenisation of binops (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/types.h ('k') | src/v8-counters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 store_.Seq(variable_index(proxy->var()), Effect(expr->bounds())); 536 store_.Seq(variable_index(proxy->var()), Effect(expr->bounds()));
537 } 537 }
538 } 538 }
539 539
540 540
541 void AstTyper::VisitBinaryOperation(BinaryOperation* expr) { 541 void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
542 // Collect type feedback. 542 // Collect type feedback.
543 Handle<Type> type, left_type, right_type; 543 Handle<Type> type, left_type, right_type;
544 Maybe<int> fixed_right_arg; 544 Maybe<int> fixed_right_arg;
545 oracle()->BinaryType(expr->BinaryOperationFeedbackId(), 545 oracle()->BinaryType(expr->BinaryOperationFeedbackId(),
546 &left_type, &right_type, &type, &fixed_right_arg); 546 &left_type, &right_type, &type, &fixed_right_arg, expr->op());
547 NarrowLowerType(expr, type); 547 NarrowLowerType(expr, type);
548 NarrowLowerType(expr->left(), left_type); 548 NarrowLowerType(expr->left(), left_type);
549 NarrowLowerType(expr->right(), right_type); 549 NarrowLowerType(expr->right(), right_type);
550 expr->set_fixed_right_arg(fixed_right_arg); 550 expr->set_fixed_right_arg(fixed_right_arg);
551 if (expr->op() == Token::OR || expr->op() == Token::AND) { 551 if (expr->op() == Token::OR || expr->op() == Token::AND) {
552 expr->left()->RecordToBooleanTypeFeedback(oracle()); 552 expr->left()->RecordToBooleanTypeFeedback(oracle());
553 } 553 }
554 554
555 switch (expr->op()) { 555 switch (expr->op()) {
556 case Token::COMMA: 556 case Token::COMMA:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 case Token::MUL: 617 case Token::MUL:
618 case Token::DIV: 618 case Token::DIV:
619 case Token::MOD: 619 case Token::MOD:
620 RECURSE(Visit(expr->left())); 620 RECURSE(Visit(expr->left()));
621 RECURSE(Visit(expr->right())); 621 RECURSE(Visit(expr->right()));
622 NarrowType(expr, Bounds(Type::Smi(), Type::Number(), isolate_)); 622 NarrowType(expr, Bounds(Type::Smi(), Type::Number(), isolate_));
623 break; 623 break;
624 default: 624 default:
625 UNREACHABLE(); 625 UNREACHABLE();
626 } 626 }
627 return;
628 PrintF("%s: ", Token::Name(expr->op()));
629 if (expr->left()->bounds().lower->Is(Type::None())) PrintF(".");
630 else if (expr->left()->bounds().lower->Is(Type::Smi())) PrintF("s");
631 else if (expr->left()->bounds().lower->Is(Type::Signed32())) PrintF("i");
632 else if (expr->left()->bounds().lower->Is(Type::Any())) PrintF("t");
633 PrintF("*");
634 if (expr->right()->bounds().lower->Is(Type::None())) PrintF(".");
635 else if (expr->right()->bounds().lower->Is(Type::Smi())) PrintF("s");
636 else if (expr->right()->bounds().lower->Is(Type::Signed32())) PrintF("i");
637 else if (expr->right()->bounds().lower->Is(Type::Any())) PrintF("t");
638 PrintF("\n");
627 } 639 }
628 640
629 641
630 void AstTyper::VisitCompareOperation(CompareOperation* expr) { 642 void AstTyper::VisitCompareOperation(CompareOperation* expr) {
631 // Collect type feedback. 643 // Collect type feedback.
632 Handle<Type> left_type, right_type, combined_type; 644 Handle<Type> left_type, right_type, combined_type;
633 oracle()->CompareType(expr->CompareOperationFeedbackId(), 645 oracle()->CompareType(expr->CompareOperationFeedbackId(),
634 &left_type, &right_type, &combined_type); 646 &left_type, &right_type, &combined_type);
635 NarrowLowerType(expr->left(), left_type); 647 NarrowLowerType(expr->left(), left_type);
636 NarrowLowerType(expr->right(), right_type); 648 NarrowLowerType(expr->right(), right_type);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 void AstTyper::VisitModuleUrl(ModuleUrl* module) { 707 void AstTyper::VisitModuleUrl(ModuleUrl* module) {
696 } 708 }
697 709
698 710
699 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) { 711 void AstTyper::VisitModuleStatement(ModuleStatement* stmt) {
700 RECURSE(Visit(stmt->body())); 712 RECURSE(Visit(stmt->body()));
701 } 713 }
702 714
703 715
704 } } // namespace v8::internal 716 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/types.h ('k') | src/v8-counters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698