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

Side by Side Diff: src/array.js

Issue 1096243003: Migrate error messages, part 5 (array.js and i18n.js). (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | src/date.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 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 var $arrayConcat; 5 var $arrayConcat;
6 var $arrayJoin; 6 var $arrayJoin;
7 var $arrayPush; 7 var $arrayPush;
8 var $arrayPop; 8 var $arrayPop;
9 var $arrayShift; 9 var $arrayShift;
10 var $arraySlice; 10 var $arraySlice;
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.shift"); 613 CHECK_OBJECT_COERCIBLE(this, "Array.prototype.shift");
614 614
615 var array = TO_OBJECT_INLINE(this); 615 var array = TO_OBJECT_INLINE(this);
616 var len = TO_UINT32(array.length); 616 var len = TO_UINT32(array.length);
617 617
618 if (len === 0) { 618 if (len === 0) {
619 array.length = 0; 619 array.length = 0;
620 return; 620 return;
621 } 621 }
622 622
623 if (ObjectIsSealed(array)) { 623 if (ObjectIsSealed(array)) throw MakeTypeError(kArrayFunctionsOnSealed);
624 throw MakeTypeError("array_functions_change_sealed",
625 ["Array.prototype.shift"]);
626 }
627 624
628 if (%IsObserved(array)) 625 if (%IsObserved(array))
629 return ObservedArrayShift.call(array, len); 626 return ObservedArrayShift.call(array, len);
630 627
631 var first = array[0]; 628 var first = array[0];
632 629
633 if (UseSparseVariant(array, len, IS_ARRAY(array), len)) { 630 if (UseSparseVariant(array, len, IS_ARRAY(array), len)) {
634 SparseMove(array, 0, 1, len, 0); 631 SparseMove(array, 0, 1, len, 0);
635 } else { 632 } else {
636 SimpleMove(array, 0, 1, len, 0); 633 SimpleMove(array, 0, 1, len, 0);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 var array = TO_OBJECT_INLINE(this); 811 var array = TO_OBJECT_INLINE(this);
815 var len = TO_UINT32(array.length); 812 var len = TO_UINT32(array.length);
816 var start_i = ComputeSpliceStartIndex(TO_INTEGER(start), len); 813 var start_i = ComputeSpliceStartIndex(TO_INTEGER(start), len);
817 var del_count = ComputeSpliceDeleteCount(delete_count, num_arguments, len, 814 var del_count = ComputeSpliceDeleteCount(delete_count, num_arguments, len,
818 start_i); 815 start_i);
819 var deleted_elements = []; 816 var deleted_elements = [];
820 deleted_elements.length = del_count; 817 deleted_elements.length = del_count;
821 var num_elements_to_add = num_arguments > 2 ? num_arguments - 2 : 0; 818 var num_elements_to_add = num_arguments > 2 ? num_arguments - 2 : 0;
822 819
823 if (del_count != num_elements_to_add && ObjectIsSealed(array)) { 820 if (del_count != num_elements_to_add && ObjectIsSealed(array)) {
824 throw MakeTypeError("array_functions_change_sealed", 821 throw MakeTypeError(kArrayFunctionsOnSealed);
825 ["Array.prototype.splice"]);
826 } else if (del_count > 0 && ObjectIsFrozen(array)) { 822 } else if (del_count > 0 && ObjectIsFrozen(array)) {
827 throw MakeTypeError("array_functions_on_frozen", 823 throw MakeTypeError(kArrayFunctionsOnFrozen);
828 ["Array.prototype.splice"]);
829 } 824 }
830 825
831 var changed_elements = del_count; 826 var changed_elements = del_count;
832 if (num_elements_to_add != del_count) { 827 if (num_elements_to_add != del_count) {
833 // If the slice needs to do a actually move elements after the insertion 828 // If the slice needs to do a actually move elements after the insertion
834 // point, then include those in the estimate of changed elements. 829 // point, then include those in the estimate of changed elements.
835 changed_elements += len - start_i - del_count; 830 changed_elements += len - start_i - del_count;
836 } 831 }
837 if (UseSparseVariant(array, len, IS_ARRAY(array), changed_elements)) { 832 if (UseSparseVariant(array, len, IS_ARRAY(array), changed_elements)) {
838 %NormalizeElements(array); 833 %NormalizeElements(array);
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 1434
1440 var is_array = IS_ARRAY(array); 1435 var is_array = IS_ARRAY(array);
1441 var i = 0; 1436 var i = 0;
1442 find_initial: if (%_ArgumentsLength() < 2) { 1437 find_initial: if (%_ArgumentsLength() < 2) {
1443 for (; i < length; i++) { 1438 for (; i < length; i++) {
1444 if (HAS_INDEX(array, i, is_array)) { 1439 if (HAS_INDEX(array, i, is_array)) {
1445 current = array[i++]; 1440 current = array[i++];
1446 break find_initial; 1441 break find_initial;
1447 } 1442 }
1448 } 1443 }
1449 throw MakeTypeError('reduce_no_initial', []); 1444 throw MakeTypeError(kReduceNoInitial);
1450 } 1445 }
1451 1446
1452 var receiver = %GetDefaultReceiver(callback); 1447 var receiver = %GetDefaultReceiver(callback);
1453 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(callback); 1448 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(callback);
1454 for (; i < length; i++) { 1449 for (; i < length; i++) {
1455 if (HAS_INDEX(array, i, is_array)) { 1450 if (HAS_INDEX(array, i, is_array)) {
1456 var element = array[i]; 1451 var element = array[i];
1457 // Prepare break slots for debugger step in. 1452 // Prepare break slots for debugger step in.
1458 if (stepping) %DebugPrepareStepInIfStepping(callback); 1453 if (stepping) %DebugPrepareStepInIfStepping(callback);
1459 current = %_CallFunction(receiver, current, element, i, array, callback); 1454 current = %_CallFunction(receiver, current, element, i, array, callback);
(...skipping 17 matching lines...) Expand all
1477 1472
1478 var is_array = IS_ARRAY(array); 1473 var is_array = IS_ARRAY(array);
1479 var i = length - 1; 1474 var i = length - 1;
1480 find_initial: if (%_ArgumentsLength() < 2) { 1475 find_initial: if (%_ArgumentsLength() < 2) {
1481 for (; i >= 0; i--) { 1476 for (; i >= 0; i--) {
1482 if (HAS_INDEX(array, i, is_array)) { 1477 if (HAS_INDEX(array, i, is_array)) {
1483 current = array[i--]; 1478 current = array[i--];
1484 break find_initial; 1479 break find_initial;
1485 } 1480 }
1486 } 1481 }
1487 throw MakeTypeError('reduce_no_initial', []); 1482 throw MakeTypeError(kReduceNoInitial);
1488 } 1483 }
1489 1484
1490 var receiver = %GetDefaultReceiver(callback); 1485 var receiver = %GetDefaultReceiver(callback);
1491 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(callback); 1486 var stepping = DEBUG_IS_ACTIVE && %DebugCallbackSupportsStepping(callback);
1492 for (; i >= 0; i--) { 1487 for (; i >= 0; i--) {
1493 if (HAS_INDEX(array, i, is_array)) { 1488 if (HAS_INDEX(array, i, is_array)) {
1494 var element = array[i]; 1489 var element = array[i];
1495 // Prepare break slots for debugger step in. 1490 // Prepare break slots for debugger step in.
1496 if (stepping) %DebugPrepareStepInIfStepping(callback); 1491 if (stepping) %DebugPrepareStepInIfStepping(callback);
1497 current = %_CallFunction(receiver, current, element, i, array, callback); 1492 current = %_CallFunction(receiver, current, element, i, array, callback);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1596 $arrayConcat = ArrayConcatJS; 1591 $arrayConcat = ArrayConcatJS;
1597 $arrayJoin = ArrayJoin; 1592 $arrayJoin = ArrayJoin;
1598 $arrayPush = ArrayPush; 1593 $arrayPush = ArrayPush;
1599 $arrayPop = ArrayPop; 1594 $arrayPop = ArrayPop;
1600 $arrayShift = ArrayShift; 1595 $arrayShift = ArrayShift;
1601 $arraySlice = ArraySlice; 1596 $arraySlice = ArraySlice;
1602 $arraySplice = ArraySplice; 1597 $arraySplice = ArraySplice;
1603 $arrayUnshift = ArrayUnshift; 1598 $arrayUnshift = ArrayUnshift;
1604 1599
1605 })(); 1600 })();
OLDNEW
« no previous file with comments | « no previous file | src/date.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698