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 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 explicit OneByteVectorResource(i::Vector<const char> vector) | 1183 explicit OneByteVectorResource(i::Vector<const char> vector) |
1184 : data_(vector) {} | 1184 : data_(vector) {} |
1185 virtual ~OneByteVectorResource() {} | 1185 virtual ~OneByteVectorResource() {} |
1186 virtual size_t length() const { return data_.length(); } | 1186 virtual size_t length() const { return data_.length(); } |
1187 virtual const char* data() const { return data_.start(); } | 1187 virtual const char* data() const { return data_.start(); } |
1188 private: | 1188 private: |
1189 i::Vector<const char> data_; | 1189 i::Vector<const char> data_; |
1190 }; | 1190 }; |
1191 | 1191 |
1192 TEST(InternalizeExternal) { | 1192 TEST(InternalizeExternal) { |
| 1193 // TODO(mlippautz): Remove once we add support for forwarding ThinStrings in |
| 1194 // minor MC. |
| 1195 if (FLAG_minor_mc) return; |
1193 FLAG_thin_strings = true; | 1196 FLAG_thin_strings = true; |
1194 CcTest::InitializeVM(); | 1197 CcTest::InitializeVM(); |
1195 i::Isolate* isolate = CcTest::i_isolate(); | 1198 i::Isolate* isolate = CcTest::i_isolate(); |
1196 Factory* factory = isolate->factory(); | 1199 Factory* factory = isolate->factory(); |
1197 // This won't leak; the external string mechanism will call Dispose() on it. | 1200 // This won't leak; the external string mechanism will call Dispose() on it. |
1198 OneByteVectorResource* resource = | 1201 OneByteVectorResource* resource = |
1199 new OneByteVectorResource(i::Vector<const char>("prop", 4)); | 1202 new OneByteVectorResource(i::Vector<const char>("prop", 4)); |
1200 { | 1203 { |
1201 v8::HandleScope scope(CcTest::isolate()); | 1204 v8::HandleScope scope(CcTest::isolate()); |
1202 v8::Local<v8::String> ext_string = | 1205 v8::Local<v8::String> ext_string = |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1657 CHECK_EQ(1, CompileRun("external.indexOf('', 1)") | 1660 CHECK_EQ(1, CompileRun("external.indexOf('', 1)") |
1658 ->Int32Value(context.local()) | 1661 ->Int32Value(context.local()) |
1659 .FromJust()); | 1662 .FromJust()); |
1660 CHECK_EQ(-1, CompileRun("external.indexOf('a', 1)") | 1663 CHECK_EQ(-1, CompileRun("external.indexOf('a', 1)") |
1661 ->Int32Value(context.local()) | 1664 ->Int32Value(context.local()) |
1662 .FromJust()); | 1665 .FromJust()); |
1663 CHECK_EQ(-1, CompileRun("external.indexOf('$')") | 1666 CHECK_EQ(-1, CompileRun("external.indexOf('$')") |
1664 ->Int32Value(context.local()) | 1667 ->Int32Value(context.local()) |
1665 .FromJust()); | 1668 .FromJust()); |
1666 } | 1669 } |
OLD | NEW |