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

Side by Side Diff: src/elements.cc

Issue 1002203003: Speed up FastElementsAccessor::ValidContents by removing redundant handle scope. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | 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 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/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/elements.h" 9 #include "src/elements.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 Isolate* isolate = holder->GetIsolate(); 984 Isolate* isolate = holder->GetIsolate();
985 HandleScope scope(isolate); 985 HandleScope scope(isolate);
986 Handle<FixedArrayBase> elements(holder->elements(), isolate); 986 Handle<FixedArrayBase> elements(holder->elements(), isolate);
987 Map* map = elements->map(); 987 Map* map = elements->map();
988 DCHECK((IsFastSmiOrObjectElementsKind(KindTraits::Kind) && 988 DCHECK((IsFastSmiOrObjectElementsKind(KindTraits::Kind) &&
989 (map == isolate->heap()->fixed_array_map() || 989 (map == isolate->heap()->fixed_array_map() ||
990 map == isolate->heap()->fixed_cow_array_map())) || 990 map == isolate->heap()->fixed_cow_array_map())) ||
991 (IsFastDoubleElementsKind(KindTraits::Kind) == 991 (IsFastDoubleElementsKind(KindTraits::Kind) ==
992 ((map == isolate->heap()->fixed_array_map() && length == 0) || 992 ((map == isolate->heap()->fixed_array_map() && length == 0) ||
993 map == isolate->heap()->fixed_double_array_map()))); 993 map == isolate->heap()->fixed_double_array_map())));
994 if (length == 0) return; // nothing to do!
994 DisallowHeapAllocation no_gc; 995 DisallowHeapAllocation no_gc;
996 Handle<BackingStore> backing_store = Handle<BackingStore>::cast(elements);
995 for (int i = 0; i < length; i++) { 997 for (int i = 0; i < length; i++) {
996 HandleScope scope(isolate);
997 Handle<BackingStore> backing_store = Handle<BackingStore>::cast(elements);
998 DCHECK((!IsFastSmiElementsKind(KindTraits::Kind) || 998 DCHECK((!IsFastSmiElementsKind(KindTraits::Kind) ||
999 BackingStore::get(backing_store, i)->IsSmi()) || 999 BackingStore::get(backing_store, i)->IsSmi()) ||
1000 (IsFastHoleyElementsKind(KindTraits::Kind) == 1000 (IsFastHoleyElementsKind(KindTraits::Kind) ==
1001 backing_store->is_the_hole(i))); 1001 backing_store->is_the_hole(i)));
1002 } 1002 }
1003 #endif 1003 #endif
1004 } 1004 }
1005 }; 1005 };
1006 1006
1007 1007
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 UNREACHABLE(); 1843 UNREACHABLE();
1844 break; 1844 break;
1845 } 1845 }
1846 1846
1847 array->set_elements(*elms); 1847 array->set_elements(*elms);
1848 array->set_length(Smi::FromInt(number_of_elements)); 1848 array->set_length(Smi::FromInt(number_of_elements));
1849 return array; 1849 return array;
1850 } 1850 }
1851 1851
1852 } } // namespace v8::internal 1852 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698