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

Side by Side Diff: src/objects.cc

Issue 231283006: Work towards unifying descriptor array handling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 descriptors->InitializeRepresentations(Representation::Tagged()); 2541 descriptors->InitializeRepresentations(Representation::Tagged());
2542 2542
2543 // Unless the instance is being migrated, ensure that modify_index is a field. 2543 // Unless the instance is being migrated, ensure that modify_index is a field.
2544 PropertyDetails details = descriptors->GetDetails(modify_index); 2544 PropertyDetails details = descriptors->GetDetails(modify_index);
2545 if (store_mode == FORCE_FIELD && details.type() != FIELD) { 2545 if (store_mode == FORCE_FIELD && details.type() != FIELD) {
2546 FieldDescriptor d(handle(descriptors->GetKey(modify_index), 2546 FieldDescriptor d(handle(descriptors->GetKey(modify_index),
2547 map->GetIsolate()), 2547 map->GetIsolate()),
2548 new_map->NumberOfFields(), 2548 new_map->NumberOfFields(),
2549 attributes, 2549 attributes,
2550 Representation::Tagged()); 2550 Representation::Tagged());
2551 d.SetSortedKeyIndex(details.pointer()); 2551 descriptors->Replace(modify_index, &d);
2552 descriptors->Set(modify_index, &d);
2553 int unused_property_fields = new_map->unused_property_fields() - 1; 2552 int unused_property_fields = new_map->unused_property_fields() - 1;
2554 if (unused_property_fields < 0) { 2553 if (unused_property_fields < 0) {
2555 unused_property_fields += JSObject::kFieldsAdded; 2554 unused_property_fields += JSObject::kFieldsAdded;
2556 } 2555 }
2557 new_map->set_unused_property_fields(unused_property_fields); 2556 new_map->set_unused_property_fields(unused_property_fields);
2558 } 2557 }
2559 2558
2560 if (FLAG_trace_generalization) { 2559 if (FLAG_trace_generalization) {
2561 map->PrintGeneralization(stdout, reason, modify_index, 2560 map->PrintGeneralization(stdout, reason, modify_index,
2562 new_map->NumberOfOwnDescriptors(), 2561 new_map->NumberOfOwnDescriptors(),
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 Handle<Object> args[] = { name, object }; 3113 Handle<Object> args[] = { name, object };
3115 Handle<Object> error = isolate->factory()->NewTypeError( 3114 Handle<Object> error = isolate->factory()->NewTypeError(
3116 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args))); 3115 "strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
3117 return isolate->Throw<Object>(error); 3116 return isolate->Throw<Object>(error);
3118 } 3117 }
3119 return isolate->factory()->the_hole_value(); 3118 return isolate->factory()->the_hole_value();
3120 } 3119 }
3121 3120
3122 3121
3123 void Map::EnsureDescriptorSlack(Handle<Map> map, int slack) { 3122 void Map::EnsureDescriptorSlack(Handle<Map> map, int slack) {
3123 // Only supports adding slack to owned descriptors.
3124 ASSERT(map->owns_descriptors());
3125
3124 Handle<DescriptorArray> descriptors(map->instance_descriptors()); 3126 Handle<DescriptorArray> descriptors(map->instance_descriptors());
3127 int old_size = map->NumberOfOwnDescriptors();
3125 if (slack <= descriptors->NumberOfSlackDescriptors()) return; 3128 if (slack <= descriptors->NumberOfSlackDescriptors()) return;
3126 int number_of_descriptors = descriptors->number_of_descriptors();
3127 Isolate* isolate = map->GetIsolate();
3128 Handle<DescriptorArray> new_descriptors =
3129 isolate->factory()->NewDescriptorArray(number_of_descriptors, slack);
3130 DescriptorArray::WhitenessWitness witness(*new_descriptors);
3131 3129
3132 for (int i = 0; i < number_of_descriptors; ++i) { 3130 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo(
3133 new_descriptors->CopyFrom(i, *descriptors, i, witness); 3131 descriptors, old_size, slack);
3132
3133 if (old_size == 0) {
3134 map->set_instance_descriptors(*new_descriptors);
3135 return;
3136 }
3137
3138 // If the source descriptors had an enum cache we copy it. This ensures
3139 // that the maps to which we push the new descriptor array back can rely
3140 // on a cache always being available once it is set. If the map has more
3141 // enumerated descriptors than available in the original cache, the cache
3142 // will be lazily replaced by the extended cache when needed.
3143 if (descriptors->HasEnumCache()) {
3144 new_descriptors->CopyEnumCacheFrom(*descriptors);
3145 }
3146
3147 // Replace descriptors by new_descriptors in all maps that share it.
3148 map->GetHeap()->incremental_marking()->RecordWrites(*descriptors);
3149
3150 Map* walk_map;
3151 for (Object* current = map->GetBackPointer();
3152 !current->IsUndefined();
3153 current = walk_map->GetBackPointer()) {
3154 walk_map = Map::cast(current);
3155 if (walk_map->instance_descriptors() != *descriptors) break;
3156 walk_map->set_instance_descriptors(*new_descriptors);
3134 } 3157 }
3135 3158
3136 map->set_instance_descriptors(*new_descriptors); 3159 map->set_instance_descriptors(*new_descriptors);
3137 } 3160 }
3138 3161
3139 3162
3140 template<class T> 3163 template<class T>
3141 static int AppendUniqueCallbacks(NeanderArray* callbacks, 3164 static int AppendUniqueCallbacks(NeanderArray* callbacks,
3142 Handle<typename T::Array> array, 3165 Handle<typename T::Array> array,
3143 int valid_descriptors) { 3166 int valid_descriptors) {
(...skipping 3689 matching lines...) Expand 10 before | Expand all | Expand 10 after
6833 6856
6834 6857
6835 Handle<Map> Map::ShareDescriptor(Handle<Map> map, 6858 Handle<Map> Map::ShareDescriptor(Handle<Map> map,
6836 Handle<DescriptorArray> descriptors, 6859 Handle<DescriptorArray> descriptors,
6837 Descriptor* descriptor) { 6860 Descriptor* descriptor) {
6838 // Sanity check. This path is only to be taken if the map owns its descriptor 6861 // Sanity check. This path is only to be taken if the map owns its descriptor
6839 // array, implying that its NumberOfOwnDescriptors equals the number of 6862 // array, implying that its NumberOfOwnDescriptors equals the number of
6840 // descriptors in the descriptor array. 6863 // descriptors in the descriptor array.
6841 ASSERT(map->NumberOfOwnDescriptors() == 6864 ASSERT(map->NumberOfOwnDescriptors() ==
6842 map->instance_descriptors()->number_of_descriptors()); 6865 map->instance_descriptors()->number_of_descriptors());
6866
6843 Handle<Map> result = Map::CopyDropDescriptors(map); 6867 Handle<Map> result = Map::CopyDropDescriptors(map);
6844
6845 Handle<Name> name = descriptor->GetKey(); 6868 Handle<Name> name = descriptor->GetKey();
6846
6847 Handle<TransitionArray> transitions = 6869 Handle<TransitionArray> transitions =
6848 Map::AddTransition(map, name, result, SIMPLE_TRANSITION); 6870 Map::AddTransition(map, name, result, SIMPLE_TRANSITION);
6849 6871
6850 if (descriptors->NumberOfSlackDescriptors() > 0) { 6872 // Ensure there's space for the new descriptor in the shared descriptor array.
6851 descriptors->Append(descriptor); 6873 if (descriptors->NumberOfSlackDescriptors() == 0) {
6852 result->SetBackPointer(*map);
6853 result->InitializeDescriptors(*descriptors);
6854 } else {
6855 int old_size = descriptors->number_of_descriptors(); 6874 int old_size = descriptors->number_of_descriptors();
6856 // Descriptor arrays grow by 50%. 6875 if (old_size == 0) {
6857 Handle<DescriptorArray> new_descriptors = 6876 descriptors = map->GetIsolate()->factory()->NewDescriptorArray(0, 1);
6858 map->GetIsolate()->factory()->NewDescriptorArray( 6877 } else {
6859 old_size, old_size < 4 ? 1 : old_size / 2); 6878 Map::EnsureDescriptorSlack(map, old_size < 4 ? 1 : old_size / 2);
6879 descriptors = handle(map->instance_descriptors());
6880 }
6881 }
6860 6882
6861 DisallowHeapAllocation no_gc; 6883 // Commit the state atomically.
6862 DescriptorArray::WhitenessWitness witness(*new_descriptors); 6884 DisallowHeapAllocation no_gc;
6863 6885
6864 // Copy the descriptors, inserting a descriptor. 6886 descriptors->Append(descriptor);
6865 for (int i = 0; i < old_size; ++i) { 6887 result->SetBackPointer(*map);
6866 new_descriptors->CopyFrom(i, *descriptors, i, witness); 6888 result->InitializeDescriptors(*descriptors);
6867 }
6868
6869 new_descriptors->Append(descriptor, witness);
6870
6871 if (old_size > 0) {
6872 // If the source descriptors had an enum cache we copy it. This ensures
6873 // that the maps to which we push the new descriptor array back can rely
6874 // on a cache always being available once it is set. If the map has more
6875 // enumerated descriptors than available in the original cache, the cache
6876 // will be lazily replaced by the extended cache when needed.
6877 if (descriptors->HasEnumCache()) {
6878 new_descriptors->CopyEnumCacheFrom(*descriptors);
6879 }
6880
6881 Map* walk_map;
6882 // Replace descriptors by new_descriptors in all maps that share it.
6883
6884 map->GetHeap()->incremental_marking()->RecordWrites(*descriptors);
6885 for (Object* current = map->GetBackPointer();
6886 !current->IsUndefined();
6887 current = walk_map->GetBackPointer()) {
6888 walk_map = Map::cast(current);
6889 if (walk_map->instance_descriptors() != *descriptors) break;
6890 walk_map->set_instance_descriptors(*new_descriptors);
6891 }
6892
6893 map->set_instance_descriptors(*new_descriptors);
6894 }
6895
6896 result->SetBackPointer(*map);
6897 result->InitializeDescriptors(*new_descriptors);
6898 }
6899 6889
6900 ASSERT(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1); 6890 ASSERT(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1);
6901 6891
6902 map->set_transitions(*transitions); 6892 map->set_transitions(*transitions);
6903 map->set_owns_descriptors(false); 6893 map->set_owns_descriptors(false);
6904 6894
6905 return result; 6895 return result;
6906 } 6896 }
6907 6897
6908 6898
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
7091 7081
7092 7082
7093 Handle<Map> Map::CopyAddDescriptor(Handle<Map> map, 7083 Handle<Map> Map::CopyAddDescriptor(Handle<Map> map,
7094 Descriptor* descriptor, 7084 Descriptor* descriptor,
7095 TransitionFlag flag) { 7085 TransitionFlag flag) {
7096 Handle<DescriptorArray> descriptors(map->instance_descriptors()); 7086 Handle<DescriptorArray> descriptors(map->instance_descriptors());
7097 7087
7098 // Ensure the key is unique. 7088 // Ensure the key is unique.
7099 descriptor->KeyToUniqueName(); 7089 descriptor->KeyToUniqueName();
7100 7090
7101 int old_size = map->NumberOfOwnDescriptors();
7102 int new_size = old_size + 1;
7103
7104 if (flag == INSERT_TRANSITION && 7091 if (flag == INSERT_TRANSITION &&
7105 map->owns_descriptors() && 7092 map->owns_descriptors() &&
7106 map->CanHaveMoreTransitions()) { 7093 map->CanHaveMoreTransitions()) {
7107 return Map::ShareDescriptor(map, descriptors, descriptor); 7094 return Map::ShareDescriptor(map, descriptors, descriptor);
7108 } 7095 }
7109 7096
7110 Handle<DescriptorArray> new_descriptors = 7097 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo(
7111 map->GetIsolate()->factory()->NewDescriptorArray(old_size, 1); 7098 descriptors, map->NumberOfOwnDescriptors(), 1);
7099 new_descriptors->Append(descriptor);
7112 7100
7113 DescriptorArray::WhitenessWitness witness(*new_descriptors);
7114
7115 // Copy the descriptors, inserting a descriptor.
7116 for (int i = 0; i < old_size; ++i) {
7117 new_descriptors->CopyFrom(i, *descriptors, i, witness);
7118 }
7119
7120 if (old_size != descriptors->number_of_descriptors()) {
7121 new_descriptors->SetNumberOfDescriptors(new_size);
7122 new_descriptors->Set(old_size, descriptor, witness);
7123 new_descriptors->Sort();
7124 } else {
7125 new_descriptors->Append(descriptor, witness);
7126 }
7127
7128 Handle<Name> key = descriptor->GetKey();
7129 return Map::CopyReplaceDescriptors( 7101 return Map::CopyReplaceDescriptors(
7130 map, new_descriptors, flag, key, SIMPLE_TRANSITION); 7102 map, new_descriptors, flag, descriptor->GetKey(), SIMPLE_TRANSITION);
7131 } 7103 }
7132 7104
7133 7105
7134 Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map, 7106 Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map,
7135 Descriptor* descriptor, 7107 Descriptor* descriptor,
7136 TransitionFlag flag) { 7108 TransitionFlag flag) {
7137 Handle<DescriptorArray> old_descriptors(map->instance_descriptors()); 7109 Handle<DescriptorArray> old_descriptors(map->instance_descriptors());
7138 7110
7139 // Ensure the key is unique. 7111 // Ensure the key is unique.
7140 descriptor->KeyToUniqueName(); 7112 descriptor->KeyToUniqueName();
7141 7113
7142 // We replace the key if it is already present. 7114 // We replace the key if it is already present.
7143 int index = old_descriptors->SearchWithCache(*descriptor->GetKey(), *map); 7115 int index = old_descriptors->SearchWithCache(*descriptor->GetKey(), *map);
7144 if (index != DescriptorArray::kNotFound) { 7116 if (index != DescriptorArray::kNotFound) {
7145 return Map::CopyReplaceDescriptor( 7117 return Map::CopyReplaceDescriptor(
7146 map, old_descriptors, descriptor, index, flag); 7118 map, old_descriptors, descriptor, index, flag);
7147 } 7119 }
7148 return Map::CopyAddDescriptor(map, descriptor, flag); 7120 return Map::CopyAddDescriptor(map, descriptor, flag);
7149 } 7121 }
7150 7122
7151 7123
7152 Handle<DescriptorArray> DescriptorArray::CopyUpTo( 7124 Handle<DescriptorArray> DescriptorArray::CopyUpTo(
7153 Handle<DescriptorArray> desc, 7125 Handle<DescriptorArray> desc,
7154 int enumeration_index) { 7126 int enumeration_index,
7155 return DescriptorArray::CopyUpToAddAttributes(desc, 7127 int slack) {
7156 enumeration_index, 7128 return DescriptorArray::CopyUpToAddAttributes(
7157 NONE); 7129 desc, enumeration_index, NONE, slack);
7158 } 7130 }
7159 7131
7160 7132
7161 Handle<DescriptorArray> DescriptorArray::CopyUpToAddAttributes( 7133 Handle<DescriptorArray> DescriptorArray::CopyUpToAddAttributes(
7162 Handle<DescriptorArray> desc, 7134 Handle<DescriptorArray> desc,
7163 int enumeration_index, 7135 int enumeration_index,
7164 PropertyAttributes attributes) { 7136 PropertyAttributes attributes,
7165 if (enumeration_index == 0) { 7137 int slack) {
7138 if (enumeration_index + slack == 0) {
7166 return desc->GetIsolate()->factory()->empty_descriptor_array(); 7139 return desc->GetIsolate()->factory()->empty_descriptor_array();
7167 } 7140 }
7168 7141
7169 int size = enumeration_index; 7142 int size = enumeration_index;
7170 7143
7171 Handle<DescriptorArray> descriptors = 7144 Handle<DescriptorArray> descriptors =
7172 desc->GetIsolate()->factory()->NewDescriptorArray(size); 7145 desc->GetIsolate()->factory()->NewDescriptorArray(size, slack);
7173 DescriptorArray::WhitenessWitness witness(*descriptors); 7146 DescriptorArray::WhitenessWitness witness(*descriptors);
7174 7147
7175 if (attributes != NONE) { 7148 if (attributes != NONE) {
7176 for (int i = 0; i < size; ++i) { 7149 for (int i = 0; i < size; ++i) {
7177 Object* value = desc->GetValue(i); 7150 Object* value = desc->GetValue(i);
7178 PropertyDetails details = desc->GetDetails(i); 7151 PropertyDetails details = desc->GetDetails(i);
7179 int mask = DONT_DELETE | DONT_ENUM; 7152 int mask = DONT_DELETE | DONT_ENUM;
7180 // READ_ONLY is an invalid attribute for JS setters/getters. 7153 // READ_ONLY is an invalid attribute for JS setters/getters.
7181 if (details.type() != CALLBACKS || !value->IsAccessorPair()) { 7154 if (details.type() != CALLBACKS || !value->IsAccessorPair()) {
7182 mask |= READ_ONLY; 7155 mask |= READ_ONLY;
7183 } 7156 }
7184 details = details.CopyAddAttributes( 7157 details = details.CopyAddAttributes(
7185 static_cast<PropertyAttributes>(attributes & mask)); 7158 static_cast<PropertyAttributes>(attributes & mask));
7186 Descriptor inner_desc(handle(desc->GetKey(i)), 7159 Descriptor inner_desc(handle(desc->GetKey(i)),
7187 handle(value, desc->GetIsolate()), 7160 handle(value, desc->GetIsolate()),
7188 details); 7161 details);
7189 descriptors->Set(i, &inner_desc, witness); 7162 descriptors->Set(i, &inner_desc, witness);
7190 } 7163 }
7191 } else { 7164 } else {
7192 for (int i = 0; i < size; ++i) { 7165 for (int i = 0; i < size; ++i) {
7193 descriptors->CopyFrom(i, *desc, i, witness); 7166 descriptors->CopyFrom(i, *desc, witness);
7194 } 7167 }
7195 } 7168 }
7196 7169
7197 if (desc->number_of_descriptors() != enumeration_index) descriptors->Sort(); 7170 if (desc->number_of_descriptors() != enumeration_index) descriptors->Sort();
7198 7171
7199 return descriptors; 7172 return descriptors;
7200 } 7173 }
7201 7174
7202 7175
7203 Handle<Map> Map::CopyReplaceDescriptor(Handle<Map> map, 7176 Handle<Map> Map::CopyReplaceDescriptor(Handle<Map> map,
7204 Handle<DescriptorArray> descriptors, 7177 Handle<DescriptorArray> descriptors,
7205 Descriptor* descriptor, 7178 Descriptor* descriptor,
7206 int insertion_index, 7179 int insertion_index,
7207 TransitionFlag flag) { 7180 TransitionFlag flag) {
7208 // Ensure the key is unique. 7181 // Ensure the key is unique.
7209 descriptor->KeyToUniqueName(); 7182 descriptor->KeyToUniqueName();
7210 7183
7211 Handle<Name> key = descriptor->GetKey(); 7184 Handle<Name> key = descriptor->GetKey();
7212 ASSERT(*key == descriptors->GetKey(insertion_index)); 7185 ASSERT(*key == descriptors->GetKey(insertion_index));
7213 7186
7214 int new_size = map->NumberOfOwnDescriptors(); 7187 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo(
7215 ASSERT(0 <= insertion_index && insertion_index < new_size); 7188 descriptors, map->NumberOfOwnDescriptors());
7216 7189
7217 ASSERT_LT(insertion_index, new_size); 7190 new_descriptors->Replace(insertion_index, descriptor);
7218
7219 Handle<DescriptorArray> new_descriptors =
7220 map->GetIsolate()->factory()->NewDescriptorArray(new_size);
7221 DescriptorArray::WhitenessWitness witness(*new_descriptors);
7222
7223 for (int i = 0; i < new_size; ++i) {
7224 if (i == insertion_index) {
7225 new_descriptors->Set(i, descriptor, witness);
7226 } else {
7227 new_descriptors->CopyFrom(i, *descriptors, i, witness);
7228 }
7229 }
7230
7231 new_descriptors->Sort();
7232 7191
7233 SimpleTransitionFlag simple_flag = 7192 SimpleTransitionFlag simple_flag =
7234 (insertion_index == descriptors->number_of_descriptors() - 1) 7193 (insertion_index == descriptors->number_of_descriptors() - 1)
7235 ? SIMPLE_TRANSITION 7194 ? SIMPLE_TRANSITION
7236 : FULL_TRANSITION; 7195 : FULL_TRANSITION;
7237 return Map::CopyReplaceDescriptors( 7196 return Map::CopyReplaceDescriptors(
7238 map, new_descriptors, flag, key, simple_flag); 7197 map, new_descriptors, flag, key, simple_flag);
7239 } 7198 }
7240 7199
7241 7200
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
8051 result->set(kEnumCacheIndex, Smi::FromInt(0)); 8010 result->set(kEnumCacheIndex, Smi::FromInt(0));
8052 return result; 8011 return result;
8053 } 8012 }
8054 8013
8055 8014
8056 void DescriptorArray::ClearEnumCache() { 8015 void DescriptorArray::ClearEnumCache() {
8057 set(kEnumCacheIndex, Smi::FromInt(0)); 8016 set(kEnumCacheIndex, Smi::FromInt(0));
8058 } 8017 }
8059 8018
8060 8019
8020 void DescriptorArray::Replace(int index, Descriptor* descriptor) {
8021 descriptor->SetSortedKeyIndex(GetSortedKeyIndex(index));
8022 Set(index, descriptor);
8023 }
8024
8025
8061 void DescriptorArray::SetEnumCache(FixedArray* bridge_storage, 8026 void DescriptorArray::SetEnumCache(FixedArray* bridge_storage,
8062 FixedArray* new_cache, 8027 FixedArray* new_cache,
8063 Object* new_index_cache) { 8028 Object* new_index_cache) {
8064 ASSERT(bridge_storage->length() >= kEnumCacheBridgeLength); 8029 ASSERT(bridge_storage->length() >= kEnumCacheBridgeLength);
8065 ASSERT(new_index_cache->IsSmi() || new_index_cache->IsFixedArray()); 8030 ASSERT(new_index_cache->IsSmi() || new_index_cache->IsFixedArray());
8066 ASSERT(!IsEmpty()); 8031 ASSERT(!IsEmpty());
8067 ASSERT(!HasEnumCache() || new_cache->length() > GetEnumCache()->length()); 8032 ASSERT(!HasEnumCache() || new_cache->length() > GetEnumCache()->length());
8068 FixedArray::cast(bridge_storage)-> 8033 FixedArray::cast(bridge_storage)->
8069 set(kEnumCacheBridgeCacheIndex, new_cache); 8034 set(kEnumCacheBridgeCacheIndex, new_cache);
8070 FixedArray::cast(bridge_storage)-> 8035 FixedArray::cast(bridge_storage)->
8071 set(kEnumCacheBridgeIndicesCacheIndex, new_index_cache); 8036 set(kEnumCacheBridgeIndicesCacheIndex, new_index_cache);
8072 set(kEnumCacheIndex, bridge_storage); 8037 set(kEnumCacheIndex, bridge_storage);
8073 } 8038 }
8074 8039
8075 8040
8076 void DescriptorArray::CopyFrom(int dst_index, 8041 void DescriptorArray::CopyFrom(int index,
8077 DescriptorArray* src, 8042 DescriptorArray* src,
8078 int src_index,
8079 const WhitenessWitness& witness) { 8043 const WhitenessWitness& witness) {
8080 Object* value = src->GetValue(src_index); 8044 Object* value = src->GetValue(index);
8081 PropertyDetails details = src->GetDetails(src_index); 8045 PropertyDetails details = src->GetDetails(index);
8082 Descriptor desc(handle(src->GetKey(src_index)), 8046 Descriptor desc(handle(src->GetKey(index)),
8083 handle(value, src->GetIsolate()), 8047 handle(value, src->GetIsolate()),
8084 details); 8048 details);
8085 Set(dst_index, &desc, witness); 8049 Set(index, &desc, witness);
8086 } 8050 }
8087 8051
8088 8052
8089 // Creates a new descriptor array by merging the descriptor array of |right_map| 8053 // Creates a new descriptor array by merging the descriptor array of |right_map|
8090 // into the (at least partly) updated descriptor array of |left_map|. 8054 // into the (at least partly) updated descriptor array of |left_map|.
8091 // The method merges two descriptor array in three parts. Both descriptor arrays 8055 // The method merges two descriptor array in three parts. Both descriptor arrays
8092 // are identical up to |verbatim|. They also overlap in keys up to |valid|. 8056 // are identical up to |verbatim|. They also overlap in keys up to |valid|.
8093 // Between |verbatim| and |valid|, the resulting descriptor type as well as the 8057 // Between |verbatim| and |valid|, the resulting descriptor type as well as the
8094 // representation are generalized from both |left_map| and |right_map|. Beyond 8058 // representation are generalized from both |left_map| and |right_map|. Beyond
8095 // |valid|, the descriptors are copied verbatim from |right_map| up to 8059 // |valid|, the descriptors are copied verbatim from |right_map| up to
(...skipping 8575 matching lines...) Expand 10 before | Expand all | Expand 10 after
16671 #define ERROR_MESSAGES_TEXTS(C, T) T, 16635 #define ERROR_MESSAGES_TEXTS(C, T) T,
16672 static const char* error_messages_[] = { 16636 static const char* error_messages_[] = {
16673 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16637 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16674 }; 16638 };
16675 #undef ERROR_MESSAGES_TEXTS 16639 #undef ERROR_MESSAGES_TEXTS
16676 return error_messages_[reason]; 16640 return error_messages_[reason];
16677 } 16641 }
16678 16642
16679 16643
16680 } } // namespace v8::internal 16644 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698