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

Side by Side Diff: src/ast.cc

Issue 71783003: Reland and fix "Add support for keyed-call on arrays of fast elements" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Test + fix Created 7 years, 1 month 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 } 769 }
770 770
771 771
772 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle, 772 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle,
773 CallKind call_kind) { 773 CallKind call_kind) {
774 is_monomorphic_ = oracle->CallIsMonomorphic(this); 774 is_monomorphic_ = oracle->CallIsMonomorphic(this);
775 Property* property = expression()->AsProperty(); 775 Property* property = expression()->AsProperty();
776 if (property == NULL) { 776 if (property == NULL) {
777 // Function call. Specialize for monomorphic calls. 777 // Function call. Specialize for monomorphic calls.
778 if (is_monomorphic_) target_ = oracle->GetCallTarget(this); 778 if (is_monomorphic_) target_ = oracle->GetCallTarget(this);
779 } else { 779 } else if (property->key()->IsPropertyName()) {
780 // Method call. Specialize for the receiver types seen at runtime. 780 // Method call. Specialize for the receiver types seen at runtime.
781 Literal* key = property->key()->AsLiteral(); 781 Literal* key = property->key()->AsLiteral();
782 ASSERT(key != NULL && key->value()->IsString()); 782 ASSERT(key != NULL && key->value()->IsString());
783 Handle<String> name = Handle<String>::cast(key->value()); 783 Handle<String> name = Handle<String>::cast(key->value());
784 check_type_ = oracle->GetCallCheckType(this); 784 check_type_ = oracle->GetCallCheckType(this);
785 receiver_types_.Clear(); 785 receiver_types_.Clear();
786 if (check_type_ == RECEIVER_MAP_CHECK) { 786 if (check_type_ == RECEIVER_MAP_CHECK) {
787 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); 787 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_);
788 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0; 788 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0;
789 } else { 789 } else {
790 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); 790 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate());
791 receiver_types_.Add(handle(holder_->map()), oracle->zone()); 791 receiver_types_.Add(handle(holder_->map()), oracle->zone());
792 } 792 }
793 #ifdef ENABLE_SLOW_ASSERTS 793 #ifdef ENABLE_SLOW_ASSERTS
794 if (FLAG_enable_slow_asserts) { 794 if (FLAG_enable_slow_asserts) {
795 int length = receiver_types_.length(); 795 int length = receiver_types_.length();
796 for (int i = 0; i < length; i++) { 796 for (int i = 0; i < length; i++) {
797 Handle<Map> map = receiver_types_.at(i); 797 Handle<Map> map = receiver_types_.at(i);
798 ASSERT(!map.is_null() && *map != NULL); 798 ASSERT(!map.is_null() && *map != NULL);
799 } 799 }
800 } 800 }
801 #endif 801 #endif
802 if (is_monomorphic_) { 802 if (is_monomorphic_) {
803 Handle<Map> map = receiver_types_.first(); 803 Handle<Map> map = receiver_types_.first();
804 is_monomorphic_ = ComputeTarget(map, name); 804 is_monomorphic_ = ComputeTarget(map, name);
805 } 805 }
806 } else {
807 if (is_monomorphic_) {
808 keyed_array_call_is_holey_ = oracle->KeyedArrayCallIsHoley(this);
809 }
806 } 810 }
807 } 811 }
808 812
809 813
810 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { 814 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
811 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this); 815 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this);
812 is_monomorphic_ = oracle->CallNewIsMonomorphic(this); 816 is_monomorphic_ = oracle->CallNewIsMonomorphic(this);
813 if (is_monomorphic_) { 817 if (is_monomorphic_) {
814 target_ = oracle->GetCallNewTarget(this); 818 target_ = oracle->GetCallNewTarget(this);
815 Object* value = allocation_info_cell_->value(); 819 Object* value = allocation_info_cell_->value();
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); 1330 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1327 str = arr; 1331 str = arr;
1328 } else { 1332 } else {
1329 str = DoubleToCString(value_->Number(), buffer); 1333 str = DoubleToCString(value_->Number(), buffer);
1330 } 1334 }
1331 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); 1335 return isolate_->factory()->NewStringFromAscii(CStrVector(str));
1332 } 1336 }
1333 1337
1334 1338
1335 } } // namespace v8::internal 1339 } } // 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