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

Side by Side Diff: src/ast.cc

Issue 23615012: Properly filter types using the initial map from HAllocate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments 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/ast.h ('k') | src/hydrogen.cc » ('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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 is_monomorphic_ = oracle->CallIsMonomorphic(this); 639 is_monomorphic_ = oracle->CallIsMonomorphic(this);
640 Property* property = expression()->AsProperty(); 640 Property* property = expression()->AsProperty();
641 if (property == NULL) { 641 if (property == NULL) {
642 // Function call. Specialize for monomorphic calls. 642 // Function call. Specialize for monomorphic calls.
643 if (is_monomorphic_) target_ = oracle->GetCallTarget(this); 643 if (is_monomorphic_) target_ = oracle->GetCallTarget(this);
644 } else { 644 } else {
645 // Method call. Specialize for the receiver types seen at runtime. 645 // Method call. Specialize for the receiver types seen at runtime.
646 Literal* key = property->key()->AsLiteral(); 646 Literal* key = property->key()->AsLiteral();
647 ASSERT(key != NULL && key->value()->IsString()); 647 ASSERT(key != NULL && key->value()->IsString());
648 Handle<String> name = Handle<String>::cast(key->value()); 648 Handle<String> name = Handle<String>::cast(key->value());
649 check_type_ = oracle->GetCallCheckType(this);
649 receiver_types_.Clear(); 650 receiver_types_.Clear();
650 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_); 651 if (check_type_ == RECEIVER_MAP_CHECK) {
652 oracle->CallReceiverTypes(this, name, call_kind, &receiver_types_);
653 is_monomorphic_ = is_monomorphic_ && receiver_types_.length() > 0;
654 } else {
655 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate());
Michael Starzinger 2013/09/06 09:34:40 Does it hold that "receiver_types_.IsEmpty()" down
Toon Verwaest 2013/09/06 11:24:28 The receiver_types_ are Clear()ed right above, so
656 receiver_types_.Add(handle(holder_->map()), oracle->zone());
657 }
651 #ifdef DEBUG 658 #ifdef DEBUG
652 if (FLAG_enable_slow_asserts) { 659 if (FLAG_enable_slow_asserts) {
653 int length = receiver_types_.length(); 660 int length = receiver_types_.length();
654 for (int i = 0; i < length; i++) { 661 for (int i = 0; i < length; i++) {
655 Handle<Map> map = receiver_types_.at(i); 662 Handle<Map> map = receiver_types_.at(i);
656 ASSERT(!map.is_null() && *map != NULL); 663 ASSERT(!map.is_null() && *map != NULL);
657 } 664 }
658 } 665 }
659 #endif 666 #endif
660 check_type_ = oracle->GetCallCheckType(this);
661 if (is_monomorphic_) { 667 if (is_monomorphic_) {
662 Handle<Map> map; 668 Handle<Map> map = receiver_types_.first();
663 if (receiver_types_.length() > 0) {
664 ASSERT(check_type_ == RECEIVER_MAP_CHECK);
665 map = receiver_types_.at(0);
666 } else {
667 ASSERT(check_type_ != RECEIVER_MAP_CHECK);
668 holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate());
669 map = Handle<Map>(holder_->map());
670 }
671 is_monomorphic_ = ComputeTarget(map, name); 669 is_monomorphic_ = ComputeTarget(map, name);
672 } 670 }
673 } 671 }
674 } 672 }
675 673
676 674
677 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { 675 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) {
678 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this); 676 allocation_info_cell_ = oracle->GetCallNewAllocationInfoCell(this);
679 is_monomorphic_ = oracle->CallNewIsMonomorphic(this); 677 is_monomorphic_ = oracle->CallNewIsMonomorphic(this);
680 if (is_monomorphic_) { 678 if (is_monomorphic_) {
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value()); 1190 OS::SNPrintF(buffer, "%d", Smi::cast(*value_)->value());
1193 str = arr; 1191 str = arr;
1194 } else { 1192 } else {
1195 str = DoubleToCString(value_->Number(), buffer); 1193 str = DoubleToCString(value_->Number(), buffer);
1196 } 1194 }
1197 return isolate_->factory()->NewStringFromAscii(CStrVector(str)); 1195 return isolate_->factory()->NewStringFromAscii(CStrVector(str));
1198 } 1196 }
1199 1197
1200 1198
1201 } } // namespace v8::internal 1199 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698