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

Unified Diff: src/objects.cc

Issue 1488023002: Fix inobject slack tracking for both subclassing and non-subclassing cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moved and updated comments about slack tracking Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698