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

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

Issue 1013753016: Add full TurboFan support for accessing SeqString contents. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed return value Created 5 years, 9 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/runtime/runtime-strings.cc ('k') | no next file » | 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 "test/cctest/compiler/function-tester.h" 7 #include "test/cctest/compiler/function-tester.h"
8 8
9 using namespace v8::internal; 9 using namespace v8::internal;
10 using namespace v8::internal::compiler; 10 using namespace v8::internal::compiler;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 T.CheckTrue(T.NewObject("(o)"), T.NewObject("(o)")); 170 T.CheckTrue(T.NewObject("(o)"), T.NewObject("(o)"));
171 T.CheckTrue(T.Val("internal"), T.Val("internal")); 171 T.CheckTrue(T.Val("internal"), T.Val("internal"));
172 T.CheckTrue(T.true_value(), T.true_value()); 172 T.CheckTrue(T.true_value(), T.true_value());
173 T.CheckFalse(T.true_value(), T.false_value()); 173 T.CheckFalse(T.true_value(), T.false_value());
174 T.CheckFalse(T.NewObject("({})"), T.NewObject("({})")); 174 T.CheckFalse(T.NewObject("({})"), T.NewObject("({})"));
175 T.CheckFalse(T.Val("a"), T.Val("b")); 175 T.CheckFalse(T.Val("a"), T.Val("b"));
176 } 176 }
177 177
178 178
179 TEST(OneByteSeqStringGetChar) {
180 FLAG_turbo_deoptimization = true;
181 FunctionTester T("(function(a,b) { return %_OneByteSeqStringGetChar(a,b); })",
182 flags);
183
184 Handle<SeqOneByteString> string =
185 T.main_isolate()->factory()->NewRawOneByteString(3).ToHandleChecked();
186 string->SeqOneByteStringSet(0, 'b');
187 string->SeqOneByteStringSet(1, 'a');
188 string->SeqOneByteStringSet(2, 'r');
189 T.CheckCall(T.Val('b'), string, T.Val(0.0));
190 T.CheckCall(T.Val('a'), string, T.Val(1));
191 T.CheckCall(T.Val('r'), string, T.Val(2));
192 }
193
194
195 TEST(OneByteSeqStringSetChar) {
196 FLAG_turbo_deoptimization = true;
197 FunctionTester T("(function(a,b) { %_OneByteSeqStringSetChar(a,88,b); })",
198 flags);
199
200 Handle<SeqOneByteString> string =
201 T.main_isolate()->factory()->NewRawOneByteString(3).ToHandleChecked();
202 string->SeqOneByteStringSet(0, 'b');
203 string->SeqOneByteStringSet(1, 'a');
204 string->SeqOneByteStringSet(2, 'r');
205 T.Call(T.Val(1), string);
206 CHECK_EQ('b', string->SeqOneByteStringGet(0));
207 CHECK_EQ('X', string->SeqOneByteStringGet(1));
208 CHECK_EQ('r', string->SeqOneByteStringGet(2));
209 }
210
211
179 TEST(SetValueOf) { 212 TEST(SetValueOf) {
180 FLAG_turbo_deoptimization = true; 213 FLAG_turbo_deoptimization = true;
181 FunctionTester T("(function(a,b) { return %_SetValueOf(a,b); })", flags); 214 FunctionTester T("(function(a,b) { return %_SetValueOf(a,b); })", flags);
182 215
183 T.CheckCall(T.Val("a"), T.NewObject("(new String)"), T.Val("a")); 216 T.CheckCall(T.Val("a"), T.NewObject("(new String)"), T.Val("a"));
184 T.CheckCall(T.Val(123), T.NewObject("(new Number)"), T.Val(123)); 217 T.CheckCall(T.Val(123), T.NewObject("(new Number)"), T.Val(123));
185 T.CheckCall(T.Val("x"), T.undefined(), T.Val("x")); 218 T.CheckCall(T.Val("x"), T.undefined(), T.Val("x"));
186 } 219 }
187 220
188 221
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 TEST(SubString) { 273 TEST(SubString) {
241 FLAG_turbo_deoptimization = true; 274 FLAG_turbo_deoptimization = true;
242 FunctionTester T("(function(a,b) { return %_SubString(a,b,b+3); })", flags); 275 FunctionTester T("(function(a,b) { return %_SubString(a,b,b+3); })", flags);
243 276
244 T.CheckCall(T.Val("aaa"), T.Val("aaabbb"), T.Val(0.0)); 277 T.CheckCall(T.Val("aaa"), T.Val("aaabbb"), T.Val(0.0));
245 T.CheckCall(T.Val("abb"), T.Val("aaabbb"), T.Val(2)); 278 T.CheckCall(T.Val("abb"), T.Val("aaabbb"), T.Val(2));
246 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0)); 279 T.CheckCall(T.Val("aaa"), T.Val("aaa"), T.Val(0.0));
247 } 280 }
248 281
249 282
283 TEST(TwoByteSeqStringGetChar) {
284 FLAG_turbo_deoptimization = true;
285 FunctionTester T("(function(a,b) { return %_TwoByteSeqStringGetChar(a,b); })",
286 flags);
287
288 Handle<SeqTwoByteString> string =
289 T.main_isolate()->factory()->NewRawTwoByteString(3).ToHandleChecked();
290 string->SeqTwoByteStringSet(0, 'b');
291 string->SeqTwoByteStringSet(1, 'a');
292 string->SeqTwoByteStringSet(2, 'r');
293 T.CheckCall(T.Val('b'), string, T.Val(0.0));
294 T.CheckCall(T.Val('a'), string, T.Val(1));
295 T.CheckCall(T.Val('r'), string, T.Val(2));
296 }
297
298
299 TEST(TwoByteSeqStringSetChar) {
300 FLAG_turbo_deoptimization = true;
301 FunctionTester T("(function(a,b) { %_TwoByteSeqStringSetChar(a,88,b); })",
302 flags);
303
304 Handle<SeqTwoByteString> string =
305 T.main_isolate()->factory()->NewRawTwoByteString(3).ToHandleChecked();
306 string->SeqTwoByteStringSet(0, 'b');
307 string->SeqTwoByteStringSet(1, 'a');
308 string->SeqTwoByteStringSet(2, 'r');
309 T.Call(T.Val(1), string);
310 CHECK_EQ('b', string->SeqTwoByteStringGet(0));
311 CHECK_EQ('X', string->SeqTwoByteStringGet(1));
312 CHECK_EQ('r', string->SeqTwoByteStringGet(2));
313 }
314
315
250 TEST(ValueOf) { 316 TEST(ValueOf) {
251 FLAG_turbo_deoptimization = true; 317 FLAG_turbo_deoptimization = true;
252 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags); 318 FunctionTester T("(function(a) { return %_ValueOf(a); })", flags);
253 319
254 T.CheckCall(T.Val("a"), T.Val("a")); 320 T.CheckCall(T.Val("a"), T.Val("a"));
255 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))")); 321 T.CheckCall(T.Val("b"), T.NewObject("(new String('b'))"));
256 T.CheckCall(T.Val(123), T.Val(123)); 322 T.CheckCall(T.Val(123), T.Val(123));
257 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))")); 323 T.CheckCall(T.Val(456), T.NewObject("(new Number(456))"));
258 } 324 }
OLDNEW
« no previous file with comments | « src/runtime/runtime-strings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698