[crankshaft] Remove adventurous operator< for Handle<Map>.

This operator< overload is rather dangerous for handles. And we don't
actually need a std::set in the chunk builder, since duplicates are
automatically eliminated later when the code dependencies are committed.

R=jarin@chromium.org

Review URL: https://codereview.chromium.org/1214573004

Cr-Commit-Position: refs/heads/master@{#29401}
This commit is contained in:
bmeurer 2015-07-01 01:12:33 -07:00 committed by Commit bot
parent 77d566c067
commit d82c163de4
3 changed files with 8 additions and 23 deletions

View File

@ -174,13 +174,6 @@ inline Handle<T> handle(T* t) {
}
// Key comparison function for Map handles.
inline bool operator<(const Handle<Map>& lhs, const Handle<Map>& rhs) {
// This is safe because maps don't move.
return *lhs < *rhs;
}
class DeferredHandles;
class HandleScopeImplementer;

View File

@ -273,8 +273,8 @@ LChunk::LChunk(CompilationInfo* info, HGraph* graph)
instructions_(32, info->zone()),
pointer_maps_(8, info->zone()),
inlined_functions_(1, info->zone()),
deprecation_dependencies_(MapLess(), MapAllocator(info->zone())),
stability_dependencies_(MapLess(), MapAllocator(info->zone())) {}
deprecation_dependencies_(32, info->zone()),
stability_dependencies_(8, info->zone()) {}
LLabel* LChunk::GetLabel(int block_id) const {
@ -464,17 +464,13 @@ void LChunk::CommitDependencies(Handle<Code> code) const {
if (!code->is_optimized_code()) return;
HandleScope scope(isolate());
for (MapSet::const_iterator it = deprecation_dependencies_.begin(),
iend = deprecation_dependencies_.end(); it != iend; ++it) {
Handle<Map> map = *it;
for (Handle<Map> map : deprecation_dependencies_) {
DCHECK(!map->is_deprecated());
DCHECK(map->CanBeDeprecated());
Map::AddDependentCode(map, DependentCode::kTransitionGroup, code);
}
for (MapSet::const_iterator it = stability_dependencies_.begin(),
iend = stability_dependencies_.end(); it != iend; ++it) {
Handle<Map> map = *it;
for (Handle<Map> map : stability_dependencies_) {
DCHECK(map->is_stable());
DCHECK(map->CanTransition());
Map::AddDependentCode(map, DependentCode::kPrototypeCheckGroup, code);

View File

@ -665,14 +665,14 @@ class LChunk : public ZoneObject {
DCHECK(!map->is_deprecated());
if (!map->CanBeDeprecated()) return;
DCHECK(!info_->IsStub());
deprecation_dependencies_.insert(map);
deprecation_dependencies_.Add(map, zone());
}
void AddStabilityDependency(Handle<Map> map) {
DCHECK(map->is_stable());
if (!map->CanTransition()) return;
DCHECK(!info_->IsStub());
stability_dependencies_.insert(map);
stability_dependencies_.Add(map, zone());
}
Zone* zone() const { return info_->zone(); }
@ -690,10 +690,6 @@ class LChunk : public ZoneObject {
int spill_slot_count_;
private:
typedef std::less<Handle<Map> > MapLess;
typedef zone_allocator<Handle<Map> > MapAllocator;
typedef std::set<Handle<Map>, MapLess, MapAllocator> MapSet;
void RegisterWeakObjectsInOptimizedCode(Handle<Code> code) const;
void CommitDependencies(Handle<Code> code) const;
@ -703,8 +699,8 @@ class LChunk : public ZoneObject {
ZoneList<LInstruction*> instructions_;
ZoneList<LPointerMap*> pointer_maps_;
ZoneList<Handle<SharedFunctionInfo>> inlined_functions_;
MapSet deprecation_dependencies_;
MapSet stability_dependencies_;
ZoneList<Handle<Map>> deprecation_dependencies_;
ZoneList<Handle<Map>> stability_dependencies_;
};