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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 19954005: Eliminate map checks of constant values. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Naming Created 7 years, 5 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/hydrogen-instructions.h ('k') | src/ia32/lithium-codegen-ia32.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 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 } 1673 }
1674 } 1674 }
1675 1675
1676 1676
1677 void HCheckMaps::PrintDataTo(StringStream* stream) { 1677 void HCheckMaps::PrintDataTo(StringStream* stream) {
1678 value()->PrintNameTo(stream); 1678 value()->PrintNameTo(stream);
1679 stream->Add(" [%p", *map_set()->first()); 1679 stream->Add(" [%p", *map_set()->first());
1680 for (int i = 1; i < map_set()->length(); ++i) { 1680 for (int i = 1; i < map_set()->length(); ++i) {
1681 stream->Add(",%p", *map_set()->at(i)); 1681 stream->Add(",%p", *map_set()->at(i));
1682 } 1682 }
1683 stream->Add("]"); 1683 stream->Add("]%s", CanOmitMapChecks() ? "(omitted)" : "");
1684 } 1684 }
1685 1685
1686 1686
1687 void HCheckFunction::PrintDataTo(StringStream* stream) { 1687 void HCheckFunction::PrintDataTo(StringStream* stream) {
1688 value()->PrintNameTo(stream); 1688 value()->PrintNameTo(stream);
1689 stream->Add(" %p", *target()); 1689 stream->Add(" %p", *target());
1690 } 1690 }
1691 1691
1692 1692
1693 HValue* HCheckFunction::Canonicalize() { 1693 HValue* HCheckFunction::Canonicalize() {
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
2750 // We don't have an easy way to handle both a call (to the generic stub) and 2750 // We don't have an easy way to handle both a call (to the generic stub) and
2751 // a deopt in the same hydrogen instruction, so in this case we don't add 2751 // a deopt in the same hydrogen instruction, so in this case we don't add
2752 // the negative lookups which can deopt - just let the generic stub handle 2752 // the negative lookups which can deopt - just let the generic stub handle
2753 // them. 2753 // them.
2754 SetAllSideEffects(); 2754 SetAllSideEffects();
2755 need_generic_ = true; 2755 need_generic_ = true;
2756 } 2756 }
2757 } 2757 }
2758 2758
2759 2759
2760 HCheckMaps* HCheckMaps::New(HValue* value,
2761 Handle<Map> map,
2762 Zone* zone,
2763 CompilationInfo* info,
2764 HValue* typecheck) {
2765 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck);
2766 check_map->map_set_.Add(map, zone);
2767 if (map->CanOmitMapChecks() &&
2768 value->IsConstant() &&
2769 HConstant::cast(value)->InstanceOf(map)) {
2770 check_map->omit(info);
2771 }
2772 return check_map;
2773 }
2774
2775
2760 void HCheckMaps::FinalizeUniqueValueId() { 2776 void HCheckMaps::FinalizeUniqueValueId() {
2761 if (!map_unique_ids_.is_empty()) return; 2777 if (!map_unique_ids_.is_empty()) return;
2762 Zone* zone = block()->zone(); 2778 Zone* zone = block()->zone();
2763 map_unique_ids_.Initialize(map_set_.length(), zone); 2779 map_unique_ids_.Initialize(map_set_.length(), zone);
2764 for (int i = 0; i < map_set_.length(); i++) { 2780 for (int i = 0; i < map_set_.length(); i++) {
2765 map_unique_ids_.Add(UniqueValueId(map_set_.at(i)), zone); 2781 map_unique_ids_.Add(UniqueValueId(map_set_.at(i)), zone);
2766 } 2782 }
2767 } 2783 }
2768 2784
2769 2785
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
3980 case kBackingStore: 3996 case kBackingStore:
3981 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3997 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3982 stream->Add("[backing-store]"); 3998 stream->Add("[backing-store]");
3983 break; 3999 break;
3984 } 4000 }
3985 4001
3986 stream->Add("@%d", offset()); 4002 stream->Add("@%d", offset());
3987 } 4003 }
3988 4004
3989 } } // namespace v8::internal 4005 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698