OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/base/utils/random-number-generator.h" | 5 #include "src/base/utils/random-number-generator.h" |
6 #include "src/builtins/builtins-promise.h" | 6 #include "src/builtins/builtins-promise.h" |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stub-assembler.h" | 8 #include "src/code-stub-assembler.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/isolate.h" | 10 #include "src/isolate.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 CHECK(!key->HasHashCode()); | 306 CHECK(!key->HasHashCode()); |
307 ft.CheckTrue(key, expect_bailout); | 307 ft.CheckTrue(key, expect_bailout); |
308 } | 308 } |
309 | 309 |
310 { | 310 { |
311 // TryToName(<non-internalized string>) => bailout. | 311 // TryToName(<non-internalized string>) => bailout. |
312 Handle<Object> key = isolate->factory()->NewStringFromAsciiChecked("test"); | 312 Handle<Object> key = isolate->factory()->NewStringFromAsciiChecked("test"); |
313 ft.CheckTrue(key, expect_bailout); | 313 ft.CheckTrue(key, expect_bailout); |
314 } | 314 } |
315 | 315 |
316 { | 316 if (FLAG_thin_strings) { |
317 // TryToName(<thin string>) => internalized version. | 317 // TryToName(<thin string>) => internalized version. |
318 Handle<String> s = isolate->factory()->NewStringFromAsciiChecked("foo"); | 318 Handle<String> s = isolate->factory()->NewStringFromAsciiChecked("foo"); |
319 Handle<String> internalized = isolate->factory()->InternalizeString(s); | 319 Handle<String> internalized = isolate->factory()->InternalizeString(s); |
320 ft.CheckTrue(s, expect_unique, internalized); | 320 ft.CheckTrue(s, expect_unique, internalized); |
321 } | 321 } |
322 | 322 |
323 { | 323 if (FLAG_thin_strings) { |
324 // TryToName(<thin two-byte string>) => internalized version. | 324 // TryToName(<thin two-byte string>) => internalized version. |
325 uc16 array1[] = {2001, 2002, 2003}; | 325 uc16 array1[] = {2001, 2002, 2003}; |
326 Vector<const uc16> str1(array1); | 326 Vector<const uc16> str1(array1); |
327 Handle<String> s = | 327 Handle<String> s = |
328 isolate->factory()->NewStringFromTwoByte(str1).ToHandleChecked(); | 328 isolate->factory()->NewStringFromTwoByte(str1).ToHandleChecked(); |
329 Handle<String> internalized = isolate->factory()->InternalizeString(s); | 329 Handle<String> internalized = isolate->factory()->InternalizeString(s); |
330 ft.CheckTrue(s, expect_unique, internalized); | 330 ft.CheckTrue(s, expect_unique, internalized); |
331 } | 331 } |
332 } | 332 } |
333 | 333 |
(...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2455 m.Return(m.SmiConstant(0)); | 2455 m.Return(m.SmiConstant(0)); |
2456 | 2456 |
2457 Handle<Code> code = data.GenerateCode(); | 2457 Handle<Code> code = data.GenerateCode(); |
2458 CHECK(!code.is_null()); | 2458 CHECK(!code.is_null()); |
2459 FunctionTester ft(code, kNumParams); | 2459 FunctionTester ft(code, kNumParams); |
2460 CHECK_EQ(1, Handle<Smi>::cast(ft.Call().ToHandleChecked())->value()); | 2460 CHECK_EQ(1, Handle<Smi>::cast(ft.Call().ToHandleChecked())->value()); |
2461 } | 2461 } |
2462 | 2462 |
2463 } // namespace internal | 2463 } // namespace internal |
2464 } // namespace v8 | 2464 } // namespace v8 |
OLD | NEW |