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

Side by Side Diff: src/array.js

Issue 6334106: Improve ScanJsonNumber. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/conversions.cc » ('j') | src/scanner.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 1011
1012 1012
1013 function ArrayIndexOf(element, index) { 1013 function ArrayIndexOf(element, index) {
1014 var length = TO_UINT32(this.length); 1014 var length = TO_UINT32(this.length);
1015 if (length == 0) return -1; 1015 if (length == 0) return -1;
1016 if (IS_UNDEFINED(index)) { 1016 if (IS_UNDEFINED(index)) {
1017 index = 0; 1017 index = 0;
1018 } else { 1018 } else {
1019 index = TO_INTEGER(index); 1019 index = TO_INTEGER(index);
1020 // If index is negative, index from the end of the array. 1020 // If index is negative, index from the end of the array.
1021 if (index < 0) index = length + index; 1021 if (index < 0) {
1022 // If index is still negative, search the entire array. 1022 index = length + index;
1023 if (index < 0) index = 0; 1023 // If index is still negative, search the entire array.
1024 if (index < 0) index = 0;
1025 }
1024 } 1026 }
1025 var min = index; 1027 var min = index;
1026 var max = length; 1028 var max = length;
1027 if (UseSparseVariant(this, length, true)) { 1029 if (UseSparseVariant(this, length, true)) {
1028 var intervals = %GetArrayKeys(this, length); 1030 var intervals = %GetArrayKeys(this, length);
1029 if (intervals.length == 2 && intervals[0] < 0) { 1031 if (intervals.length == 2 && intervals[0] < 0) {
1030 // A single interval. 1032 // A single interval.
1031 var intervalMin = -(intervals[0] + 1); 1033 var intervalMin = -(intervals[0] + 1);
1032 var intervalMax = intervalMin + intervals[1]; 1034 var intervalMax = intervalMin + intervals[1];
1033 min = MAX(min, intervalMin); 1035 min = MAX(min, intervalMin);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1), 1231 "lastIndexOf", getFunction("lastIndexOf", ArrayLastIndexOf, 1),
1230 "reduce", getFunction("reduce", ArrayReduce, 1), 1232 "reduce", getFunction("reduce", ArrayReduce, 1),
1231 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1) 1233 "reduceRight", getFunction("reduceRight", ArrayReduceRight, 1)
1232 )); 1234 ));
1233 1235
1234 %FinishArrayPrototypeSetup($Array.prototype); 1236 %FinishArrayPrototypeSetup($Array.prototype);
1235 } 1237 }
1236 1238
1237 1239
1238 SetupArray(); 1240 SetupArray();
OLDNEW
« no previous file with comments | « no previous file | src/conversions.cc » ('j') | src/scanner.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698