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

Side by Side Diff: test/cctest/compiler/test-run-intrinsics.cc

Issue 1994733003: Rewrite decodeURL as builtin function, remove now unused runtime functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 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/uri.cc ('k') | test/mjsunit/lithium/SeqStringSetChar.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 "test/cctest/compiler/function-tester.h" 5 #include "test/cctest/compiler/function-tester.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 T.CheckFalse(T.NewObject("(/x/)")); 104 T.CheckFalse(T.NewObject("(/x/)"));
105 T.CheckFalse(T.undefined()); 105 T.CheckFalse(T.undefined());
106 T.CheckTrue(T.Val(1)); 106 T.CheckTrue(T.Val(1));
107 T.CheckFalse(T.Val(1.1)); 107 T.CheckFalse(T.Val(1.1));
108 T.CheckFalse(T.Val(-0.0)); 108 T.CheckFalse(T.Val(-0.0));
109 T.CheckTrue(T.Val(-2)); 109 T.CheckTrue(T.Val(-2));
110 T.CheckFalse(T.Val(-2.3)); 110 T.CheckFalse(T.Val(-2.3));
111 } 111 }
112 112
113 113
114 TEST(OneByteSeqStringGetChar) {
115 FunctionTester T("(function(a,b) { return %_OneByteSeqStringGetChar(a,b); })",
116 flags);
117
118 Handle<SeqOneByteString> string =
119 T.main_isolate()->factory()->NewRawOneByteString(3).ToHandleChecked();
120 string->SeqOneByteStringSet(0, 'b');
121 string->SeqOneByteStringSet(1, 'a');
122 string->SeqOneByteStringSet(2, 'r');
123 T.CheckCall(T.Val('b'), string, T.Val(0.0));
124 T.CheckCall(T.Val('a'), string, T.Val(1));
125 T.CheckCall(T.Val('r'), string, T.Val(2));
126 }
127
128
129 TEST(OneByteSeqStringSetChar) {
130 FunctionTester T("(function(a,b) { %_OneByteSeqStringSetChar(a,88,b); })",
131 flags);
132
133 Handle<SeqOneByteString> string =
134 T.main_isolate()->factory()->NewRawOneByteString(3).ToHandleChecked();
135 string->SeqOneByteStringSet(0, 'b');
136 string->SeqOneByteStringSet(1, 'a');
137 string->SeqOneByteStringSet(2, 'r');
138 T.Call(T.Val(1), string);
139 CHECK_EQ('b', string->SeqOneByteStringGet(0));
140 CHECK_EQ('X', string->SeqOneByteStringGet(1));
141 CHECK_EQ('r', string->SeqOneByteStringGet(2));
142 }
143
144
145 TEST(StringAdd) { 114 TEST(StringAdd) {
146 FunctionTester T("(function(a,b) { return %_StringAdd(a,b); })", flags); 115 FunctionTester T("(function(a,b) { return %_StringAdd(a,b); })", flags);
147 116
148 T.CheckCall(T.Val("aaabbb"), T.Val("aaa"), T.Val("bbb")); 117 T.CheckCall(T.Val("aaabbb"), T.Val("aaa"), T.Val("bbb"));
149 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val("")); 118 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(""));
150 T.CheckCall(T.Val("bbb"), T.Val(""), T.Val("bbb")); 119 T.CheckCall(T.Val("bbb"), T.Val(""), T.Val("bbb"));
151 } 120 }
152 121
153 122
154 TEST(StringCharCodeAt) { 123 TEST(StringCharCodeAt) {
(...skipping 26 matching lines...) Expand all
181 150
182 TEST(SubString) { 151 TEST(SubString) {
183 FunctionTester T("(function(a,b) { return %_SubString(a,b,b+3); })", flags); 152 FunctionTester T("(function(a,b) { return %_SubString(a,b,b+3); })", flags);
184 153
185 T.CheckCall(T.Val("aaa"), T.Val("aaabbb"), T.Val(0.0)); 154 T.CheckCall(T.Val("aaa"), T.Val("aaabbb"), T.Val(0.0));
186 T.CheckCall(T.Val("abb"), T.Val("aaabbb"), T.Val(2)); 155 T.CheckCall(T.Val("abb"), T.Val("aaabbb"), T.Val(2));
187 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0)); 156 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0));
188 } 157 }
189 158
190 159
191 TEST(TwoByteSeqStringGetChar) {
192 FunctionTester T("(function(a,b) { return %_TwoByteSeqStringGetChar(a,b); })",
193 flags);
194
195 Handle<SeqTwoByteString> string =
196 T.main_isolate()->factory()->NewRawTwoByteString(3).ToHandleChecked();
197 string->SeqTwoByteStringSet(0, 'b');
198 string->SeqTwoByteStringSet(1, 'a');
199 string->SeqTwoByteStringSet(2, 'r');
200 T.CheckCall(T.Val('b'), string, T.Val(0.0));
201 T.CheckCall(T.Val('a'), string, T.Val(1));
202 T.CheckCall(T.Val('r'), string, T.Val(2));
203 }
204
205
206 TEST(TwoByteSeqStringSetChar) {
207 FunctionTester T("(function(a,b) { %_TwoByteSeqStringSetChar(a,88,b); })",
208 flags);
209
210 Handle<SeqTwoByteString> string =
211 T.main_isolate()->factory()->NewRawTwoByteString(3).ToHandleChecked();
212 string->SeqTwoByteStringSet(0, 'b');
213 string->SeqTwoByteStringSet(1, 'a');
214 string->SeqTwoByteStringSet(2, 'r');
215 T.Call(T.Val(1), string);
216 CHECK_EQ('b', string->SeqTwoByteStringGet(0));
217 CHECK_EQ('X', string->SeqTwoByteStringGet(1));
218 CHECK_EQ('r', string->SeqTwoByteStringGet(2));
219 }
220
221
222 TEST(ValueOf) { 160 TEST(ValueOf) {
223 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); 161 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags);
224 162
225 T.CheckCall(T.Val("a"), T.Val("a")); 163 T.CheckCall(T.Val("a"), T.Val("a"));
226 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); 164 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))"));
227 T.CheckCall(T.Val(123), T.Val(123)); 165 T.CheckCall(T.Val(123), T.Val(123));
228 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); 166 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))"));
229 } 167 }
230 168
231 } // namespace compiler 169 } // namespace compiler
232 } // namespace internal 170 } // namespace internal
233 } // namespace v8 171 } // namespace v8
OLDNEW
« no previous file with comments | « src/uri.cc ('k') | test/mjsunit/lithium/SeqStringSetChar.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698