Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Unified Diff: runtime/vm/dart_api_impl_test.cc

Issue 180113009: Pretenure large external typed data and strings. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {"
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698