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

Side by Side Diff: src/bootstrapper.cc

Issue 1165603002: Starting using GlobalDictionary for global objects instead of NameDictionary. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | src/factory.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/utils/random-number-generator.h" 9 #include "src/base/utils/random-number-generator.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2841 matching lines...) Expand 10 before | Expand all | Expand 10 after
2852 DCHECK(!to->HasFastProperties()); 2852 DCHECK(!to->HasFastProperties());
2853 // Add to dictionary. 2853 // Add to dictionary.
2854 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate()); 2854 Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
2855 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1, 2855 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1,
2856 PropertyCellType::kMutable); 2856 PropertyCellType::kMutable);
2857 JSObject::SetNormalizedProperty(to, key, callbacks, d); 2857 JSObject::SetNormalizedProperty(to, key, callbacks, d);
2858 break; 2858 break;
2859 } 2859 }
2860 } 2860 }
2861 } 2861 }
2862 } else if (from->IsGlobalObject()) {
2863 Handle<GlobalDictionary> properties =
2864 Handle<GlobalDictionary>(from->global_dictionary());
2865 int capacity = properties->Capacity();
2866 for (int i = 0; i < capacity; i++) {
2867 Object* raw_key(properties->KeyAt(i));
2868 if (properties->IsKey(raw_key)) {
2869 DCHECK(raw_key->IsName());
2870 // If the property is already there we skip it.
2871 Handle<Name> key(Name::cast(raw_key));
2872 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
2873 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
2874 if (it.IsFound()) continue;
2875 // Set the property.
2876 Handle<Object> value =
2877 Handle<Object>(properties->ValueAt(i), isolate());
2878 DCHECK(value->IsPropertyCell());
2879 value = handle(PropertyCell::cast(*value)->value(), isolate());
2880 if (value->IsTheHole()) continue;
2881 PropertyDetails details = properties->DetailsAt(i);
2882 DCHECK_EQ(kData, details.kind());
2883 JSObject::AddProperty(to, key, value, details.attributes());
2884 }
2885 }
2862 } else { 2886 } else {
2863 Handle<NameDictionary> properties = 2887 Handle<NameDictionary> properties =
2864 Handle<NameDictionary>(from->property_dictionary()); 2888 Handle<NameDictionary>(from->property_dictionary());
2865 int capacity = properties->Capacity(); 2889 int capacity = properties->Capacity();
2866 for (int i = 0; i < capacity; i++) { 2890 for (int i = 0; i < capacity; i++) {
2867 Object* raw_key(properties->KeyAt(i)); 2891 Object* raw_key(properties->KeyAt(i));
2868 if (properties->IsKey(raw_key)) { 2892 if (properties->IsKey(raw_key)) {
2869 DCHECK(raw_key->IsName()); 2893 DCHECK(raw_key->IsName());
2870 // If the property is already there we skip it. 2894 // If the property is already there we skip it.
2871 Handle<Name> key(Name::cast(raw_key)); 2895 Handle<Name> key(Name::cast(raw_key));
2872 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR); 2896 LookupIterator it(to, key, LookupIterator::OWN_SKIP_INTERCEPTOR);
2873 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state()); 2897 CHECK_NE(LookupIterator::ACCESS_CHECK, it.state());
2874 if (it.IsFound()) continue; 2898 if (it.IsFound()) continue;
2875 // Set the property. 2899 // Set the property.
2876 Handle<Object> value = Handle<Object>(properties->ValueAt(i), 2900 Handle<Object> value = Handle<Object>(properties->ValueAt(i),
2877 isolate()); 2901 isolate());
2878 DCHECK(!value->IsCell()); 2902 DCHECK(!value->IsCell());
2879 if (value->IsPropertyCell()) { 2903 DCHECK(!value->IsTheHole());
2880 value = handle(PropertyCell::cast(*value)->value(), isolate());
2881 }
2882 if (value->IsTheHole()) continue;
2883 PropertyDetails details = properties->DetailsAt(i); 2904 PropertyDetails details = properties->DetailsAt(i);
2884 DCHECK_EQ(kData, details.kind()); 2905 DCHECK_EQ(kData, details.kind());
2885 JSObject::AddProperty(to, key, value, details.attributes()); 2906 JSObject::AddProperty(to, key, value, details.attributes());
2886 } 2907 }
2887 } 2908 }
2888 } 2909 }
2889 } 2910 }
2890 2911
2891 2912
2892 void Genesis::TransferIndexedProperties(Handle<JSObject> from, 2913 void Genesis::TransferIndexedProperties(Handle<JSObject> from,
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
3071 return from + sizeof(NestingCounterType); 3092 return from + sizeof(NestingCounterType);
3072 } 3093 }
3073 3094
3074 3095
3075 // Called when the top-level V8 mutex is destroyed. 3096 // Called when the top-level V8 mutex is destroyed.
3076 void Bootstrapper::FreeThreadResources() { 3097 void Bootstrapper::FreeThreadResources() {
3077 DCHECK(!IsActive()); 3098 DCHECK(!IsActive());
3078 } 3099 }
3079 3100
3080 } } // namespace v8::internal 3101 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698