OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 6222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6233 DCHECK(array->length() >= length); | 6233 DCHECK(array->length() >= length); |
6234 if (array->length() == length) return array; | 6234 if (array->length() == length) return array; |
6235 | 6235 |
6236 Handle<FixedArray> new_array = | 6236 Handle<FixedArray> new_array = |
6237 array->GetIsolate()->factory()->NewFixedArray(length); | 6237 array->GetIsolate()->factory()->NewFixedArray(length); |
6238 for (int i = 0; i < length; ++i) new_array->set(i, array->get(i)); | 6238 for (int i = 0; i < length; ++i) new_array->set(i, array->get(i)); |
6239 return new_array; | 6239 return new_array; |
6240 } | 6240 } |
6241 | 6241 |
6242 | 6242 |
6243 static Handle<FixedArray> GetEnumPropertyKeys(Handle<JSObject> object, | 6243 Handle<FixedArray> JSObject::GetEnumPropertyKeys(Handle<JSObject> object, |
6244 bool cache_result) { | 6244 bool cache_result) { |
6245 Isolate* isolate = object->GetIsolate(); | 6245 Isolate* isolate = object->GetIsolate(); |
6246 if (object->HasFastProperties()) { | 6246 if (object->HasFastProperties()) { |
6247 int own_property_count = object->map()->EnumLength(); | 6247 int own_property_count = object->map()->EnumLength(); |
6248 // If the enum length of the given map is set to kInvalidEnumCache, this | 6248 // If the enum length of the given map is set to kInvalidEnumCache, this |
6249 // means that the map itself has never used the present enum cache. The | 6249 // means that the map itself has never used the present enum cache. The |
6250 // first step to using the cache is to set the enum length of the map by | 6250 // first step to using the cache is to set the enum length of the map by |
6251 // counting the number of own descriptors that are not DONT_ENUM or | 6251 // counting the number of own descriptors that are not DONT_ENUM or |
6252 // SYMBOLIC. | 6252 // SYMBOLIC. |
6253 if (own_property_count == kInvalidEnumCacheSentinel) { | 6253 if (own_property_count == kInvalidEnumCacheSentinel) { |
6254 own_property_count = object->map()->NumberOfDescribedProperties( | 6254 own_property_count = object->map()->NumberOfDescribedProperties( |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6415 // array or dictionary. So the fast inline test for whether to | 6415 // array or dictionary. So the fast inline test for whether to |
6416 // use the cache says yes, so we should not create a cache. | 6416 // use the cache says yes, so we should not create a cache. |
6417 bool cache_enum_keys = | 6417 bool cache_enum_keys = |
6418 ((current->map()->GetConstructor() != *arguments_function) && | 6418 ((current->map()->GetConstructor() != *arguments_function) && |
6419 !current->IsJSValue() && !current->IsAccessCheckNeeded() && | 6419 !current->IsJSValue() && !current->IsAccessCheckNeeded() && |
6420 !current->HasNamedInterceptor() && !current->HasIndexedInterceptor()); | 6420 !current->HasNamedInterceptor() && !current->HasIndexedInterceptor()); |
6421 // Compute the property keys and cache them if possible. | 6421 // Compute the property keys and cache them if possible. |
6422 ASSIGN_RETURN_ON_EXCEPTION( | 6422 ASSIGN_RETURN_ON_EXCEPTION( |
6423 isolate, content, | 6423 isolate, content, |
6424 FixedArray::UnionOfKeys( | 6424 FixedArray::UnionOfKeys( |
6425 content, GetEnumPropertyKeys(current, cache_enum_keys)), | 6425 content, JSObject::GetEnumPropertyKeys(current, cache_enum_keys)), |
6426 FixedArray); | 6426 FixedArray); |
6427 DCHECK(ContainsOnlyValidKeys(content)); | 6427 DCHECK(ContainsOnlyValidKeys(content)); |
6428 | 6428 |
6429 // Add the non-symbol property keys from the interceptor. | 6429 // Add the non-symbol property keys from the interceptor. |
6430 if (current->HasNamedInterceptor()) { | 6430 if (current->HasNamedInterceptor()) { |
6431 Handle<JSObject> result; | 6431 Handle<JSObject> result; |
6432 if (JSObject::GetKeysForNamedInterceptor( | 6432 if (JSObject::GetKeysForNamedInterceptor( |
6433 current, object).ToHandle(&result)) { | 6433 current, object).ToHandle(&result)) { |
6434 ASSIGN_RETURN_ON_EXCEPTION( | 6434 ASSIGN_RETURN_ON_EXCEPTION( |
6435 isolate, content, FixedArray::AddKeysFromArrayLike( | 6435 isolate, content, FixedArray::AddKeysFromArrayLike( |
(...skipping 10803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17239 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17239 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
17240 Handle<Object> new_value) { | 17240 Handle<Object> new_value) { |
17241 if (cell->value() != *new_value) { | 17241 if (cell->value() != *new_value) { |
17242 cell->set_value(*new_value); | 17242 cell->set_value(*new_value); |
17243 Isolate* isolate = cell->GetIsolate(); | 17243 Isolate* isolate = cell->GetIsolate(); |
17244 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17244 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
17245 isolate, DependentCode::kPropertyCellChangedGroup); | 17245 isolate, DependentCode::kPropertyCellChangedGroup); |
17246 } | 17246 } |
17247 } | 17247 } |
17248 } } // namespace v8::internal | 17248 } } // namespace v8::internal |
OLD | NEW |