OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 }; | 1120 }; |
1121 | 1121 |
1122 | 1122 |
1123 TEST(SliceFromExternal) { | 1123 TEST(SliceFromExternal) { |
1124 FLAG_string_slices = true; | 1124 FLAG_string_slices = true; |
1125 CcTest::InitializeVM(); | 1125 CcTest::InitializeVM(); |
1126 Factory* factory = CcTest::i_isolate()->factory(); | 1126 Factory* factory = CcTest::i_isolate()->factory(); |
1127 v8::HandleScope scope(CcTest::isolate()); | 1127 v8::HandleScope scope(CcTest::isolate()); |
1128 AsciiVectorResource resource( | 1128 AsciiVectorResource resource( |
1129 i::Vector<const char>("abcdefghijklmnopqrstuvwxyz", 26)); | 1129 i::Vector<const char>("abcdefghijklmnopqrstuvwxyz", 26)); |
1130 Handle<String> string = factory->NewExternalStringFromAscii(&resource); | 1130 Handle<String> string = |
| 1131 factory->NewExternalStringFromAscii(&resource).ToHandleChecked(); |
1131 CHECK(string->IsExternalString()); | 1132 CHECK(string->IsExternalString()); |
1132 Handle<String> slice = factory->NewSubString(string, 1, 25); | 1133 Handle<String> slice = factory->NewSubString(string, 1, 25); |
1133 CHECK(slice->IsSlicedString()); | 1134 CHECK(slice->IsSlicedString()); |
1134 CHECK(string->IsExternalString()); | 1135 CHECK(string->IsExternalString()); |
1135 CHECK_EQ(SlicedString::cast(*slice)->parent(), *string); | 1136 CHECK_EQ(SlicedString::cast(*slice)->parent(), *string); |
1136 CHECK(SlicedString::cast(*slice)->parent()->IsExternalString()); | 1137 CHECK(SlicedString::cast(*slice)->parent()->IsExternalString()); |
1137 CHECK(slice->IsFlat()); | 1138 CHECK(slice->IsFlat()); |
1138 } | 1139 } |
1139 | 1140 |
1140 | 1141 |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 dummy.Dispose(); \ | 1405 dummy.Dispose(); \ |
1405 } | 1406 } |
1406 | 1407 |
1407 INVALID_STRING_TEST(NewStringFromAscii, char) | 1408 INVALID_STRING_TEST(NewStringFromAscii, char) |
1408 INVALID_STRING_TEST(NewStringFromUtf8, char) | 1409 INVALID_STRING_TEST(NewStringFromUtf8, char) |
1409 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) | 1410 INVALID_STRING_TEST(NewStringFromOneByte, uint8_t) |
1410 INVALID_STRING_TEST(InternalizeOneByteString, uint8_t) | 1411 INVALID_STRING_TEST(InternalizeOneByteString, uint8_t) |
1411 INVALID_STRING_TEST(InternalizeUtf8String, char) | 1412 INVALID_STRING_TEST(InternalizeUtf8String, char) |
1412 | 1413 |
1413 #undef INVALID_STRING_TEST | 1414 #undef INVALID_STRING_TEST |
OLD | NEW |