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

Side by Side Diff: src/snapshot/serialize.cc

Issue 1276353004: Fasterify JSObject::UnregisterPrototypeUser (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix compaction<->serialization interaction Created 5 years, 4 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
« no previous file with comments | « src/objects-printer.cc ('k') | test/cctest/test-heap.cc » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 1908 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 1919
1920 // We cannot serialize typed array objects correctly. 1920 // We cannot serialize typed array objects correctly.
1921 DCHECK(!object_->IsJSTypedArray()); 1921 DCHECK(!object_->IsJSTypedArray());
1922 1922
1923 // We don't expect fillers. 1923 // We don't expect fillers.
1924 DCHECK(!object_->IsFiller()); 1924 DCHECK(!object_->IsFiller());
1925 1925
1926 if (object_->IsPrototypeInfo()) { 1926 if (object_->IsPrototypeInfo()) {
1927 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users(); 1927 Object* prototype_users = PrototypeInfo::cast(object_)->prototype_users();
1928 if (prototype_users->IsWeakFixedArray()) { 1928 if (prototype_users->IsWeakFixedArray()) {
1929 WeakFixedArray::cast(prototype_users)->Compact(); 1929 WeakFixedArray* array = WeakFixedArray::cast(prototype_users);
1930 array->Compact<JSObject::PrototypeRegistryCompactionCallback>();
1931 }
1932 }
1933 // Compaction of a prototype users list can require the registered users
1934 // to update their remembered slots. That doesn't work if those users
1935 // have already been serialized themselves. So if this object is a
1936 // registered user, compact its prototype's user list now.
1937 if (object_->IsMap()) {
1938 Map* map = Map::cast(object_);
1939 if (map->is_prototype_map() && map->prototype_info()->IsPrototypeInfo() &&
1940 PrototypeInfo::cast(map->prototype_info())->registry_slot() !=
1941 PrototypeInfo::UNREGISTERED) {
1942 JSObject* proto = JSObject::cast(map->prototype());
1943 PrototypeInfo* info = PrototypeInfo::cast(proto->map()->prototype_info());
1944 WeakFixedArray* array = WeakFixedArray::cast(info->prototype_users());
1945 array->Compact<JSObject::PrototypeRegistryCompactionCallback>();
1930 } 1946 }
1931 } 1947 }
1932 1948
1933 if (object_->IsScript()) { 1949 if (object_->IsScript()) {
1934 // Clear cached line ends. 1950 // Clear cached line ends.
1935 Object* undefined = serializer_->isolate()->heap()->undefined_value(); 1951 Object* undefined = serializer_->isolate()->heap()->undefined_value();
1936 Script::cast(object_)->set_line_ends(undefined); 1952 Script::cast(object_)->set_line_ends(undefined);
1937 Object* shared_list = Script::cast(object_)->shared_function_infos(); 1953 Object* shared_list = Script::cast(object_)->shared_function_infos();
1938 if (shared_list->IsWeakFixedArray()) { 1954 if (shared_list->IsWeakFixedArray()) {
1939 WeakFixedArray::cast(shared_list)->Compact(); 1955 WeakFixedArray::cast(shared_list)
1956 ->Compact<WeakFixedArray::NullCallback>();
1940 } 1957 }
1941 } 1958 }
1942 1959
1943 if (object_->IsExternalString()) { 1960 if (object_->IsExternalString()) {
1944 Heap* heap = serializer_->isolate()->heap(); 1961 Heap* heap = serializer_->isolate()->heap();
1945 if (object_->map() != heap->native_source_string_map()) { 1962 if (object_->map() != heap->native_source_string_map()) {
1946 // Usually we cannot recreate resources for external strings. To work 1963 // Usually we cannot recreate resources for external strings. To work
1947 // around this, external strings are serialized to look like ordinary 1964 // around this, external strings are serialized to look like ordinary
1948 // sequential strings. 1965 // sequential strings.
1949 // The exception are native source code strings, since we can recreate 1966 // The exception are native source code strings, since we can recreate
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2800 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2784 SanityCheckResult r = scd->SanityCheck(isolate, source); 2801 SanityCheckResult r = scd->SanityCheck(isolate, source);
2785 if (r == CHECK_SUCCESS) return scd; 2802 if (r == CHECK_SUCCESS) return scd;
2786 cached_data->Reject(); 2803 cached_data->Reject();
2787 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2804 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2788 delete scd; 2805 delete scd;
2789 return NULL; 2806 return NULL;
2790 } 2807 }
2791 } // namespace internal 2808 } // namespace internal
2792 } // namespace v8 2809 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698