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

Side by Side Diff: src/ast.cc

Issue 7966038: Record function call targets, use them for inlining. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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/arm/lithium-codegen-arm.cc ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 target_ = candidate; 757 target_ = candidate;
758 return true; 758 return true;
759 } 759 }
760 } 760 }
761 return false; 761 return false;
762 } 762 }
763 763
764 764
765 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, 765 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle,
766 CallKind call_kind) { 766 CallKind call_kind) {
767 is_monomorphic_ = oracle->CallIsMonomorphic(this);
767 Property* property = expression()->AsProperty(); 768 Property* property = expression()->AsProperty();
768 ASSERT(property != NULL); 769 if (property == NULL) {
769 // Specialize for the receiver types seen at runtime. 770 // Function call. Specialize for monomorphic calls.
770 Literal* key = property->key()->AsLiteral(); 771 if (is_monomorphic_) target_ = oracle->GetCallTarget(this);
771 ASSERT(key != NULL && key->handle()->IsString()); 772 } else {
772 Handle<String> name = Handle<String>::cast(key->handle()); 773 // Method call. Specialize for the receiver types seen at runtime.
773 receiver_types_.Clear(); 774 Literal* key = property->key()->AsLiteral();
774 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); 775 ASSERT(key != NULL && key->handle()->IsString());
776 Handle<String> name = Handle<String>::cast(key->handle());
777 receiver_types_.Clear();
778 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_);
775 #ifdef DEBUG 779 #ifdef DEBUG
776 if (FLAG_enable_slow_asserts) { 780 if (FLAG_enable_slow_asserts) {
777 int length = receiver_types_.length(); 781 int length = receiver_types_.length();
778 for (int i = 0; i < length; i++) { 782 for (int i = 0; i < length; i++) {
779 Handle<Map> map = receiver_types_.at(i); 783 Handle<Map> map = receiver_types_.at(i);
780 ASSERT(!map.is_null() && *map != NULL); 784 ASSERT(!map.is_null() && *map != NULL);
785 }
781 } 786 }
782 }
783 #endif 787 #endif
784 is_monomorphic_ = oracle->CallIsMonomorphic(this); 788 check_type_ = oracle->GetCallCheckType(this);
785 check_type_ = oracle->GetCallCheckType(this); 789 if (is_monomorphic_) {
786 if (is_monomorphic_) { 790 Handle<Map> map;
787 Handle<Map> map; 791 if (receiver_types_.length() > 0) {
788 if (receiver_types_.length() > 0) { 792 ASSERT(check_type_ == RECEIVER_MAP_CHECK);
789 ASSERT(check_type_ == RECEIVER_MAP_CHECK); 793 map = receiver_types_.at(0);
790 map = receiver_types_.at(0); 794 } else {
791 } else { 795 ASSERT(check_type_ != RECEIVER_MAP_CHECK);
792 ASSERT(check_type_ != RECEIVER_MAP_CHECK); 796 holder_ = Handle<JSObject>(
793 holder_ = Handle<JSObject>( 797 oracle->GetPrototypeForPrimitiveCheck(check_type_));
794 oracle->GetPrototypeForPrimitiveCheck(check_type_)); 798 map = Handle<Map>(holder_->map());
795 map = Handle<Map>(holder_->map()); 799 }
800 is_monomorphic_ = ComputeTarget(map, name);
796 } 801 }
797 is_monomorphic_ = ComputeTarget(map, name);
798 } 802 }
799 } 803 }
800 804
801 805
802 void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) { 806 void CompareOperation::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
803 TypeInfo info = oracle->CompareType(this); 807 TypeInfo info = oracle->CompareType(this);
804 if (info.IsSmi()) { 808 if (info.IsSmi()) {
805 compare_type_ = SMI_ONLY; 809 compare_type_ = SMI_ONLY;
806 } else if (info.IsNonPrimitive()) { 810 } else if (info.IsNonPrimitive()) {
807 compare_type_ = OBJECT_ONLY; 811 compare_type_ = OBJECT_ONLY;
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 int pos) 1191 int pos)
1188 : label_(label), 1192 : label_(label),
1189 statements_(statements), 1193 statements_(statements),
1190 position_(pos), 1194 position_(pos),
1191 compare_type_(NONE), 1195 compare_type_(NONE),
1192 compare_id_(AstNode::GetNextId(isolate)), 1196 compare_id_(AstNode::GetNextId(isolate)),
1193 entry_id_(AstNode::GetNextId(isolate)) { 1197 entry_id_(AstNode::GetNextId(isolate)) {
1194 } 1198 }
1195 1199
1196 } } // namespace v8::internal 1200 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698