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

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

Issue 799853003: Use proper ToLength() operation in %ArrayConcat() (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tests for toString/valueOf throwing user exception Created 6 years 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/execution.cc ('k') | test/mjsunit/harmony/array-concat.js » ('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/runtime/runtime-utils.h" 8 #include "src/runtime/runtime-utils.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 uint32_t length = 0; 454 uint32_t length = 0;
455 455
456 if (receiver->IsJSArray()) { 456 if (receiver->IsJSArray()) {
457 Handle<JSArray> array(Handle<JSArray>::cast(receiver)); 457 Handle<JSArray> array(Handle<JSArray>::cast(receiver));
458 length = static_cast<uint32_t>(array->length()->Number()); 458 length = static_cast<uint32_t>(array->length()->Number());
459 } else { 459 } else {
460 Handle<Object> val; 460 Handle<Object> val;
461 Handle<Object> key(isolate->heap()->length_string(), isolate); 461 Handle<Object> key(isolate->heap()->length_string(), isolate);
462 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, val, 462 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, val,
463 Runtime::GetObjectProperty(isolate, receiver, key), false); 463 Runtime::GetObjectProperty(isolate, receiver, key), false);
464 // TODO(caitp): implement ToLength() abstract operation for C++ 464 // TODO(caitp): Support larger element indexes (up to 2^53-1).
465 val->ToUint32(&length); 465 if (!val->ToUint32(&length)) {
466 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, val,
467 Execution::ToLength(isolate, val), false);
468 val->ToUint32(&length);
469 }
466 } 470 }
467 471
468 switch (receiver->GetElementsKind()) { 472 switch (receiver->GetElementsKind()) {
469 case FAST_SMI_ELEMENTS: 473 case FAST_SMI_ELEMENTS:
470 case FAST_ELEMENTS: 474 case FAST_ELEMENTS:
471 case FAST_HOLEY_SMI_ELEMENTS: 475 case FAST_HOLEY_SMI_ELEMENTS:
472 case FAST_HOLEY_ELEMENTS: { 476 case FAST_HOLEY_ELEMENTS: {
473 // Run through the elements FixedArray and use HasElement and GetElement 477 // Run through the elements FixedArray and use HasElement and GetElement
474 // to check the prototype for missing elements. 478 // to check the prototype for missing elements.
475 Handle<FixedArray> elements(FixedArray::cast(receiver->elements())); 479 Handle<FixedArray> elements(FixedArray::cast(receiver->elements()));
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 } 1283 }
1280 1284
1281 1285
1282 RUNTIME_FUNCTION(RuntimeReference_FastOneByteArrayJoin) { 1286 RUNTIME_FUNCTION(RuntimeReference_FastOneByteArrayJoin) {
1283 SealHandleScope shs(isolate); 1287 SealHandleScope shs(isolate);
1284 DCHECK(args.length() == 2); 1288 DCHECK(args.length() == 2);
1285 return isolate->heap()->undefined_value(); 1289 return isolate->heap()->undefined_value();
1286 } 1290 }
1287 } 1291 }
1288 } // namespace v8::internal 1292 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | test/mjsunit/harmony/array-concat.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698