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