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

Side by Side Diff: src/ast.cc

Issue 17468003: Use AST's type field and merge types for unary, binary & compare ICs (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments Created 7 years, 6 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/ast.h ('k') | src/code-stubs.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 } 410 }
411 411
412 bool FunctionDeclaration::IsInlineable() const { 412 bool FunctionDeclaration::IsInlineable() const {
413 return false; 413 return false;
414 } 414 }
415 415
416 416
417 // ---------------------------------------------------------------------------- 417 // ----------------------------------------------------------------------------
418 // Recording of type feedback 418 // Recording of type feedback
419 419
420 // TODO(rossberg): all RecordTypeFeedback functions should disappear
421 // once we use the common type field in the AST consistently.
422
423
420 void ForInStatement::RecordTypeFeedback(TypeFeedbackOracle* oracle) { 424 void ForInStatement::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
421 for_in_type_ = static_cast<ForInType>(oracle->ForInType(this)); 425 for_in_type_ = static_cast<ForInType>(oracle->ForInType(this));
422 } 426 }
423 427
424 428
425 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { 429 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
426 to_boolean_types_ = oracle->ToBooleanTypes(test_id()); 430 to_boolean_types_ = oracle->ToBooleanTypes(test_id());
427 } 431 }
428 432
429 433
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 659 }
656 660
657 661
658 void ObjectLiteral::Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) { 662 void ObjectLiteral::Property::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
659 receiver_type_ = oracle->ObjectLiteralStoreIsMonomorphic(this) 663 receiver_type_ = oracle->ObjectLiteralStoreIsMonomorphic(this)
660 ? oracle->GetObjectLiteralStoreMap(this) 664 ? oracle->GetObjectLiteralStoreMap(this)
661 : Handle<Map>::null(); 665 : Handle<Map>::null();
662 } 666 }
663 667
664 668
665 void UnaryOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
666 type_ = oracle->UnaryType(UnaryOperationFeedbackId());
667 }
668
669
670 void BinaryOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
671 oracle->BinaryType(BinaryOperationFeedbackId(),
672 &left_type_, &right_type_, &result_type_,
673 &has_fixed_right_arg_, &fixed_right_arg_value_);
674 }
675
676
677 // TODO(rossberg): this function (and all other RecordTypeFeedback functions)
678 // should disappear once we use the common type field in the AST consistently.
679 void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
680 oracle->CompareTypes(CompareOperationFeedbackId(),
681 &left_type_, &right_type_, &overall_type_, &compare_nil_type_);
682 }
683
684
685 // ---------------------------------------------------------------------------- 669 // ----------------------------------------------------------------------------
686 // Implementation of AstVisitor 670 // Implementation of AstVisitor
687 671
688 void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) { 672 void AstVisitor::VisitDeclarations(ZoneList<Declaration*>* declarations) {
689 for (int i = 0; i < declarations->length(); i++) { 673 for (int i = 0; i < declarations->length(); i++) {
690 Visit(declarations->at(i)); 674 Visit(declarations->at(i));
691 } 675 }
692 } 676 }
693 677
694 678
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value()); 1160 OS::SNPrintF(buffer, "%d", Smi::cast(*handle_)->value());
1177 str = arr; 1161 str = arr;
1178 } else { 1162 } else {
1179 str = DoubleToCString(handle_->Number(), buffer); 1163 str = DoubleToCString(handle_->Number(), buffer);
1180 } 1164 }
1181 return factory->NewStringFromAscii(CStrVector(str)); 1165 return factory->NewStringFromAscii(CStrVector(str));
1182 } 1166 }
1183 1167
1184 1168
1185 } } // namespace v8::internal 1169 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698