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

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

Issue 1197133003: Move SetFastElementsCapacity into GrowCapacityAndConvert (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/objects.cc ('k') | src/runtime/runtime-object.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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::AddDataElement(array, length, element, NONE)); 104 isolate, JSObject::AddDataElement(array, length, element, NONE));
105 JSObject::ValidateElements(array);
105 return isolate->heap()->true_value(); 106 return isolate->heap()->true_value();
106 } 107 }
107 108
108 109
109 /** 110 /**
110 * A simple visitor visits every element of Array's. 111 * A simple visitor visits every element of Array's.
111 * The backend storage can be a fixed array for fast elements case, 112 * The backend storage can be a fixed array for fast elements case,
112 * or a dictionary for sparse array. Since Dictionary is a subtype 113 * 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. 114 * of FixedArray, the class can be used by both fast and slow cases.
114 * The second parameter of the constructor, fast_elements, specifies 115 * The second parameter of the constructor, fast_elements, specifies
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 1316
1316 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { 1317 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) {
1317 SealHandleScope shs(isolate); 1318 SealHandleScope shs(isolate);
1318 DCHECK(args.length() == 2); 1319 DCHECK(args.length() == 2);
1319 // Returning undefined means that this fast path fails and one has to resort 1320 // Returning undefined means that this fast path fails and one has to resort
1320 // to a slow path. 1321 // to a slow path.
1321 return isolate->heap()->undefined_value(); 1322 return isolate->heap()->undefined_value();
1322 } 1323 }
1323 } // namespace internal 1324 } // namespace internal
1324 } // namespace v8 1325 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698