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

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

Issue 1193343002: Move SetFastDoubleElementsCapacity 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') | 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 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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 uint32_t index = static_cast<uint32_t>(key); 1251 uint32_t index = static_cast<uint32_t>(key);
1252 1252
1253 if (index >= capacity) { 1253 if (index >= capacity) {
1254 if (object->WouldConvertToSlowElements(index)) { 1254 if (object->WouldConvertToSlowElements(index)) {
1255 // We don't want to allow operations that cause lazy deopt. Return a Smi 1255 // We don't want to allow operations that cause lazy deopt. Return a Smi
1256 // as a signal that optimized code should eagerly deoptimize. 1256 // as a signal that optimized code should eagerly deoptimize.
1257 return Smi::FromInt(0); 1257 return Smi::FromInt(0);
1258 } 1258 }
1259 1259
1260 uint32_t new_capacity = JSObject::NewElementsCapacity(index + 1); 1260 uint32_t new_capacity = JSObject::NewElementsCapacity(index + 1);
1261 ElementsKind kind = object->GetElementsKind(); 1261 object->GetElementsAccessor()->GrowCapacityAndConvert(object, new_capacity);
1262 if (IsFastDoubleElementsKind(kind)) {
1263 JSObject::SetFastDoubleElementsCapacity(object, new_capacity);
1264 } else {
1265 JSObject::SetFastElementsCapacitySmiMode set_capacity_mode =
1266 object->HasFastSmiElements() ? JSObject::kAllowSmiElements
1267 : JSObject::kDontAllowSmiElements;
1268 JSObject::SetFastElementsCapacity(object, new_capacity,
1269 set_capacity_mode);
1270 }
1271 } 1262 }
1272 1263
1273 // On success, return the fixed array elements. 1264 // On success, return the fixed array elements.
1274 return object->elements(); 1265 return object->elements();
1275 } 1266 }
1276 1267
1277 1268
1278 RUNTIME_FUNCTION(Runtime_HasComplexElements) { 1269 RUNTIME_FUNCTION(Runtime_HasComplexElements) {
1279 HandleScope scope(isolate); 1270 HandleScope scope(isolate);
1280 DCHECK(args.length() == 1); 1271 DCHECK(args.length() == 1);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 1315
1325 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) { 1316 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) {
1326 SealHandleScope shs(isolate); 1317 SealHandleScope shs(isolate);
1327 DCHECK(args.length() == 2); 1318 DCHECK(args.length() == 2);
1328 // Returning undefined means that this fast path fails and one has to resort 1319 // Returning undefined means that this fast path fails and one has to resort
1329 // to a slow path. 1320 // to a slow path.
1330 return isolate->heap()->undefined_value(); 1321 return isolate->heap()->undefined_value();
1331 } 1322 }
1332 } // namespace internal 1323 } // namespace internal
1333 } // namespace v8 1324 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698