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 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 Handle<String> string = | 1076 Handle<String> string = |
1077 FACTORY->NewStringFromAscii(CStrVector("parentparentparent")); | 1077 FACTORY->NewStringFromAscii(CStrVector("parentparentparent")); |
1078 Handle<String> parent = FACTORY->NewConsString(string, string); | 1078 Handle<String> parent = FACTORY->NewConsString(string, string); |
1079 CHECK(parent->IsConsString()); | 1079 CHECK(parent->IsConsString()); |
1080 CHECK(!parent->IsFlat()); | 1080 CHECK(!parent->IsFlat()); |
1081 Handle<String> slice = FACTORY->NewSubString(parent, 1, 25); | 1081 Handle<String> slice = FACTORY->NewSubString(parent, 1, 25); |
1082 // After slicing, the original string becomes a flat cons. | 1082 // After slicing, the original string becomes a flat cons. |
1083 CHECK(parent->IsFlat()); | 1083 CHECK(parent->IsFlat()); |
1084 CHECK(slice->IsSlicedString()); | 1084 CHECK(slice->IsSlicedString()); |
1085 CHECK_EQ(SlicedString::cast(*slice)->parent(), | 1085 CHECK_EQ(SlicedString::cast(*slice)->parent(), |
1086 ConsString::cast(*parent)->first()); | 1086 // Parent could have been short-circuited. |
| 1087 parent->IsConsString() ? ConsString::cast(*parent)->first() |
| 1088 : *parent); |
1087 CHECK(SlicedString::cast(*slice)->parent()->IsSeqString()); | 1089 CHECK(SlicedString::cast(*slice)->parent()->IsSeqString()); |
1088 CHECK(slice->IsFlat()); | 1090 CHECK(slice->IsFlat()); |
1089 } | 1091 } |
1090 | 1092 |
1091 | 1093 |
1092 class AsciiVectorResource : public v8::String::ExternalAsciiStringResource { | 1094 class AsciiVectorResource : public v8::String::ExternalAsciiStringResource { |
1093 public: | 1095 public: |
1094 explicit AsciiVectorResource(i::Vector<const char> vector) | 1096 explicit AsciiVectorResource(i::Vector<const char> vector) |
1095 : data_(vector) {} | 1097 : data_(vector) {} |
1096 virtual ~AsciiVectorResource() {} | 1098 virtual ~AsciiVectorResource() {} |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1348 CheckCanonicalEquivalence(c, test); | 1350 CheckCanonicalEquivalence(c, test); |
1349 continue; | 1351 continue; |
1350 } | 1352 } |
1351 if (upper != c && lower != c) { | 1353 if (upper != c && lower != c) { |
1352 CheckCanonicalEquivalence(c, test); | 1354 CheckCanonicalEquivalence(c, test); |
1353 continue; | 1355 continue; |
1354 } | 1356 } |
1355 CHECK_EQ(Min(upper, lower), test); | 1357 CHECK_EQ(Min(upper, lower), test); |
1356 } | 1358 } |
1357 } | 1359 } |
OLD | NEW |