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

Side by Side Diff: src/objects.cc

Issue 1682873003: [builtins] Speedup Object.keys by adding a fast path for objects without elements, interceptors, ... (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/builtins.cc ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 8724 matching lines...) Expand 10 before | Expand all | Expand 10 after
8735 // for arguments objects. Arguments objects will always have 8735 // for arguments objects. Arguments objects will always have
8736 // elements. 8736 // elements.
8737 // Wrapped strings have elements, but don't have an elements 8737 // Wrapped strings have elements, but don't have an elements
8738 // array or dictionary. So the fast inline test for whether to 8738 // array or dictionary. So the fast inline test for whether to
8739 // use the cache says yes, so we should not create a cache. 8739 // use the cache says yes, so we should not create a cache.
8740 Handle<JSFunction> arguments_function( 8740 Handle<JSFunction> arguments_function(
8741 JSFunction::cast(isolate->sloppy_arguments_map()->GetConstructor())); 8741 JSFunction::cast(isolate->sloppy_arguments_map()->GetConstructor()));
8742 bool cache_enum_length = 8742 bool cache_enum_length =
8743 ((object->map()->GetConstructor() != *arguments_function) && 8743 ((object->map()->GetConstructor() != *arguments_function) &&
8744 !object->IsJSValue() && !object->IsAccessCheckNeeded() && 8744 !object->IsJSValue() && !object->IsAccessCheckNeeded() &&
8745 !object->HasNamedInterceptor() && !object->HasIndexedInterceptor()); 8745 !object->HasNamedInterceptor() && !object->HasIndexedInterceptor() &&
8746 !object->map()->has_hidden_prototype());
8746 // Compute the property keys and cache them if possible. 8747 // Compute the property keys and cache them if possible.
8747 Handle<FixedArray> enum_keys = 8748 Handle<FixedArray> enum_keys =
8748 JSObject::GetEnumPropertyKeys(object, cache_enum_length); 8749 JSObject::GetEnumPropertyKeys(object, cache_enum_length);
8749 accumulator->AddKeys(enum_keys, DO_NOT_CONVERT); 8750 accumulator->AddKeys(enum_keys, DO_NOT_CONVERT);
8750 } else { 8751 } else {
8751 object->CollectOwnPropertyNames(accumulator, *filter); 8752 object->CollectOwnPropertyNames(accumulator, *filter);
8752 } 8753 }
8753 8754
8754 // Add the property keys from the interceptor. 8755 // Add the property keys from the interceptor.
8755 success = GetKeysFromInterceptor<v8::GenericNamedPropertyEnumeratorCallback, 8756 success = GetKeysFromInterceptor<v8::GenericNamedPropertyEnumeratorCallback,
(...skipping 11206 matching lines...) Expand 10 before | Expand all | Expand 10 after
19962 if (cell->value() != *new_value) { 19963 if (cell->value() != *new_value) {
19963 cell->set_value(*new_value); 19964 cell->set_value(*new_value);
19964 Isolate* isolate = cell->GetIsolate(); 19965 Isolate* isolate = cell->GetIsolate();
19965 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19966 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19966 isolate, DependentCode::kPropertyCellChangedGroup); 19967 isolate, DependentCode::kPropertyCellChangedGroup);
19967 } 19968 }
19968 } 19969 }
19969 19970
19970 } // namespace internal 19971 } // namespace internal
19971 } // namespace v8 19972 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698