| Index: test/cctest/test-code-stub-assembler.cc
|
| diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc
|
| index 4c78ab38c03db1ac9d8c1ba4cc920b3b1718eed1..f3c63cd9d05c34e13acca44060ba3f12ae901d9b 100644
|
| --- a/test/cctest/test-code-stub-assembler.cc
|
| +++ b/test/cctest/test-code-stub-assembler.cc
|
| @@ -237,22 +237,26 @@ TEST(TryToName) {
|
|
|
| Label passed(&m), failed(&m);
|
| Label if_keyisindex(&m), if_keyisunique(&m), if_bailout(&m);
|
| - Variable var_index(&m, MachineType::PointerRepresentation());
|
| -
|
| - m.TryToName(key, &if_keyisindex, &var_index, &if_keyisunique, &if_bailout);
|
| -
|
| - m.Bind(&if_keyisindex);
|
| - m.GotoUnless(
|
| - m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kKeyIsIndex))),
|
| - &failed);
|
| - m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_index.value()), &passed,
|
| - &failed);
|
| -
|
| - m.Bind(&if_keyisunique);
|
| - m.GotoUnless(
|
| - m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kKeyIsUnique))),
|
| - &failed);
|
| - m.Branch(m.WordEqual(expected_arg, key), &passed, &failed);
|
| + {
|
| + Variable var_index(&m, MachineType::PointerRepresentation());
|
| + Variable var_unique(&m, MachineRepresentation::kTagged);
|
| +
|
| + m.TryToName(key, &if_keyisindex, &var_index, &if_keyisunique, &var_unique,
|
| + &if_bailout);
|
| +
|
| + m.Bind(&if_keyisindex);
|
| + m.GotoUnless(m.WordEqual(expected_result,
|
| + m.SmiConstant(Smi::FromInt(kKeyIsIndex))),
|
| + &failed);
|
| + m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_index.value()),
|
| + &passed, &failed);
|
| +
|
| + m.Bind(&if_keyisunique);
|
| + m.GotoUnless(m.WordEqual(expected_result,
|
| + m.SmiConstant(Smi::FromInt(kKeyIsUnique))),
|
| + &failed);
|
| + m.Branch(m.WordEqual(expected_arg, var_unique.value()), &passed, &failed);
|
| + }
|
|
|
| m.Bind(&if_bailout);
|
| m.Branch(
|
| @@ -348,6 +352,23 @@ TEST(TryToName) {
|
| Handle<Object> key = isolate->factory()->NewStringFromAsciiChecked("test");
|
| ft.CheckTrue(key, expect_bailout);
|
| }
|
| +
|
| + {
|
| + // TryToName(<thin string>) => internalized version.
|
| + Handle<String> s = isolate->factory()->NewStringFromAsciiChecked("foo");
|
| + Handle<String> internalized = isolate->factory()->InternalizeString(s);
|
| + ft.CheckTrue(s, expect_unique, internalized);
|
| + }
|
| +
|
| + {
|
| + // TryToName(<thin two-byte string>) => internalized version.
|
| + uc16 array1[] = {2001, 2002, 2003};
|
| + Vector<const uc16> str1(array1);
|
| + Handle<String> s =
|
| + isolate->factory()->NewStringFromTwoByte(str1).ToHandleChecked();
|
| + Handle<String> internalized = isolate->factory()->InternalizeString(s);
|
| + ft.CheckTrue(s, expect_unique, internalized);
|
| + }
|
| }
|
|
|
| namespace {
|
|
|