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

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

Issue 19888006: Also eliminate map checks with transitions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add test 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') | test/mjsunit/omit-constant-mapcheck.js » ('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 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 check_map->map_set_.Add(map, zone); 2784 check_map->map_set_.Add(map, zone);
2785 if (map->CanOmitMapChecks() && 2785 if (map->CanOmitMapChecks() &&
2786 value->IsConstant() && 2786 value->IsConstant() &&
2787 HConstant::cast(value)->InstanceOf(map)) { 2787 HConstant::cast(value)->InstanceOf(map)) {
2788 check_map->omit(info); 2788 check_map->omit(info);
2789 } 2789 }
2790 return check_map; 2790 return check_map;
2791 } 2791 }
2792 2792
2793 2793
2794 HCheckMaps* HCheckMaps::NewWithTransitions(HValue* value,
2795 Handle<Map> map,
2796 Zone* zone,
2797 CompilationInfo* info) {
2798 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, value);
2799 check_map->map_set_.Add(map, zone);
2800
2801 // Since transitioned elements maps of the initial map don't fail the map
2802 // check, the CheckMaps instruction doesn't need to depend on ElementsKinds.
2803 check_map->ClearGVNFlag(kDependsOnElementsKind);
2804
2805 ElementsKind kind = map->elements_kind();
2806 bool packed = IsFastPackedElementsKind(kind);
2807 while (CanTransitionToMoreGeneralFastElementsKind(kind, packed)) {
2808 kind = GetNextMoreGeneralFastElementsKind(kind, packed);
2809 Map* transitioned_map =
2810 map->LookupElementsTransitionMap(kind);
2811 if (transitioned_map) {
2812 check_map->map_set_.Add(Handle<Map>(transitioned_map), zone);
2813 }
2814 };
2815
2816 if (map->CanOmitMapChecks() &&
2817 value->IsConstant() &&
2818 HConstant::cast(value)->InstanceOf(map)) {
2819 check_map->omit(info);
2820 }
2821
2822 check_map->map_set_.Sort();
2823 return check_map;
2824 }
2825
2826
2794 void HCheckMaps::FinalizeUniqueValueId() { 2827 void HCheckMaps::FinalizeUniqueValueId() {
2795 if (!map_unique_ids_.is_empty()) return; 2828 if (!map_unique_ids_.is_empty()) return;
2796 Zone* zone = block()->zone(); 2829 Zone* zone = block()->zone();
2797 map_unique_ids_.Initialize(map_set_.length(), zone); 2830 map_unique_ids_.Initialize(map_set_.length(), zone);
2798 for (int i = 0; i < map_set_.length(); i++) { 2831 for (int i = 0; i < map_set_.length(); i++) {
2799 map_unique_ids_.Add(UniqueValueId(map_set_.at(i)), zone); 2832 map_unique_ids_.Add(UniqueValueId(map_set_.at(i)), zone);
2800 } 2833 }
2801 } 2834 }
2802 2835
2803 2836
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
4014 case kBackingStore: 4047 case kBackingStore:
4015 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 4048 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
4016 stream->Add("[backing-store]"); 4049 stream->Add("[backing-store]");
4017 break; 4050 break;
4018 } 4051 }
4019 4052
4020 stream->Add("@%d", offset()); 4053 stream->Add("@%d", offset());
4021 } 4054 }
4022 4055
4023 } } // namespace v8::internal 4056 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | test/mjsunit/omit-constant-mapcheck.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698