Reviewers: jarin,
Description:
[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.
[email protected]
Please review this at https://codereview.chromium.org/1214573004/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+8, -23 lines):
M src/handles.h
M src/lithium.h
M src/lithium.cc
Index: src/handles.h
diff --git a/src/handles.h b/src/handles.h
index
eb2023cf335d8cc93571d857e6268108b0e081a2..162b6d282f2cdae48f3f3141a17f5f6e5a124e57
100644
--- a/src/handles.h
+++ b/src/handles.h
@@ -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;
Index: src/lithium.cc
diff --git a/src/lithium.cc b/src/lithium.cc
index
0bebfaa96e9ae4d87339ab7a0fb6571acf190183..a9d7748ef3883c3677ce6aa3ec5f3b0832a0c72a
100644
--- a/src/lithium.cc
+++ b/src/lithium.cc
@@ -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);
Index: src/lithium.h
diff --git a/src/lithium.h b/src/lithium.h
index
c972cbd6b398c86dafc5e96eeabbc5e18c38544b..046de19fd07c3c5d6cdff3490060dc3bfd41ae7f
100644
--- a/src/lithium.h
+++ b/src/lithium.h
@@ -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_;
};
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.