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

Side by Side Diff: src/runtime/runtime-array.cc

Issue 1172683003: Use the LookupIterator for SetElement and friends (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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 | « src/runtime/runtime.h ('k') | src/runtime/runtime-classes.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/messages.h" 8 #include "src/messages.h"
9 #include "src/runtime/runtime-utils.h" 9 #include "src/runtime/runtime-utils.h"
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, element, 1); 94 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, element, 1);
95 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements()); 95 RUNTIME_ASSERT(array->HasFastSmiOrObjectElements());
96 int length = Smi::cast(array->length())->value(); 96 int length = Smi::cast(array->length())->value();
97 FixedArray* elements = FixedArray::cast(array->elements()); 97 FixedArray* elements = FixedArray::cast(array->elements());
98 for (int i = 0; i < length; i++) { 98 for (int i = 0; i < length; i++) {
99 if (elements->get(i) == *element) return isolate->heap()->false_value(); 99 if (elements->get(i) == *element) return isolate->heap()->false_value();
100 } 100 }
101 101
102 // Strict not needed. Used for cycle detection in Array join implementation. 102 // Strict not needed. Used for cycle detection in Array join implementation.
103 RETURN_FAILURE_ON_EXCEPTION( 103 RETURN_FAILURE_ON_EXCEPTION(
104 isolate, JSObject::SetFastElement(array, length, element, SLOPPY, true)); 104 isolate, JSObject::AddDataElement(array, length, element, NONE));
105 return isolate->heap()->true_value(); 105 return isolate->heap()->true_value();
106 } 106 }
107 107
108 108
109 /** 109 /**
110 * A simple visitor visits every element of Array's. 110 * A simple visitor visits every element of Array's.
111 * The backend storage can be a fixed array for fast elements case, 111 * The backend storage can be a fixed array for fast elements case,
112 * or a dictionary for sparse array. Since Dictionary is a subtype 112 * or a dictionary for sparse array. Since Dictionary is a subtype
113 * of FixedArray, the class can be used by both fast and slow cases. 113 * of FixedArray, the class can be used by both fast and slow cases.
114 * The second parameter of the constructor, fast_elements, specifies 114 * The second parameter of the constructor, fast_elements, specifies
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 1323
1324 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { 1324 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) {
1325 SealHandleScope shs(isolate); 1325 SealHandleScope shs(isolate);
1326 DCHECK(args.length() == 2); 1326 DCHECK(args.length() == 2);
1327 // Returning undefined means that this fast path fails and one has to resort 1327 // Returning undefined means that this fast path fails and one has to resort
1328 // to a slow path. 1328 // to a slow path.
1329 return isolate->heap()->undefined_value(); 1329 return isolate->heap()->undefined_value();
1330 } 1330 }
1331 } // namespace internal 1331 } // namespace internal
1332 } // namespace v8 1332 } // namespace v8
OLDNEW
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-classes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698