Chromium Code Reviews| Index: runtime/vm/dart_api_impl_test.cc |
| =================================================================== |
| --- runtime/vm/dart_api_impl_test.cc (revision 33338) |
| +++ runtime/vm/dart_api_impl_test.cc (working copy) |
| @@ -1022,6 +1022,60 @@ |
| } |
| +TEST_CASE(ExternalStringPretenure) { |
| + Isolate* isolate = Isolate::Current(); |
| + { |
| + Dart_EnterScope(); |
| + static const uint8_t big_data8[16*MB] = {0, }; |
| + Dart_Handle big8 = Dart_NewExternalLatin1String( |
| + big_data8, |
| + ARRAY_SIZE(big_data8), |
| + NULL, |
| + NULL); |
| + EXPECT_VALID(big8); |
| + static const uint16_t big_data16[16*MB/2] = {0, }; |
| + Dart_Handle big16 = Dart_NewExternalUTF16String( |
| + big_data16, |
| + ARRAY_SIZE(big_data16), |
| + NULL, |
| + NULL); |
| + EXPECT_VALID(big16); |
| + { |
| + DARTSCOPE(isolate); |
| + String& handle = String::Handle(); |
| + handle ^= Api::UnwrapHandle(big8); |
| + EXPECT(handle.IsOld()); |
|
Ivan Posva
2014/03/05 20:48:42
How about also testing that small external strings
koda
2014/03/05 21:08:59
Done.
|
| + handle ^= Api::UnwrapHandle(big16); |
| + EXPECT(handle.IsOld()); |
| + } |
| + Dart_ExitScope(); |
| + } |
| +} |
| + |
| + |
| +TEST_CASE(ExternalTypedDataPretenure) { |
| + Isolate* isolate = Isolate::Current(); |
| + { |
| + Dart_EnterScope(); |
| + static const int kLength = 16*MB/8; |
| + int64_t* big_data = new int64_t[kLength](); |
| + Dart_Handle big = Dart_NewExternalTypedData( |
| + Dart_TypedData_kInt64, |
| + big_data, |
| + kLength); |
| + EXPECT_VALID(big); |
| + { |
| + DARTSCOPE(isolate); |
| + ExternalTypedData& handle = ExternalTypedData::Handle(); |
| + handle ^= Api::UnwrapHandle(big); |
| + EXPECT(handle.IsOld()); |
|
Ivan Posva
2014/03/05 20:48:42
ditto
koda
2014/03/05 21:08:59
Done.
|
| + } |
| + delete[] big_data; |
| + Dart_ExitScope(); |
| + } |
| +} |
| + |
| + |
| TEST_CASE(ListAccess) { |
| const char* kScriptChars = |
| "List testMain() {" |