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

Side by Side Diff: test/js-perf-test/Strings/harmony-string.js

Issue 745543002: Revert of Rename String.prototype.contains to 'includes'. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years, 1 month 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/harmony-string.js ('k') | test/mjsunit/harmony/string-contains.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 new BenchmarkSuite('StringFunctions', [1000], [ 5 new BenchmarkSuite('StringFunctions', [1000], [
6 new Benchmark('StringRepeat', false, false, 0, 6 new Benchmark('StringRepeat', false, false, 0,
7 Repeat, RepeatSetup, RepeatTearDown), 7 Repeat, RepeatSetup, RepeatTearDown),
8 new Benchmark('StringStartsWith', false, false, 0, 8 new Benchmark('StringStartsWith', false, false, 0,
9 StartsWith, WithSetup, WithTearDown), 9 StartsWith, WithSetup, WithTearDown),
10 new Benchmark('StringEndsWith', false, false, 0, 10 new Benchmark('StringEndsWith', false, false, 0,
11 EndsWith, WithSetup, WithTearDown), 11 EndsWith, WithSetup, WithTearDown),
12 new Benchmark('StringIncludes', false, false, 0, 12 new Benchmark('StringContains', false, false, 0,
13 Includes, IncludesSetup, WithTearDown), 13 Contains, ContainsSetup, WithTearDown),
14 new Benchmark('StringFromCodePoint', false, false, 0, 14 new Benchmark('StringFromCodePoint', false, false, 0,
15 FromCodePoint, FromCodePointSetup, FromCodePointTearDown), 15 FromCodePoint, FromCodePointSetup, FromCodePointTearDown),
16 new Benchmark('StringCodePointAt', false, false, 0, 16 new Benchmark('StringCodePointAt', false, false, 0,
17 CodePointAt, CodePointAtSetup, CodePointAtTearDown), 17 CodePointAt, CodePointAtSetup, CodePointAtTearDown),
18 ]); 18 ]);
19 19
20 20
21 var result; 21 var result;
22 22
23 var stringRepeatSource = "abc"; 23 var stringRepeatSource = "abc";
(...skipping 29 matching lines...) Expand all
53 } 53 }
54 54
55 function StartsWith() { 55 function StartsWith() {
56 result = str.startsWith(substr); 56 result = str.startsWith(substr);
57 } 57 }
58 58
59 function EndsWith() { 59 function EndsWith() {
60 result = str.endsWith(substr); 60 result = str.endsWith(substr);
61 } 61 }
62 62
63 function IncludesSetup() { 63 function ContainsSetup() {
64 str = "def".repeat(100) + "abc".repeat(100) + "qqq".repeat(100); 64 str = "def".repeat(100) + "abc".repeat(100) + "qqq".repeat(100);
65 substr = "abc".repeat(100); 65 substr = "abc".repeat(100);
66 } 66 }
67 67
68 function Includes() { 68 function Contains() {
69 result = str.includes(substr); 69 result = str.contains(substr);
70 } 70 }
71 71
72 var MAX_CODE_POINT = 0xFFFFF; 72 var MAX_CODE_POINT = 0xFFFFF;
73 73
74 function FromCodePointSetup() { 74 function FromCodePointSetup() {
75 result = new Array(MAX_CODE_POINT + 1); 75 result = new Array(MAX_CODE_POINT + 1);
76 } 76 }
77 77
78 function FromCodePoint() { 78 function FromCodePoint() {
79 for (var i = 0; i <= MAX_CODE_POINT; i++) { 79 for (var i = 0; i <= MAX_CODE_POINT; i++) {
(...skipping 22 matching lines...) Expand all
102 function CodePointAt() { 102 function CodePointAt() {
103 result = 0; 103 result = 0;
104 for (var i = 0; i <= MAX_CODE_POINT; i++) { 104 for (var i = 0; i <= MAX_CODE_POINT; i++) {
105 result += allCodePoints.codePointAt(i); 105 result += allCodePoints.codePointAt(i);
106 } 106 }
107 } 107 }
108 108
109 function CodePointAtTearDown() { 109 function CodePointAtTearDown() {
110 return result === MAX_CODE_POINT * (MAX_CODE_POINT + 1) / 2; 110 return result === MAX_CODE_POINT * (MAX_CODE_POINT + 1) / 2;
111 } 111 }
OLDNEW
« no previous file with comments | « src/harmony-string.js ('k') | test/mjsunit/harmony/string-contains.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698