Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 30a9f30bbd2db2149e96e092742c858e91b41137..affa639fd37792f6e931009b61a30ec0c28f1502 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -57,6 +57,19 @@ |
namespace v8 { |
namespace internal { |
+std::ostream& operator<<(std::ostream& os, InstanceType instance_type) { |
+ switch (instance_type) { |
+#define WRITE_TYPE(TYPE) \ |
+ case TYPE: \ |
+ return os << #TYPE; |
+ INSTANCE_TYPE_LIST(WRITE_TYPE) |
+#undef WRITE_TYPE |
+ } |
+ UNREACHABLE(); |
+ return os << "UNKNOWN"; // Keep the compiler happy. |
+} |
+ |
+ |
Handle<HeapType> Object::OptimalType(Isolate* isolate, |
Representation representation) { |
if (representation.IsNone()) return HeapType::None(isolate); |
@@ -12012,12 +12025,6 @@ static void ShrinkInstanceSize(Map* map, void* data) { |
} |
-void JSFunction::CompleteInobjectSlackTracking() { |
- DCHECK(has_initial_map()); |
- initial_map()->CompleteInobjectSlackTracking(); |
-} |
- |
- |
void Map::CompleteInobjectSlackTracking() { |
// Has to be an initial map. |
DCHECK(GetBackPointer()->IsUndefined()); |
@@ -12336,9 +12343,7 @@ void JSFunction::SetInstancePrototype(Handle<JSFunction> function, |
// copy containing the new prototype. Also complete any in-object |
// slack tracking that is in progress at this point because it is |
// still tracking the old copy. |
- if (function->IsInobjectSlackTrackingInProgress()) { |
- function->CompleteInobjectSlackTracking(); |
- } |
+ function->CompleteInobjectSlackTrackingIfActive(); |
Handle<Map> initial_map(function->initial_map(), isolate); |
@@ -12568,10 +12573,7 @@ void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) { |
// Finally link initial map and constructor function. |
DCHECK(prototype->IsJSReceiver()); |
JSFunction::SetInitialMap(function, map, prototype); |
- |
- if (!function->shared()->is_generator()) { |
- function->StartInobjectSlackTracking(); |
- } |
+ map->StartInobjectSlackTracking(); |
} |
@@ -12646,7 +12648,7 @@ MaybeHandle<Map> JSFunction::GetDerivedMap(Isolate* isolate, |
JSFunction::SetInitialMap(new_target_function, map, prototype); |
map->SetConstructor(*constructor); |
- new_target_function->StartInobjectSlackTracking(); |
+ map->StartInobjectSlackTracking(); |
return map; |
} |
@@ -13198,18 +13200,16 @@ bool SharedFunctionInfo::VerifyBailoutId(BailoutId id) { |
} |
-void JSFunction::StartInobjectSlackTracking() { |
- DCHECK(has_initial_map() && !IsInobjectSlackTrackingInProgress()); |
- |
- Map* map = initial_map(); |
+void Map::StartInobjectSlackTracking() { |
+ DCHECK(!IsInobjectSlackTrackingInProgress()); |
// No tracking during the snapshot construction phase. |
Isolate* isolate = GetIsolate(); |
if (isolate->serializer_enabled()) return; |
- if (map->unused_property_fields() == 0) return; |
+ if (unused_property_fields() == 0) return; |
- map->set_counter(Map::kSlackTrackingCounterStart); |
+ set_counter(Map::kSlackTrackingCounterStart); |
} |