Index: runtime/vm/dart_api_impl_test.cc |
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc |
index 6f4d1587f623cfc9c2f040498801015cdd1e3bc5..b49491a64432fc25843ad02c5f7363379a73158b 100644 |
--- a/runtime/vm/dart_api_impl_test.cc |
+++ b/runtime/vm/dart_api_impl_test.cc |
@@ -397,7 +397,6 @@ TEST_CASE(CurrentStacktraceInfo) { |
TEST_CASE(ErrorHandleTypes) { |
- Isolate* isolate = Isolate::Current(); |
const String& compile_message = String::Handle(String::New("CompileError")); |
const String& fatal_message = String::Handle(String::New("FatalError")); |
@@ -406,9 +405,9 @@ TEST_CASE(ErrorHandleTypes) { |
Dart_Handle exception_error = |
Dart_NewUnhandledExceptionError(NewString("ExceptionError")); |
Dart_Handle compile_error = |
- Api::NewHandle(isolate, LanguageError::New(compile_message)); |
+ Api::NewHandle(thread, LanguageError::New(compile_message)); |
Dart_Handle fatal_error = |
- Api::NewHandle(isolate, UnwindError::New(fatal_message)); |
+ Api::NewHandle(thread, UnwindError::New(fatal_message)); |
EXPECT_VALID(not_error); |
EXPECT(Dart_IsError(api_error)); |
@@ -450,13 +449,12 @@ TEST_CASE(ErrorHandleTypes) { |
TEST_CASE(UnhandleExceptionError) { |
- Isolate* isolate = Isolate::Current(); |
const char* exception_cstr = ""; |
// Test with an API Error. |
const char* kApiError = "Api Error Exception Test."; |
Dart_Handle api_error = Api::NewHandle( |
- isolate, |
+ thread, |
ApiError::New(String::Handle(String::New(kApiError)))); |
Dart_Handle exception_error = Dart_NewUnhandledExceptionError(api_error); |
EXPECT(!Dart_IsApiError(exception_error)); |
@@ -471,7 +469,7 @@ TEST_CASE(UnhandleExceptionError) { |
const String& compile_message = |
String::Handle(String::New(kCompileError)); |
Dart_Handle compile_error = |
- Api::NewHandle(isolate, LanguageError::New(compile_message)); |
+ Api::NewHandle(thread, LanguageError::New(compile_message)); |
exception_error = Dart_NewUnhandledExceptionError(compile_error); |
EXPECT(!Dart_IsApiError(exception_error)); |
EXPECT(Dart_IsUnhandledExceptionError(exception_error)); |
@@ -484,14 +482,14 @@ TEST_CASE(UnhandleExceptionError) { |
const String& fatal_message = |
String::Handle(String::New("FatalError Exception Test.")); |
Dart_Handle fatal_error = |
- Api::NewHandle(isolate, UnwindError::New(fatal_message)); |
+ Api::NewHandle(thread, UnwindError::New(fatal_message)); |
exception_error = Dart_NewUnhandledExceptionError(fatal_error); |
EXPECT(Dart_IsError(exception_error)); |
EXPECT(!Dart_IsUnhandledExceptionError(exception_error)); |
// Test with a Regular object. |
const char* kRegularString = "Regular String Exception Test."; |
- Dart_Handle obj = Api::NewHandle(isolate, String::New(kRegularString)); |
+ Dart_Handle obj = Api::NewHandle(thread, String::New(kRegularString)); |
exception_error = Dart_NewUnhandledExceptionError(obj); |
EXPECT(!Dart_IsApiError(exception_error)); |
EXPECT(Dart_IsUnhandledExceptionError(exception_error)); |
@@ -617,7 +615,7 @@ TEST_CASE(IdentityEquals) { |
// Non-instance objects. |
{ |
- DARTSCOPE(Thread::Current()); |
+ DARTSCOPE(thread); |
Dart_Handle lib1 = Dart_LookupLibrary(dart_core); |
Dart_Handle lib2 = Dart_LookupLibrary(dart_mirrors); |
@@ -662,7 +660,7 @@ TEST_CASE(IdentityHash) { |
// Non-instance objects. |
{ |
- DARTSCOPE(Thread::Current()); |
+ DARTSCOPE(thread); |
Dart_Handle lib1 = Dart_LookupLibrary(dart_core); |
Dart_Handle lib2 = Dart_LookupLibrary(dart_mirrors); |
@@ -1226,7 +1224,7 @@ TEST_CASE(ExternalStringPretenure) { |
NULL); |
EXPECT_VALID(small16); |
{ |
- DARTSCOPE(Thread::Current()); |
+ DARTSCOPE(thread); |
String& handle = String::Handle(); |
handle ^= Api::UnwrapHandle(big8); |
EXPECT(handle.IsOld()); |
@@ -1260,7 +1258,7 @@ TEST_CASE(ExternalTypedDataPretenure) { |
kSmallLength); |
EXPECT_VALID(small); |
{ |
- DARTSCOPE(Thread::Current()); |
+ DARTSCOPE(thread); |
ExternalTypedData& handle = ExternalTypedData::Handle(); |
handle ^= Api::UnwrapHandle(big); |
EXPECT(handle.IsOld()); |
@@ -2379,23 +2377,21 @@ TEST_CASE(Float32x4List) { |
UNIT_TEST_CASE(EnterExitScope) { |
TestIsolateScope __test_isolate__; |
- Isolate* isolate = Isolate::Current(); |
- EXPECT(isolate != NULL); |
- ApiState* state = isolate->api_state(); |
- EXPECT(state != NULL); |
- ApiLocalScope* scope = state->top_scope(); |
+ Thread* thread = Thread::Current(); |
+ EXPECT(thread != NULL); |
+ ApiLocalScope* scope = thread->api_top_scope(); |
Dart_EnterScope(); |
{ |
- EXPECT(state->top_scope() != NULL); |
+ EXPECT(thread->api_top_scope() != NULL); |
DARTSCOPE(Thread::Current()); |
const String& str1 = String::Handle(String::New("Test String")); |
- Dart_Handle ref = Api::NewHandle(isolate, str1.raw()); |
+ Dart_Handle ref = Api::NewHandle(thread, str1.raw()); |
String& str2 = String::Handle(); |
str2 ^= Api::UnwrapHandle(ref); |
EXPECT(str1.Equals(str2)); |
} |
Dart_ExitScope(); |
- EXPECT(scope == state->top_scope()); |
+ EXPECT(scope == thread->api_top_scope()); |
} |
@@ -2409,17 +2405,17 @@ UNIT_TEST_CASE(PersistentHandles) { |
EXPECT(isolate != NULL); |
ApiState* state = isolate->api_state(); |
EXPECT(state != NULL); |
- ApiLocalScope* scope = state->top_scope(); |
+ ApiLocalScope* scope = thread->api_top_scope(); |
Dart_PersistentHandle handles[2000]; |
Dart_EnterScope(); |
{ |
DARTSCOPE(Thread::Current()); |
- Dart_Handle ref1 = Api::NewHandle(isolate, String::New(kTestString1)); |
+ Dart_Handle ref1 = Api::NewHandle(thread, String::New(kTestString1)); |
for (int i = 0; i < 1000; i++) { |
handles[i] = Dart_NewPersistentHandle(ref1); |
} |
Dart_EnterScope(); |
- Dart_Handle ref2 = Api::NewHandle(isolate, String::New(kTestString2)); |
+ Dart_Handle ref2 = Api::NewHandle(thread, String::New(kTestString2)); |
for (int i = 1000; i < 2000; i++) { |
handles[i] = Dart_NewPersistentHandle(ref2); |
} |
@@ -2460,7 +2456,7 @@ UNIT_TEST_CASE(PersistentHandles) { |
EXPECT(str.Equals(kTestString2)); |
} |
} |
- EXPECT(scope == state->top_scope()); |
+ EXPECT(scope == thread->api_top_scope()); |
EXPECT_EQ(2001, state->CountPersistentHandles()); |
Dart_ShutdownIsolate(); |
} |
@@ -2502,22 +2498,22 @@ UNIT_TEST_CASE(AssignToPersistentHandle) { |
const char* kTestString2 = "Test String2"; |
TestIsolateScope __test_isolate__; |
- Isolate* isolate = Isolate::Current(); |
+ DARTSCOPE(Thread::Current()); |
+ Isolate* isolate = T->isolate(); |
EXPECT(isolate != NULL); |
ApiState* state = isolate->api_state(); |
EXPECT(state != NULL); |
- DARTSCOPE(Thread::Current()); |
String& str = String::Handle(); |
// Start with a known persistent handle. |
- Dart_Handle ref1 = Api::NewHandle(isolate, String::New(kTestString1)); |
+ Dart_Handle ref1 = Api::NewHandle(T, String::New(kTestString1)); |
Dart_PersistentHandle obj = Dart_NewPersistentHandle(ref1); |
EXPECT(state->IsValidPersistentHandle(obj)); |
str ^= PersistentHandle::Cast(obj)->raw(); |
EXPECT(str.Equals(kTestString1)); |
// Now create another local handle and assign it to the persistent handle. |
- Dart_Handle ref2 = Api::NewHandle(isolate, String::New(kTestString2)); |
+ Dart_Handle ref2 = Api::NewHandle(T, String::New(kTestString2)); |
Dart_SetPersistentHandle(obj, ref2); |
str ^= PersistentHandle::Cast(obj)->raw(); |
EXPECT(str.Equals(kTestString2)); |
@@ -2585,9 +2581,8 @@ TEST_CASE(WeakPersistentHandle) { |
// Create an object in old space. |
Dart_Handle old_ref; |
{ |
- Isolate* isolate = Isolate::Current(); |
DARTSCOPE(Thread::Current()); |
- old_ref = Api::NewHandle(isolate, String::New("old string", Heap::kOld)); |
+ old_ref = Api::NewHandle(thread, String::New("old string", Heap::kOld)); |
EXPECT_VALID(old_ref); |
} |
@@ -2832,14 +2827,14 @@ TEST_CASE(WeakPersistentHandleExternalAllocationSizeOldspaceGC) { |
// Check that external allocation in old space can trigger GC. |
Isolate* isolate = Isolate::Current(); |
Dart_EnterScope(); |
- Dart_Handle live = Api::NewHandle(isolate, String::New("live", Heap::kOld)); |
+ Dart_Handle live = Api::NewHandle(thread, String::New("live", Heap::kOld)); |
EXPECT_VALID(live); |
Dart_WeakPersistentHandle weak = NULL; |
EXPECT_EQ(0, isolate->heap()->ExternalInWords(Heap::kOld)); |
const intptr_t kSmallExternalSize = 1 * KB; |
{ |
Dart_EnterScope(); |
- Dart_Handle dead = Api::NewHandle(isolate, String::New("dead", Heap::kOld)); |
+ Dart_Handle dead = Api::NewHandle(thread, String::New("dead", Heap::kOld)); |
EXPECT_VALID(dead); |
weak = Dart_NewWeakPersistentHandle(dead, |
NULL, |
@@ -2920,11 +2915,10 @@ TEST_CASE(ImplicitReferencesOldSpace) { |
Dart_EnterScope(); |
{ |
- Isolate* isolate = Isolate::Current(); |
DARTSCOPE(Thread::Current()); |
Dart_Handle local = Api::NewHandle( |
- isolate, String::New("strongly reachable", Heap::kOld)); |
+ thread, String::New("strongly reachable", Heap::kOld)); |
strong = Dart_NewPersistentHandle(local); |
strong_weak = Dart_NewWeakPersistentHandle(local, NULL, 0, NopCallback); |
@@ -2935,19 +2929,19 @@ TEST_CASE(ImplicitReferencesOldSpace) { |
EXPECT(Dart_IdentityEquals(AsHandle(strong), AsHandle(strong_weak))) |
weak1 = Dart_NewWeakPersistentHandle( |
- Api::NewHandle(isolate, String::New("weakly reachable 1", Heap::kOld)), |
+ Api::NewHandle(thread, String::New("weakly reachable 1", Heap::kOld)), |
NULL, 0, ImplicitReferencesCallback); |
EXPECT(!Dart_IsNull(AsHandle(weak1))); |
EXPECT_VALID(AsHandle(weak1)); |
weak2 = Dart_NewWeakPersistentHandle( |
- Api::NewHandle(isolate, String::New("weakly reachable 2", Heap::kOld)), |
+ Api::NewHandle(thread, String::New("weakly reachable 2", Heap::kOld)), |
NULL, 0, ImplicitReferencesCallback); |
EXPECT(!Dart_IsNull(AsHandle(weak2))); |
EXPECT_VALID(AsHandle(weak2)); |
weak3 = Dart_NewWeakPersistentHandle( |
- Api::NewHandle(isolate, String::New("weakly reachable 3", Heap::kOld)), |
+ Api::NewHandle(thread, String::New("weakly reachable 3", Heap::kOld)), |
NULL, 0, ImplicitReferencesCallback); |
EXPECT(!Dart_IsNull(AsHandle(weak3))); |
EXPECT_VALID(AsHandle(weak3)); |
@@ -2984,11 +2978,10 @@ TEST_CASE(ImplicitReferencesNewSpace) { |
Dart_EnterScope(); |
{ |
- Isolate* isolate = Isolate::Current(); |
DARTSCOPE(Thread::Current()); |
Dart_Handle local = Api::NewHandle( |
- isolate, String::New("strongly reachable", Heap::kOld)); |
+ thread, String::New("strongly reachable", Heap::kOld)); |
strong = Dart_NewPersistentHandle(local); |
strong_weak = Dart_NewWeakPersistentHandle(local, NULL, 0, NopCallback); |
@@ -2999,19 +2992,19 @@ TEST_CASE(ImplicitReferencesNewSpace) { |
EXPECT(Dart_IdentityEquals(AsHandle(strong), AsHandle(strong_weak))) |
weak1 = Dart_NewWeakPersistentHandle( |
- Api::NewHandle(isolate, String::New("weakly reachable 1", Heap::kNew)), |
+ Api::NewHandle(thread, String::New("weakly reachable 1", Heap::kNew)), |
NULL, 0, ImplicitReferencesCallback); |
EXPECT(!Dart_IsNull(AsHandle(weak1))); |
EXPECT_VALID(AsHandle(weak1)); |
weak2 = Dart_NewWeakPersistentHandle( |
- Api::NewHandle(isolate, String::New("weakly reachable 2", Heap::kNew)), |
+ Api::NewHandle(thread, String::New("weakly reachable 2", Heap::kNew)), |
NULL, 0, ImplicitReferencesCallback); |
EXPECT(!Dart_IsNull(AsHandle(weak2))); |
EXPECT_VALID(AsHandle(weak2)); |
weak3 = Dart_NewWeakPersistentHandle( |
- Api::NewHandle(isolate, String::New("weakly reachable 3", Heap::kNew)), |
+ Api::NewHandle(thread, String::New("weakly reachable 3", Heap::kNew)), |
NULL, 0, ImplicitReferencesCallback); |
EXPECT(!Dart_IsNull(AsHandle(weak3))); |
EXPECT_VALID(AsHandle(weak3)); |
@@ -3209,9 +3202,7 @@ UNIT_TEST_CASE(LocalHandles) { |
Thread* thread = Thread::Current(); |
Isolate* isolate = thread->isolate(); |
EXPECT(isolate != NULL); |
- ApiState* state = isolate->api_state(); |
- EXPECT(state != NULL); |
- ApiLocalScope* scope = state->top_scope(); |
+ ApiLocalScope* scope = thread->api_top_scope(); |
Dart_Handle handles[300]; |
{ |
StackZone zone(thread); |
@@ -3221,9 +3212,9 @@ UNIT_TEST_CASE(LocalHandles) { |
// Start a new scope and allocate some local handles. |
Dart_EnterScope(); |
for (int i = 0; i < 100; i++) { |
- handles[i] = Api::NewHandle(isolate, Smi::New(i)); |
+ handles[i] = Api::NewHandle(thread, Smi::New(i)); |
} |
- EXPECT_EQ(100, state->CountLocalHandles()); |
+ EXPECT_EQ(100, thread->CountLocalHandles()); |
for (int i = 0; i < 100; i++) { |
val ^= Api::UnwrapHandle(handles[i]); |
EXPECT_EQ(i, val.Value()); |
@@ -3232,9 +3223,9 @@ UNIT_TEST_CASE(LocalHandles) { |
{ |
Dart_EnterScope(); |
for (int i = 100; i < 200; i++) { |
- handles[i] = Api::NewHandle(isolate, Smi::New(i)); |
+ handles[i] = Api::NewHandle(thread, Smi::New(i)); |
} |
- EXPECT_EQ(200, state->CountLocalHandles()); |
+ EXPECT_EQ(200, thread->CountLocalHandles()); |
for (int i = 100; i < 200; i++) { |
val ^= Api::UnwrapHandle(handles[i]); |
EXPECT_EQ(i, val.Value()); |
@@ -3244,25 +3235,25 @@ UNIT_TEST_CASE(LocalHandles) { |
{ |
Dart_EnterScope(); |
for (int i = 200; i < 300; i++) { |
- handles[i] = Api::NewHandle(isolate, Smi::New(i)); |
+ handles[i] = Api::NewHandle(thread, Smi::New(i)); |
} |
- EXPECT_EQ(300, state->CountLocalHandles()); |
+ EXPECT_EQ(300, thread->CountLocalHandles()); |
for (int i = 200; i < 300; i++) { |
val ^= Api::UnwrapHandle(handles[i]); |
EXPECT_EQ(i, val.Value()); |
} |
- EXPECT_EQ(300, state->CountLocalHandles()); |
+ EXPECT_EQ(300, thread->CountLocalHandles()); |
VERIFY_ON_TRANSITION; |
Dart_ExitScope(); |
} |
- EXPECT_EQ(200, state->CountLocalHandles()); |
+ EXPECT_EQ(200, thread->CountLocalHandles()); |
Dart_ExitScope(); |
} |
- EXPECT_EQ(100, state->CountLocalHandles()); |
+ EXPECT_EQ(100, thread->CountLocalHandles()); |
Dart_ExitScope(); |
} |
- EXPECT_EQ(0, state->CountLocalHandles()); |
- EXPECT(scope == state->top_scope()); |
+ EXPECT_EQ(0, thread->CountLocalHandles()); |
+ EXPECT(scope == thread->api_top_scope()); |
Dart_ShutdownIsolate(); |
} |
@@ -3272,25 +3263,23 @@ UNIT_TEST_CASE(LocalHandles) { |
// exits. |
UNIT_TEST_CASE(LocalZoneMemory) { |
TestCase::CreateTestIsolate(); |
- Isolate* isolate = Isolate::Current(); |
- EXPECT(isolate != NULL); |
- ApiState* state = isolate->api_state(); |
- EXPECT(state != NULL); |
- ApiLocalScope* scope = state->top_scope(); |
+ Thread* thread = Thread::Current(); |
+ EXPECT(thread != NULL); |
+ ApiLocalScope* scope = thread->api_top_scope(); |
{ |
// Start a new scope and allocate some memory. |
Dart_EnterScope(); |
for (int i = 0; i < 100; i++) { |
Dart_ScopeAllocate(16); |
} |
- EXPECT_EQ(1600, state->ZoneSizeInBytes()); |
+ EXPECT_EQ(1600, thread->ZoneSizeInBytes()); |
// Start another scope and allocate some more memory. |
{ |
Dart_EnterScope(); |
for (int i = 0; i < 100; i++) { |
Dart_ScopeAllocate(16); |
} |
- EXPECT_EQ(3200, state->ZoneSizeInBytes()); |
+ EXPECT_EQ(3200, thread->ZoneSizeInBytes()); |
{ |
// Start another scope and allocate some more memory. |
{ |
@@ -3298,18 +3287,18 @@ UNIT_TEST_CASE(LocalZoneMemory) { |
for (int i = 0; i < 200; i++) { |
Dart_ScopeAllocate(16); |
} |
- EXPECT_EQ(6400, state->ZoneSizeInBytes()); |
+ EXPECT_EQ(6400, thread->ZoneSizeInBytes()); |
Dart_ExitScope(); |
} |
} |
- EXPECT_EQ(3200, state->ZoneSizeInBytes()); |
+ EXPECT_EQ(3200, thread->ZoneSizeInBytes()); |
Dart_ExitScope(); |
} |
- EXPECT_EQ(1600, state->ZoneSizeInBytes()); |
+ EXPECT_EQ(1600, thread->ZoneSizeInBytes()); |
Dart_ExitScope(); |
} |
- EXPECT_EQ(0, state->ZoneSizeInBytes()); |
- EXPECT(scope == state->top_scope()); |
+ EXPECT_EQ(0, thread->ZoneSizeInBytes()); |
+ EXPECT(scope == thread->api_top_scope()); |
Dart_ShutdownIsolate(); |
} |
@@ -4838,7 +4827,7 @@ static Dart_Handle PrivateLibName(Dart_Handle lib, const char* str) { |
Thread* thread = Thread::Current(); |
const Library& library_obj = Api::UnwrapLibraryHandle(thread->zone(), lib); |
const String& name = String::Handle(String::New(str)); |
- return Api::NewHandle(thread->isolate(), library_obj.PrivateName(name)); |
+ return Api::NewHandle(thread, library_obj.PrivateName(name)); |
} |
@@ -5249,11 +5238,7 @@ TEST_CASE(ThrowException) { |
const char* kScriptChars = |
"int test() native \"ThrowException_native\";"; |
Dart_Handle result; |
- Isolate* isolate = Isolate::Current(); |
- EXPECT(isolate != NULL); |
- ApiState* state = isolate->api_state(); |
- EXPECT(state != NULL); |
- intptr_t size = state->ZoneSizeInBytes(); |
+ intptr_t size = thread->ZoneSizeInBytes(); |
Dart_EnterScope(); // Start a Dart API scope for invoking API functions. |
// Load up a test script which extends the native wrapper class. |
@@ -5272,7 +5257,7 @@ TEST_CASE(ThrowException) { |
EXPECT(Dart_ErrorHasException(result)); |
Dart_ExitScope(); // Exit the Dart API scope. |
- EXPECT_EQ(size, state->ZoneSizeInBytes()); |
+ EXPECT_EQ(size, thread->ZoneSizeInBytes()); |
} |
@@ -8094,7 +8079,7 @@ TEST_CASE(OnePromotedPeer) { |
// by one. |
TEST_CASE(OneOldSpacePeer) { |
Isolate* isolate = Isolate::Current(); |
- Dart_Handle str = Api::NewHandle(isolate, String::New("str", Heap::kOld)); |
+ Dart_Handle str = Api::NewHandle(thread, String::New("str", Heap::kOld)); |
EXPECT_VALID(str); |
EXPECT(Dart_IsString(str)); |
EXPECT_EQ(0, isolate->heap()->PeerCount()); |
@@ -8127,7 +8112,7 @@ TEST_CASE(CollectOneOldSpacePeer) { |
Dart_EnterScope(); |
{ |
DARTSCOPE(Thread::Current()); |
- Dart_Handle str = Api::NewHandle(isolate, String::New("str", Heap::kOld)); |
+ Dart_Handle str = Api::NewHandle(T, String::New("str", Heap::kOld)); |
EXPECT_VALID(str); |
EXPECT(Dart_IsString(str)); |
EXPECT_EQ(0, isolate->heap()->PeerCount()); |
@@ -8156,7 +8141,7 @@ TEST_CASE(CollectOneOldSpacePeer) { |
// by two. |
TEST_CASE(TwoOldSpacePeers) { |
Isolate* isolate = Isolate::Current(); |
- Dart_Handle s1 = Api::NewHandle(isolate, String::New("s1", Heap::kOld)); |
+ Dart_Handle s1 = Api::NewHandle(thread, String::New("s1", Heap::kOld)); |
EXPECT_VALID(s1); |
EXPECT(Dart_IsString(s1)); |
EXPECT_EQ(0, isolate->heap()->PeerCount()); |
@@ -8169,7 +8154,7 @@ TEST_CASE(TwoOldSpacePeers) { |
o1 = &o1; |
EXPECT_VALID(Dart_GetPeer(s1, &o1)); |
EXPECT(o1 == reinterpret_cast<void*>(&p1)); |
- Dart_Handle s2 = Api::NewHandle(isolate, String::New("s2", Heap::kOld)); |
+ Dart_Handle s2 = Api::NewHandle(thread, String::New("s2", Heap::kOld)); |
EXPECT_VALID(s2); |
EXPECT(Dart_IsString(s2)); |
EXPECT_EQ(1, isolate->heap()->PeerCount()); |
@@ -8203,7 +8188,7 @@ TEST_CASE(CollectTwoOldSpacePeers) { |
Dart_EnterScope(); |
{ |
DARTSCOPE(Thread::Current()); |
- Dart_Handle s1 = Api::NewHandle(isolate, String::New("s1", Heap::kOld)); |
+ Dart_Handle s1 = Api::NewHandle(T, String::New("s1", Heap::kOld)); |
EXPECT_VALID(s1); |
EXPECT(Dart_IsString(s1)); |
EXPECT_EQ(0, isolate->heap()->PeerCount()); |
@@ -8216,7 +8201,7 @@ TEST_CASE(CollectTwoOldSpacePeers) { |
o1 = &o1; |
EXPECT_VALID(Dart_GetPeer(s1, &o1)); |
EXPECT(o1 == reinterpret_cast<void*>(&p1)); |
- Dart_Handle s2 = Api::NewHandle(isolate, String::New("s2", Heap::kOld)); |
+ Dart_Handle s2 = Api::NewHandle(T, String::New("s2", Heap::kOld)); |
EXPECT_VALID(s2); |
EXPECT(Dart_IsString(s2)); |
EXPECT_EQ(1, isolate->heap()->PeerCount()); |
@@ -8309,8 +8294,7 @@ TEST_CASE(MakeExternalString) { |
// Test with single character canonical string, it should not become |
// external string but the peer should be setup for it. |
- Isolate* isolate = Isolate::Current(); |
- Dart_Handle canonical_str = Api::NewHandle(isolate, Symbols::New("*")); |
+ Dart_Handle canonical_str = Api::NewHandle(thread, Symbols::New("*")); |
EXPECT(Dart_IsString(canonical_str)); |
EXPECT(!Dart_IsExternalString(canonical_str)); |
uint8_t ext_canonical_str[kLength]; |
@@ -8401,7 +8385,7 @@ TEST_CASE(MakeExternalString) { |
const char* symbol_ascii = "?unseen"; |
expected_length = strlen(symbol_ascii); |
Dart_Handle symbol_str = |
- Api::NewHandle(isolate, Symbols::New(symbol_ascii, expected_length)); |
+ Api::NewHandle(thread, Symbols::New(symbol_ascii, expected_length)); |
EXPECT_VALID(symbol_str); |
EXPECT(Dart_IsString(symbol_str)); |
EXPECT(Dart_IsStringLatin1(symbol_str)); |