mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
[vm] Add missing safepoint transitions.
Mostly tests; 1 non-test bug in propagating an error through Dart_SetReturnValue. This is progress towards asserting thread->excution_state() == kThreadInVM in Object::Allocate. Change-Id: I6a59549868ab317b3c0d32aa42f3661289cbf456 Reviewed-on: https://dart-review.googlesource.com/71720 Reviewed-by: Siva Annamalai <asiva@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
parent
28f902744b
commit
14db718ed5
|
@ -73,7 +73,7 @@ static void StackAllocatedDestructionHelper(int* ptr) {
|
|||
*ptr = 3;
|
||||
}
|
||||
|
||||
VM_UNIT_TEST_CASE(StackAllocatedDestruction) {
|
||||
ISOLATE_UNIT_TEST_CASE(StackAllocatedDestruction) {
|
||||
int data = 1;
|
||||
StackAllocatedDestructionHelper(&data);
|
||||
EXPECT_EQ(4, data);
|
||||
|
@ -89,7 +89,7 @@ static void StackAllocatedLongJumpHelper(int* ptr, LongJumpScope* jump) {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
TEST_CASE(StackAllocatedLongJump) {
|
||||
ISOLATE_UNIT_TEST_CASE(StackAllocatedLongJump) {
|
||||
LongJumpScope jump;
|
||||
int data = 1;
|
||||
if (setjmp(*jump.Set()) == 0) {
|
||||
|
@ -114,7 +114,7 @@ static void StackResourceDestructionHelper(int* ptr) {
|
|||
// Do not set data because the LongJump version does not return control here.
|
||||
}
|
||||
|
||||
TEST_CASE(StackResourceDestruction) {
|
||||
ISOLATE_UNIT_TEST_CASE(StackResourceDestruction) {
|
||||
int data = 1;
|
||||
StackResourceDestructionHelper(&data);
|
||||
EXPECT_EQ(7, data);
|
||||
|
@ -138,7 +138,7 @@ static void StackResourceLongJumpHelper(int* ptr, LongJumpScope* jump) {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
TEST_CASE(StackResourceLongJump) {
|
||||
ISOLATE_UNIT_TEST_CASE(StackResourceLongJump) {
|
||||
LongJumpScope* base = Thread::Current()->long_jump_base();
|
||||
{
|
||||
LongJumpScope jump;
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace dart {
|
|||
|
||||
#ifndef PRODUCT
|
||||
|
||||
TEST_CASE(AstPrinter) {
|
||||
ISOLATE_UNIT_TEST_CASE(AstPrinter) {
|
||||
const TokenPosition kPos = TokenPosition::kNoSource;
|
||||
LocalVariable* v = new LocalVariable(
|
||||
kPos, kPos, String::ZoneHandle(Symbols::New(thread, "wurscht")),
|
||||
|
|
|
@ -666,6 +666,7 @@ BENCHMARK(LargeMap) {
|
|||
EXPECT_VALID(h_lib);
|
||||
Dart_Handle h_result = Dart_Invoke(h_lib, NewString("makeMap"), 0, NULL);
|
||||
EXPECT_VALID(h_result);
|
||||
TransitionNativeToVM transition(thread);
|
||||
Instance& map = Instance::Handle();
|
||||
map ^= Api::UnwrapHandle(h_result);
|
||||
const intptr_t kLoopCount = 100;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace dart {
|
||||
|
||||
TEST_CASE(BitmapBuilder) {
|
||||
ISOLATE_UNIT_TEST_CASE(BitmapBuilder) {
|
||||
// Test basic bit map builder operations.
|
||||
BitmapBuilder* builder1 = new BitmapBuilder();
|
||||
EXPECT_EQ(0, builder1->Length());
|
||||
|
|
|
@ -21,7 +21,7 @@ static RawClass* CreateTestClass(const char* name) {
|
|||
return cls.raw();
|
||||
}
|
||||
|
||||
TEST_CASE(ClassFinalizer) {
|
||||
ISOLATE_UNIT_TEST_CASE(ClassFinalizer) {
|
||||
Zone* zone = thread->zone();
|
||||
Isolate* isolate = thread->isolate();
|
||||
ObjectStore* object_store = isolate->object_store();
|
||||
|
@ -51,7 +51,7 @@ TEST_CASE(ClassFinalizer) {
|
|||
EXPECT(ClassFinalizer::ProcessPendingClasses());
|
||||
}
|
||||
|
||||
TEST_CASE(ClassFinalize_Cycles) {
|
||||
ISOLATE_UNIT_TEST_CASE(ClassFinalize_Cycles) {
|
||||
Zone* zone = thread->zone();
|
||||
Isolate* isolate = thread->isolate();
|
||||
ObjectStore* object_store = isolate->object_store();
|
||||
|
@ -75,7 +75,7 @@ static RawLibrary* NewLib(const char* url_chars) {
|
|||
return Library::New(url);
|
||||
}
|
||||
|
||||
TEST_CASE(ClassFinalize_Resolve) {
|
||||
ISOLATE_UNIT_TEST_CASE(ClassFinalize_Resolve) {
|
||||
Zone* zone = thread->zone();
|
||||
Isolate* isolate = thread->isolate();
|
||||
ObjectStore* object_store = isolate->object_store();
|
||||
|
|
|
@ -266,7 +266,7 @@ TEST_CASE(StackMapGC) {
|
|||
EXPECT(!result.IsError());
|
||||
}
|
||||
|
||||
TEST_CASE(DescriptorList_TokenPositions) {
|
||||
ISOLATE_UNIT_TEST_CASE(DescriptorList_TokenPositions) {
|
||||
DescriptorList* descriptors = new DescriptorList(64);
|
||||
ASSERT(descriptors != NULL);
|
||||
const intptr_t token_positions[] = {
|
||||
|
|
|
@ -12,13 +12,14 @@
|
|||
namespace dart {
|
||||
|
||||
static RawObject* ExecuteTest(const Code& code) {
|
||||
Thread* thread = Thread::Current();
|
||||
TransitionToGenerated transition(thread);
|
||||
const intptr_t kTypeArgsLen = 0;
|
||||
const intptr_t kNumArgs = 0;
|
||||
return Simulator::Current()->Call(
|
||||
code, Array::Handle(ArgumentsDescriptor::New(kTypeArgsLen, kNumArgs)),
|
||||
Array::Handle(Array::New(0)), thread);
|
||||
const Array& args_desc =
|
||||
Array::Handle(ArgumentsDescriptor::New(kTypeArgsLen, kNumArgs));
|
||||
const Array& args = Array::Handle(Array::New(0));
|
||||
Thread* thread = Thread::Current();
|
||||
TransitionToGenerated transition(thread);
|
||||
return Simulator::Current()->Call(code, args_desc, args, thread);
|
||||
}
|
||||
|
||||
#define EXECUTE_TEST_CODE_INTPTR(code) \
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace dart {
|
|||
// method on DBC assembler.
|
||||
#if !defined(PRODUCT) && !defined(TARGET_ARCH_DBC)
|
||||
|
||||
TEST_CASE(Disassembler) {
|
||||
ISOLATE_UNIT_TEST_CASE(Disassembler) {
|
||||
ObjectPoolWrapper object_pool_wrapper;
|
||||
Assembler assembler(&object_pool_wrapper);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@ TEST_CASE(ClassHierarchyAnalysis) {
|
|||
"}\n";
|
||||
|
||||
TestCase::LoadTestScript(kScriptChars, NULL);
|
||||
|
||||
TransitionNativeToVM transition(thread);
|
||||
EXPECT(ClassFinalizer::ProcessPendingClasses());
|
||||
const String& name = String::Handle(String::New(TestCase::url()));
|
||||
const Library& lib = Library::Handle(Library::LookupLibrary(thread, name));
|
||||
|
|
|
@ -35,9 +35,12 @@ class SourcePositionTest : public ValueObject {
|
|||
EXPECT(thread_ != NULL);
|
||||
EXPECT(isolate_ != NULL);
|
||||
EXPECT(script_ != NULL);
|
||||
Dart_Handle lib = TestCase::LoadTestScript(script, NULL);
|
||||
EXPECT_VALID(lib);
|
||||
root_lib_ ^= Api::UnwrapHandle(lib);
|
||||
{
|
||||
TransitionVMToNative transition(thread);
|
||||
Dart_Handle lib = TestCase::LoadTestScript(script, NULL);
|
||||
EXPECT_VALID(lib);
|
||||
root_lib_ ^= Api::UnwrapHandle(lib);
|
||||
}
|
||||
EXPECT(!root_lib_.IsNull());
|
||||
root_script_ ^=
|
||||
root_lib_.LookupScript(String::Handle(String::New(USER_TEST_URI)));
|
||||
|
@ -280,7 +283,7 @@ class SourcePositionTest : public ValueObject {
|
|||
GrowableArray<BlockEntryInstr*>* blocks_;
|
||||
};
|
||||
|
||||
TEST_CASE(SourcePosition_InstanceCalls) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_InstanceCalls) {
|
||||
const char* kScript =
|
||||
"var x = 5;\n"
|
||||
"var y = 5;\n"
|
||||
|
@ -300,7 +303,7 @@ TEST_CASE(SourcePosition_InstanceCalls) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_If) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_If) {
|
||||
const char* kScript =
|
||||
"var x = 5;\n"
|
||||
"var y = 5;\n"
|
||||
|
@ -328,7 +331,7 @@ TEST_CASE(SourcePosition_If) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_ForLoop) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_ForLoop) {
|
||||
const char* kScript =
|
||||
"var x = 0;\n"
|
||||
"var y = 5;\n"
|
||||
|
@ -358,7 +361,7 @@ TEST_CASE(SourcePosition_ForLoop) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_While) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_While) {
|
||||
const char* kScript =
|
||||
"var x = 0;\n"
|
||||
"var y = 5;\n"
|
||||
|
@ -406,7 +409,7 @@ TEST_CASE(SourcePosition_While) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_WhileContinueBreak) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_WhileContinueBreak) {
|
||||
const char* kScript =
|
||||
"var x = 0;\n"
|
||||
"var y = 5;\n"
|
||||
|
@ -445,7 +448,7 @@ TEST_CASE(SourcePosition_WhileContinueBreak) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_LoadIndexed) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_LoadIndexed) {
|
||||
const char* kScript =
|
||||
"var x = 0;\n"
|
||||
"var z = new List(3);\n"
|
||||
|
@ -483,7 +486,7 @@ TEST_CASE(SourcePosition_LoadIndexed) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_StoreIndexed) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_StoreIndexed) {
|
||||
const char* kScript =
|
||||
"var x = 0;\n"
|
||||
"var z = new List(4);\n"
|
||||
|
@ -526,7 +529,7 @@ TEST_CASE(SourcePosition_StoreIndexed) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_BitwiseOperations) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_BitwiseOperations) {
|
||||
const char* kScript =
|
||||
"var x = 0;\n"
|
||||
"var y = 1;\n"
|
||||
|
@ -575,7 +578,7 @@ TEST_CASE(SourcePosition_BitwiseOperations) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_IfElse) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_IfElse) {
|
||||
const char* kScript =
|
||||
"var x = 5;\n"
|
||||
"var y = 5;\n"
|
||||
|
@ -604,7 +607,7 @@ TEST_CASE(SourcePosition_IfElse) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_Switch) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_Switch) {
|
||||
const char* kScript =
|
||||
"var x = 5;\n"
|
||||
"var y = 5;\n"
|
||||
|
@ -648,7 +651,7 @@ TEST_CASE(SourcePosition_Switch) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_TryCatchFinally) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_TryCatchFinally) {
|
||||
const char* kScript =
|
||||
"var x = 5;\n"
|
||||
"var y = 5;\n"
|
||||
|
@ -699,7 +702,7 @@ TEST_CASE(SourcePosition_TryCatchFinally) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_InstanceFields) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_InstanceFields) {
|
||||
const char* kScript =
|
||||
"class A {\n"
|
||||
" var x;\n"
|
||||
|
@ -728,7 +731,7 @@ TEST_CASE(SourcePosition_InstanceFields) {
|
|||
spt.EnsureSourcePositions();
|
||||
}
|
||||
|
||||
TEST_CASE(SourcePosition_Async) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourcePosition_Async) {
|
||||
const char* kScript =
|
||||
"import 'dart:async';\n"
|
||||
"var x = 5;\n"
|
||||
|
|
|
@ -426,17 +426,17 @@ TEST_CASE(DartAPI_CurrentStackTraceInfo) {
|
|||
#endif // !PRODUCT
|
||||
|
||||
TEST_CASE(DartAPI_ErrorHandleTypes) {
|
||||
const String& compile_message = String::Handle(String::New("CompileError"));
|
||||
const String& fatal_message = String::Handle(String::New("FatalError"));
|
||||
|
||||
Dart_Handle not_error = NewString("NotError");
|
||||
Dart_Handle api_error = Api::NewError("Api%s", "Error");
|
||||
Dart_Handle api_error = Dart_NewApiError("ApiError");
|
||||
Dart_Handle exception_error =
|
||||
Dart_NewUnhandledExceptionError(NewString("ExceptionError"));
|
||||
Dart_Handle compile_error =
|
||||
Api::NewHandle(thread, LanguageError::New(compile_message));
|
||||
Dart_Handle fatal_error =
|
||||
Api::NewHandle(thread, UnwindError::New(fatal_message));
|
||||
Dart_Handle compile_error = Dart_NewCompilationError("CompileError");
|
||||
Dart_Handle fatal_error;
|
||||
{
|
||||
TransitionNativeToVM transition(thread);
|
||||
const String& fatal_message = String::Handle(String::New("FatalError"));
|
||||
fatal_error = Api::NewHandle(thread, UnwindError::New(fatal_message));
|
||||
}
|
||||
|
||||
EXPECT_VALID(not_error);
|
||||
EXPECT(Dart_IsError(api_error));
|
||||
|
@ -481,8 +481,7 @@ TEST_CASE(DartAPI_UnhandleExceptionError) {
|
|||
|
||||
// Test with an API Error.
|
||||
const char* kApiError = "Api Error Exception Test.";
|
||||
Dart_Handle api_error = Api::NewHandle(
|
||||
thread, ApiError::New(String::Handle(String::New(kApiError))));
|
||||
Dart_Handle api_error = Dart_NewApiError(kApiError);
|
||||
Dart_Handle exception_error = Dart_NewUnhandledExceptionError(api_error);
|
||||
EXPECT(!Dart_IsApiError(exception_error));
|
||||
EXPECT(Dart_IsUnhandledExceptionError(exception_error));
|
||||
|
@ -493,9 +492,7 @@ TEST_CASE(DartAPI_UnhandleExceptionError) {
|
|||
|
||||
// Test with a Compilation Error.
|
||||
const char* kCompileError = "CompileError Exception Test.";
|
||||
const String& compile_message = String::Handle(String::New(kCompileError));
|
||||
Dart_Handle compile_error =
|
||||
Api::NewHandle(thread, LanguageError::New(compile_message));
|
||||
Dart_Handle compile_error = Dart_NewCompilationError(kCompileError);
|
||||
exception_error = Dart_NewUnhandledExceptionError(compile_error);
|
||||
EXPECT(!Dart_IsApiError(exception_error));
|
||||
EXPECT(Dart_IsUnhandledExceptionError(exception_error));
|
||||
|
@ -505,18 +502,20 @@ TEST_CASE(DartAPI_UnhandleExceptionError) {
|
|||
EXPECT_STREQ(kCompileError, exception_cstr);
|
||||
|
||||
// Test with a Fatal Error.
|
||||
const String& fatal_message =
|
||||
String::Handle(String::New("FatalError Exception Test."));
|
||||
Dart_Handle fatal_error =
|
||||
Api::NewHandle(thread, UnwindError::New(fatal_message));
|
||||
Dart_Handle fatal_error;
|
||||
{
|
||||
TransitionNativeToVM transition(thread);
|
||||
const String& fatal_message =
|
||||
String::Handle(String::New("FatalError Exception Test."));
|
||||
fatal_error = 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(thread, String::New(kRegularString));
|
||||
exception_error = Dart_NewUnhandledExceptionError(obj);
|
||||
exception_error = Dart_NewUnhandledExceptionError(NewString(kRegularString));
|
||||
EXPECT(!Dart_IsApiError(exception_error));
|
||||
EXPECT(Dart_IsUnhandledExceptionError(exception_error));
|
||||
EXPECT(Dart_IsString(Dart_ErrorGetException(exception_error)));
|
||||
|
@ -2688,7 +2687,11 @@ VM_UNIT_TEST_CASE(DartAPI_EnterExitScope) {
|
|||
{
|
||||
EXPECT(thread->api_top_scope() != NULL);
|
||||
HANDLESCOPE(thread);
|
||||
const String& str1 = String::Handle(String::New("Test String"));
|
||||
String& str1 = String::Handle();
|
||||
{
|
||||
TransitionNativeToVM transition(thread);
|
||||
str1 = String::New("Test String");
|
||||
}
|
||||
Dart_Handle ref = Api::NewHandle(thread, str1.raw());
|
||||
String& str2 = String::Handle();
|
||||
str2 ^= Api::UnwrapHandle(ref);
|
||||
|
@ -2714,12 +2717,12 @@ VM_UNIT_TEST_CASE(DartAPI_PersistentHandles) {
|
|||
{
|
||||
CHECK_API_SCOPE(thread);
|
||||
HANDLESCOPE(thread);
|
||||
Dart_Handle ref1 = Api::NewHandle(thread, String::New(kTestString1));
|
||||
Dart_Handle ref1 = Dart_NewStringFromCString(kTestString1);
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
handles[i] = Dart_NewPersistentHandle(ref1);
|
||||
}
|
||||
Dart_EnterScope();
|
||||
Dart_Handle ref2 = Api::NewHandle(thread, String::New(kTestString2));
|
||||
Dart_Handle ref2 = Dart_NewStringFromCString(kTestString2);
|
||||
for (int i = 1000; i < 2000; i++) {
|
||||
handles[i] = Dart_NewPersistentHandle(ref2);
|
||||
}
|
||||
|
@ -2812,14 +2815,14 @@ VM_UNIT_TEST_CASE(DartAPI_AssignToPersistentHandle) {
|
|||
String& str = String::Handle();
|
||||
|
||||
// Start with a known persistent handle.
|
||||
Dart_Handle ref1 = Api::NewHandle(T, String::New(kTestString1));
|
||||
Dart_Handle ref1 = Dart_NewStringFromCString(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(T, String::New(kTestString2));
|
||||
Dart_Handle ref2 = Dart_NewStringFromCString(kTestString2);
|
||||
Dart_SetPersistentHandle(obj, ref2);
|
||||
str ^= PersistentHandle::Cast(obj)->raw();
|
||||
EXPECT(str.Equals(kTestString2));
|
||||
|
@ -2829,6 +2832,18 @@ VM_UNIT_TEST_CASE(DartAPI_AssignToPersistentHandle) {
|
|||
EXPECT(Dart_IsNull(obj));
|
||||
}
|
||||
|
||||
static Dart_Handle AllocateNewString(const char* c_str) {
|
||||
Thread* thread = Thread::Current();
|
||||
TransitionNativeToVM transition(thread);
|
||||
return Api::NewHandle(thread, String::New(c_str, Heap::kNew));
|
||||
}
|
||||
|
||||
static Dart_Handle AllocateOldString(const char* c_str) {
|
||||
Thread* thread = Thread::Current();
|
||||
TransitionNativeToVM transition(thread);
|
||||
return Api::NewHandle(thread, String::New(c_str, Heap::kOld));
|
||||
}
|
||||
|
||||
static Dart_Handle AsHandle(Dart_PersistentHandle weak) {
|
||||
return Dart_HandleFromPersistent(weak);
|
||||
}
|
||||
|
@ -2863,17 +2878,12 @@ TEST_CASE(DartAPI_WeakPersistentHandle) {
|
|||
Dart_EnterScope();
|
||||
|
||||
// Create an object in new space.
|
||||
Dart_Handle new_ref = NewString("new string");
|
||||
Dart_Handle new_ref = AllocateNewString("new string");
|
||||
EXPECT_VALID(new_ref);
|
||||
|
||||
// Create an object in old space.
|
||||
Dart_Handle old_ref;
|
||||
{
|
||||
CHECK_API_SCOPE(thread);
|
||||
HANDLESCOPE(thread);
|
||||
old_ref = Api::NewHandle(thread, String::New("old string", Heap::kOld));
|
||||
EXPECT_VALID(old_ref);
|
||||
}
|
||||
Dart_Handle old_ref = AllocateOldString("old string");
|
||||
EXPECT_VALID(old_ref);
|
||||
|
||||
// Create a weak ref to the new space object.
|
||||
weak_new_ref = Dart_NewWeakPersistentHandle(new_ref, NULL, 0,
|
||||
|
@ -3156,14 +3166,14 @@ TEST_CASE(DartAPI_WeakPersistentHandleExternalAllocationSizeOldspaceGC) {
|
|||
// Check that external allocation in old space can trigger GC.
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Dart_EnterScope();
|
||||
Dart_Handle live = Api::NewHandle(thread, String::New("live", Heap::kOld));
|
||||
Dart_Handle live = AllocateOldString("live");
|
||||
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(thread, String::New("dead", Heap::kOld));
|
||||
Dart_Handle dead = AllocateOldString("dead");
|
||||
EXPECT_VALID(dead);
|
||||
weak = Dart_NewWeakPersistentHandle(dead, NULL, kSmallExternalSize,
|
||||
NopCallback);
|
||||
|
@ -3241,8 +3251,7 @@ TEST_CASE(DartAPI_ImplicitReferencesOldSpace) {
|
|||
CHECK_API_SCOPE(thread);
|
||||
HANDLESCOPE(thread);
|
||||
|
||||
Dart_Handle local =
|
||||
Api::NewHandle(thread, String::New("strongly reachable", Heap::kOld));
|
||||
Dart_Handle local = AllocateOldString("strongly reachable");
|
||||
strong = Dart_NewPersistentHandle(local);
|
||||
strong_weak = Dart_NewWeakPersistentHandle(local, NULL, 0, NopCallback);
|
||||
|
||||
|
@ -3252,21 +3261,21 @@ TEST_CASE(DartAPI_ImplicitReferencesOldSpace) {
|
|||
EXPECT_VALID(AsHandle(strong_weak));
|
||||
EXPECT(Dart_IdentityEquals(AsHandle(strong), AsHandle(strong_weak)))
|
||||
|
||||
weak1 = Dart_NewWeakPersistentHandle(
|
||||
Api::NewHandle(thread, String::New("weakly reachable 1", Heap::kOld)),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
weak1 =
|
||||
Dart_NewWeakPersistentHandle(AllocateOldString("weakly reachable 1"),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
EXPECT(!Dart_IsNull(AsHandle(weak1)));
|
||||
EXPECT_VALID(AsHandle(weak1));
|
||||
|
||||
weak2 = Dart_NewWeakPersistentHandle(
|
||||
Api::NewHandle(thread, String::New("weakly reachable 2", Heap::kOld)),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
weak2 =
|
||||
Dart_NewWeakPersistentHandle(AllocateOldString("weakly reachable 2"),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
EXPECT(!Dart_IsNull(AsHandle(weak2)));
|
||||
EXPECT_VALID(AsHandle(weak2));
|
||||
|
||||
weak3 = Dart_NewWeakPersistentHandle(
|
||||
Api::NewHandle(thread, String::New("weakly reachable 3", Heap::kOld)),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
weak3 =
|
||||
Dart_NewWeakPersistentHandle(AllocateOldString("weakly reachable 3"),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
EXPECT(!Dart_IsNull(AsHandle(weak3)));
|
||||
EXPECT_VALID(AsHandle(weak3));
|
||||
}
|
||||
|
@ -3306,8 +3315,7 @@ TEST_CASE(DartAPI_ImplicitReferencesNewSpace) {
|
|||
CHECK_API_SCOPE(thread);
|
||||
HANDLESCOPE(thread);
|
||||
|
||||
Dart_Handle local =
|
||||
Api::NewHandle(thread, String::New("strongly reachable", Heap::kOld));
|
||||
Dart_Handle local = AllocateOldString("strongly reachable");
|
||||
strong = Dart_NewPersistentHandle(local);
|
||||
strong_weak = Dart_NewWeakPersistentHandle(local, NULL, 0, NopCallback);
|
||||
|
||||
|
@ -3317,21 +3325,21 @@ TEST_CASE(DartAPI_ImplicitReferencesNewSpace) {
|
|||
EXPECT_VALID(AsHandle(strong_weak));
|
||||
EXPECT(Dart_IdentityEquals(AsHandle(strong), AsHandle(strong_weak)))
|
||||
|
||||
weak1 = Dart_NewWeakPersistentHandle(
|
||||
Api::NewHandle(thread, String::New("weakly reachable 1", Heap::kNew)),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
weak1 =
|
||||
Dart_NewWeakPersistentHandle(AllocateNewString("weakly reachable 1"),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
EXPECT(!Dart_IsNull(AsHandle(weak1)));
|
||||
EXPECT_VALID(AsHandle(weak1));
|
||||
|
||||
weak2 = Dart_NewWeakPersistentHandle(
|
||||
Api::NewHandle(thread, String::New("weakly reachable 2", Heap::kNew)),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
weak2 =
|
||||
Dart_NewWeakPersistentHandle(AllocateNewString("weakly reachable 2"),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
EXPECT(!Dart_IsNull(AsHandle(weak2)));
|
||||
EXPECT_VALID(AsHandle(weak2));
|
||||
|
||||
weak3 = Dart_NewWeakPersistentHandle(
|
||||
Api::NewHandle(thread, String::New("weakly reachable 3", Heap::kNew)),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
weak3 =
|
||||
Dart_NewWeakPersistentHandle(AllocateNewString("weakly reachable 3"),
|
||||
NULL, 0, ImplicitReferencesCallback);
|
||||
EXPECT(!Dart_IsNull(AsHandle(weak3)));
|
||||
EXPECT_VALID(AsHandle(weak3));
|
||||
}
|
||||
|
@ -8006,7 +8014,7 @@ TEST_CASE(DartAPI_OnePromotedPeer) {
|
|||
// by one.
|
||||
TEST_CASE(DartAPI_OneOldSpacePeer) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Dart_Handle str = Api::NewHandle(thread, String::New("str", Heap::kOld));
|
||||
Dart_Handle str = AllocateOldString("str");
|
||||
EXPECT_VALID(str);
|
||||
EXPECT(Dart_IsString(str));
|
||||
EXPECT_EQ(0, isolate->heap()->PeerCount());
|
||||
|
@ -8043,7 +8051,7 @@ TEST_CASE(DartAPI_CollectOneOldSpacePeer) {
|
|||
Thread* T = Thread::Current();
|
||||
CHECK_API_SCOPE(T);
|
||||
HANDLESCOPE(T);
|
||||
Dart_Handle str = Api::NewHandle(T, String::New("str", Heap::kOld));
|
||||
Dart_Handle str = AllocateOldString("str");
|
||||
EXPECT_VALID(str);
|
||||
EXPECT(Dart_IsString(str));
|
||||
EXPECT_EQ(0, isolate->heap()->PeerCount());
|
||||
|
@ -8077,7 +8085,7 @@ TEST_CASE(DartAPI_CollectOneOldSpacePeer) {
|
|||
// by two.
|
||||
TEST_CASE(DartAPI_TwoOldSpacePeers) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Dart_Handle s1 = Api::NewHandle(thread, String::New("s1", Heap::kOld));
|
||||
Dart_Handle s1 = AllocateOldString("s1");
|
||||
EXPECT_VALID(s1);
|
||||
EXPECT(Dart_IsString(s1));
|
||||
EXPECT_EQ(0, isolate->heap()->PeerCount());
|
||||
|
@ -8090,7 +8098,7 @@ TEST_CASE(DartAPI_TwoOldSpacePeers) {
|
|||
o1 = &o1;
|
||||
EXPECT_VALID(Dart_GetPeer(s1, &o1));
|
||||
EXPECT(o1 == reinterpret_cast<void*>(&p1));
|
||||
Dart_Handle s2 = Api::NewHandle(thread, String::New("s2", Heap::kOld));
|
||||
Dart_Handle s2 = AllocateOldString("s2");
|
||||
EXPECT_VALID(s2);
|
||||
EXPECT(Dart_IsString(s2));
|
||||
EXPECT_EQ(1, isolate->heap()->PeerCount());
|
||||
|
@ -8125,7 +8133,7 @@ TEST_CASE(DartAPI_CollectTwoOldSpacePeers) {
|
|||
Thread* T = Thread::Current();
|
||||
CHECK_API_SCOPE(T);
|
||||
HANDLESCOPE(T);
|
||||
Dart_Handle s1 = Api::NewHandle(T, String::New("s1", Heap::kOld));
|
||||
Dart_Handle s1 = AllocateOldString("s1");
|
||||
EXPECT_VALID(s1);
|
||||
EXPECT(Dart_IsString(s1));
|
||||
EXPECT_EQ(0, isolate->heap()->PeerCount());
|
||||
|
@ -8138,7 +8146,7 @@ TEST_CASE(DartAPI_CollectTwoOldSpacePeers) {
|
|||
o1 = &o1;
|
||||
EXPECT_VALID(Dart_GetPeer(s1, &o1));
|
||||
EXPECT(o1 == reinterpret_cast<void*>(&p1));
|
||||
Dart_Handle s2 = Api::NewHandle(T, String::New("s2", Heap::kOld));
|
||||
Dart_Handle s2 = AllocateOldString("s2");
|
||||
EXPECT_VALID(s2);
|
||||
EXPECT(Dart_IsString(s2));
|
||||
EXPECT_EQ(1, isolate->heap()->PeerCount());
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace dart {
|
||||
|
||||
TEST_CASE(DartEntry) {
|
||||
ISOLATE_UNIT_TEST_CASE(DartEntry) {
|
||||
const char* kScriptChars =
|
||||
"class A {\n"
|
||||
" static foo() { return 42; }\n"
|
||||
|
@ -42,7 +42,7 @@ TEST_CASE(DartEntry) {
|
|||
EXPECT_EQ(Smi::New(42), retval.raw());
|
||||
}
|
||||
|
||||
TEST_CASE(InvokeStatic_CompileError) {
|
||||
ISOLATE_UNIT_TEST_CASE(InvokeStatic_CompileError) {
|
||||
const char* kScriptChars =
|
||||
"class A {\n"
|
||||
" static foo() { return ++++; }\n"
|
||||
|
@ -66,7 +66,7 @@ TEST_CASE(InvokeStatic_CompileError) {
|
|||
EXPECT_SUBSTRING("++++", Error::Cast(retval).ToErrorCString());
|
||||
}
|
||||
|
||||
TEST_CASE(InvokeDynamic_CompileError) {
|
||||
ISOLATE_UNIT_TEST_CASE(InvokeDynamic_CompileError) {
|
||||
const char* kScriptChars =
|
||||
"class A {\n"
|
||||
" foo() { return ++++; }\n"
|
||||
|
|
|
@ -53,7 +53,7 @@ void Validate(const Table& table) {
|
|||
EXPECT_EQ(0, num_deleted);
|
||||
}
|
||||
|
||||
TEST_CASE(HashTable) {
|
||||
ISOLATE_UNIT_TEST_CASE(HashTable) {
|
||||
typedef HashTable<TestTraits, 2, 1> Table;
|
||||
Table table(Thread::Current()->zone(), HashTables::New<Table>(5));
|
||||
// Ensure that we did get at least 5 entries.
|
||||
|
@ -243,14 +243,14 @@ void TestMap(intptr_t initial_capacity, bool ordered) {
|
|||
actual.Release();
|
||||
}
|
||||
|
||||
TEST_CASE(Sets) {
|
||||
ISOLATE_UNIT_TEST_CASE(Sets) {
|
||||
for (intptr_t initial_capacity = 0; initial_capacity < 32;
|
||||
++initial_capacity) {
|
||||
TestSet<UnorderedHashSet<TestTraits> >(initial_capacity, false);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(Maps) {
|
||||
ISOLATE_UNIT_TEST_CASE(Maps) {
|
||||
for (intptr_t initial_capacity = 0; initial_capacity < 32;
|
||||
++initial_capacity) {
|
||||
TestMap<UnorderedHashMap<TestTraits> >(initial_capacity, false);
|
||||
|
|
|
@ -253,7 +253,7 @@ class FindNothing : public FindObjectVisitor {
|
|||
virtual bool FindObject(RawObject* obj) const { return false; }
|
||||
};
|
||||
|
||||
TEST_CASE(FindObject) {
|
||||
ISOLATE_UNIT_TEST_CASE(FindObject) {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
Heap* heap = isolate->heap();
|
||||
Heap::Space spaces[2] = {Heap::kOld, Heap::kNew};
|
||||
|
@ -272,7 +272,7 @@ TEST_CASE(FindObject) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(IterateReadOnly) {
|
||||
ISOLATE_UNIT_TEST_CASE(IterateReadOnly) {
|
||||
const String& obj = String::Handle(String::New("x", Heap::kOld));
|
||||
Heap* heap = Thread::Current()->isolate()->heap();
|
||||
EXPECT(heap->Contains(RawObject::ToAddr(obj.raw())));
|
||||
|
|
|
@ -15,7 +15,7 @@ static void LongJumpHelper(LongJumpScope* jump) {
|
|||
UNREACHABLE();
|
||||
}
|
||||
|
||||
TEST_CASE(LongJump) {
|
||||
ISOLATE_UNIT_TEST_CASE(LongJump) {
|
||||
LongJumpScope* base = Thread::Current()->long_jump_base();
|
||||
{
|
||||
LongJumpScope jump;
|
||||
|
|
|
@ -94,6 +94,7 @@ bool NativeEntry::ReturnValueIsError(NativeArguments* arguments) {
|
|||
void NativeEntry::PropagateErrors(NativeArguments* arguments) {
|
||||
Thread* thread = arguments->thread();
|
||||
thread->UnwindScopes(thread->top_exit_frame_info());
|
||||
TransitionNativeToVM transition(thread);
|
||||
|
||||
// The thread->zone() is different here than before we unwound.
|
||||
const Object& error =
|
||||
|
|
|
@ -235,6 +235,7 @@ TEST_CASE(Class_ComputeEndTokenPos) {
|
|||
"}\n";
|
||||
Dart_Handle lib_h = TestCase::LoadTestScript(kScript, NULL);
|
||||
EXPECT_VALID(lib_h);
|
||||
TransitionNativeToVM transition(thread);
|
||||
Library& lib = Library::Handle();
|
||||
lib ^= Api::UnwrapHandle(lib_h);
|
||||
EXPECT(!lib.IsNull());
|
||||
|
@ -3841,6 +3842,7 @@ TEST_CASE(Metadata) {
|
|||
EXPECT_VALID(h_lib);
|
||||
Dart_Handle result = Dart_Invoke(h_lib, NewString("main"), 0, NULL);
|
||||
EXPECT_VALID(result);
|
||||
TransitionNativeToVM transition(thread);
|
||||
Library& lib = Library::Handle();
|
||||
lib ^= Api::UnwrapHandle(h_lib);
|
||||
EXPECT(!lib.IsNull());
|
||||
|
@ -4440,13 +4442,14 @@ TEST_CASE(LinkedHashMap) {
|
|||
Dart_Handle h_result = Dart_Invoke(h_lib, NewString("makeMap"), 0, NULL);
|
||||
EXPECT_VALID(h_result);
|
||||
|
||||
TransitionNativeToVM transition(thread);
|
||||
|
||||
// 2. Create an empty internalized LinkedHashMap in C++.
|
||||
Instance& dart_map = Instance::Handle();
|
||||
dart_map ^= Api::UnwrapHandle(h_result);
|
||||
LinkedHashMap& cc_map = LinkedHashMap::Handle(LinkedHashMap::NewDefault());
|
||||
|
||||
// 3. Expect them to have identical structure.
|
||||
TransitionNativeToVM transition(thread);
|
||||
CheckIdenticalHashStructure(thread, dart_map, cc_map);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ static RawArray* Match(const String& pat, const String& str) {
|
|||
zone);
|
||||
}
|
||||
|
||||
TEST_CASE(RegExp_OneByteString) {
|
||||
ISOLATE_UNIT_TEST_CASE(RegExp_OneByteString) {
|
||||
uint8_t chars[] = {'a', 'b', 'c', 'b', 'a'};
|
||||
intptr_t len = ARRAY_SIZE(chars);
|
||||
const String& str =
|
||||
|
@ -43,7 +43,7 @@ TEST_CASE(RegExp_OneByteString) {
|
|||
EXPECT_EQ(3, smi_2.Value());
|
||||
}
|
||||
|
||||
TEST_CASE(RegExp_TwoByteString) {
|
||||
ISOLATE_UNIT_TEST_CASE(RegExp_TwoByteString) {
|
||||
uint16_t chars[] = {'a', 'b', 'c', 'b', 'a'};
|
||||
intptr_t len = ARRAY_SIZE(chars);
|
||||
const String& str =
|
||||
|
@ -68,7 +68,7 @@ static void NoopFinalizer(void* isolate_callback_data,
|
|||
Dart_WeakPersistentHandle handle,
|
||||
void* peer) {}
|
||||
|
||||
TEST_CASE(RegExp_ExternalOneByteString) {
|
||||
ISOLATE_UNIT_TEST_CASE(RegExp_ExternalOneByteString) {
|
||||
uint8_t chars[] = {'a', 'b', 'c', 'b', 'a'};
|
||||
intptr_t len = ARRAY_SIZE(chars);
|
||||
const String& str = String::Handle(ExternalOneByteString::New(
|
||||
|
@ -89,7 +89,7 @@ TEST_CASE(RegExp_ExternalOneByteString) {
|
|||
EXPECT_EQ(3, smi_2.Value());
|
||||
}
|
||||
|
||||
TEST_CASE(RegExp_ExternalTwoByteString) {
|
||||
ISOLATE_UNIT_TEST_CASE(RegExp_ExternalTwoByteString) {
|
||||
uint16_t chars[] = {'a', 'b', 'c', 'b', 'a'};
|
||||
intptr_t len = ARRAY_SIZE(chars);
|
||||
const String& str = String::Handle(ExternalTwoByteString::New(
|
||||
|
|
|
@ -66,7 +66,7 @@ static void SetupInstanceFunction(const char* test_library_name,
|
|||
SetupFunction(test_library_name, test_class_name, test_function_name, false);
|
||||
}
|
||||
|
||||
TEST_CASE(DartStaticResolve) {
|
||||
ISOLATE_UNIT_TEST_CASE(DartStaticResolve) {
|
||||
const char* test_library_name = "ResolverApp";
|
||||
const char* test_class_name = "A";
|
||||
const char* test_static_function_name = "static_foo";
|
||||
|
@ -125,7 +125,7 @@ TEST_CASE(DartStaticResolve) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(DartDynamicResolve) {
|
||||
ISOLATE_UNIT_TEST_CASE(DartDynamicResolve) {
|
||||
const char* test_library_name = "ResolverApp";
|
||||
const char* test_class_name = "A";
|
||||
const char* test_function_name = "foo";
|
||||
|
|
|
@ -178,7 +178,7 @@ TEST_CASE(Service_IsolateStickyError) {
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(Service_IdZones) {
|
||||
ISOLATE_UNIT_TEST_CASE(Service_IdZones) {
|
||||
Zone* zone = thread->zone();
|
||||
Isolate* isolate = thread->isolate();
|
||||
ObjectIdRing* ring = isolate->object_id_ring();
|
||||
|
|
|
@ -132,7 +132,7 @@ static void ExpectEncodeFail(Dart_CObject* root) {
|
|||
EXPECT(message == NULL);
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeNull) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeNull) {
|
||||
StackZone zone(thread);
|
||||
|
||||
// Write snapshot with object content.
|
||||
|
@ -157,7 +157,7 @@ TEST_CASE(SerializeNull) {
|
|||
delete message;
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeSmi1) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeSmi1) {
|
||||
StackZone zone(thread);
|
||||
|
||||
// Write snapshot with object content.
|
||||
|
@ -183,7 +183,7 @@ TEST_CASE(SerializeSmi1) {
|
|||
delete message;
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeSmi2) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeSmi2) {
|
||||
StackZone zone(thread);
|
||||
|
||||
// Write snapshot with object content.
|
||||
|
@ -259,7 +259,7 @@ void CheckMint(int64_t value) {
|
|||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeMints) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeMints) {
|
||||
// Min positive mint.
|
||||
CheckMint(Smi::kMaxValue + 1);
|
||||
// Min positive mint + 1.
|
||||
|
@ -278,7 +278,7 @@ TEST_CASE(SerializeMints) {
|
|||
CheckMint(kMinInt64 + 1);
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeDouble) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeDouble) {
|
||||
StackZone zone(thread);
|
||||
|
||||
// Write snapshot with object content.
|
||||
|
@ -304,7 +304,7 @@ TEST_CASE(SerializeDouble) {
|
|||
delete message;
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeTrue) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeTrue) {
|
||||
StackZone zone(thread);
|
||||
|
||||
// Write snapshot with true object.
|
||||
|
@ -332,7 +332,7 @@ TEST_CASE(SerializeTrue) {
|
|||
delete message;
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeFalse) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeFalse) {
|
||||
StackZone zone(thread);
|
||||
|
||||
// Write snapshot with false object.
|
||||
|
@ -358,7 +358,7 @@ TEST_CASE(SerializeFalse) {
|
|||
delete message;
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeCapability) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeCapability) {
|
||||
// Write snapshot with object content.
|
||||
const Capability& capability = Capability::Handle(Capability::New(12345));
|
||||
MessageWriter writer(true);
|
||||
|
@ -394,7 +394,7 @@ TEST_CASE(SerializeCapability) {
|
|||
delete message; \
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeSingletons) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeSingletons) {
|
||||
TEST_ROUND_TRIP_IDENTICAL(Object::class_class());
|
||||
TEST_ROUND_TRIP_IDENTICAL(Object::type_arguments_class());
|
||||
TEST_ROUND_TRIP_IDENTICAL(Object::function_class());
|
||||
|
@ -435,7 +435,7 @@ static void TestString(const char* cstr) {
|
|||
delete message;
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeString) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeString) {
|
||||
TestString("This string shall be serialized");
|
||||
TestString("æøå"); // This file is UTF-8 encoded.
|
||||
const char* data =
|
||||
|
@ -450,7 +450,7 @@ TEST_CASE(SerializeString) {
|
|||
// TODO(sgjesse): Add tests with non-BMP characters.
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeArray) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeArray) {
|
||||
// Write snapshot with object content.
|
||||
const int kArrayLength = 10;
|
||||
Array& array = Array::Handle(Array::New(kArrayLength));
|
||||
|
@ -485,7 +485,7 @@ TEST_CASE(SerializeArray) {
|
|||
delete message;
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeArrayWithTypeArgument) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeArrayWithTypeArgument) {
|
||||
// Write snapshot with object content.
|
||||
const int kArrayLength = 10;
|
||||
Array& array =
|
||||
|
@ -569,7 +569,7 @@ TEST_CASE(FailSerializeLargeExternalTypedData) {
|
|||
ExpectEncodeFail(&root);
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeEmptyArray) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeEmptyArray) {
|
||||
// Write snapshot with object content.
|
||||
const int kArrayLength = 0;
|
||||
Array& array = Array::Handle(Array::New(kArrayLength));
|
||||
|
@ -595,7 +595,7 @@ TEST_CASE(SerializeEmptyArray) {
|
|||
delete message;
|
||||
}
|
||||
|
||||
TEST_CASE(SerializeByteArray) {
|
||||
ISOLATE_UNIT_TEST_CASE(SerializeByteArray) {
|
||||
// Write snapshot with object content.
|
||||
const int kTypedDataLength = 256;
|
||||
TypedData& typed_data = TypedData::Handle(
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace dart {
|
|||
#ifndef PRODUCT
|
||||
|
||||
static RawObject* ExecuteScript(const char* script) {
|
||||
TransitionVMToNative transition(Thread::Current());
|
||||
Dart_Handle h_lib = TestCase::LoadTestScript(script, NULL);
|
||||
EXPECT_VALID(h_lib);
|
||||
Library& lib = Library::Handle();
|
||||
|
@ -21,7 +22,7 @@ static RawObject* ExecuteScript(const char* script) {
|
|||
return Api::UnwrapHandle(h_lib);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_NoCalls) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_NoCalls) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"main() {\n"
|
||||
|
@ -50,7 +51,7 @@ TEST_CASE(SourceReport_Coverage_NoCalls) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_SimpleCall) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_SimpleCall) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
|
@ -94,7 +95,7 @@ TEST_CASE(SourceReport_Coverage_SimpleCall) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_ForceCompile) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_ForceCompile) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
|
@ -139,7 +140,7 @@ TEST_CASE(SourceReport_Coverage_ForceCompile) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_UnusedClass_NoForceCompile) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_UnusedClass_NoForceCompile) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
|
@ -181,7 +182,7 @@ TEST_CASE(SourceReport_Coverage_UnusedClass_NoForceCompile) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompile) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompile) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
|
@ -224,7 +225,7 @@ TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompile) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompileError) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompileError) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
|
@ -270,7 +271,7 @@ TEST_CASE(SourceReport_Coverage_UnusedClass_ForceCompileError) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_NestedFunctions) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_NestedFunctions) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {\n"
|
||||
|
@ -325,7 +326,7 @@ TEST_CASE(SourceReport_Coverage_NestedFunctions) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_RestrictedRange) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_RestrictedRange) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {\n"
|
||||
|
@ -376,7 +377,7 @@ TEST_CASE(SourceReport_Coverage_RestrictedRange) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_AllFunctions) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_AllFunctions) {
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
"helper1() {}\n"
|
||||
|
@ -415,7 +416,7 @@ TEST_CASE(SourceReport_Coverage_AllFunctions) {
|
|||
EXPECT_SUBSTRING("\"scriptIndex\":2", result);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_Coverage_AllFunctions_ForceCompile) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_Coverage_AllFunctions_ForceCompile) {
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
"helper1() {}\n"
|
||||
|
@ -436,10 +437,7 @@ TEST_CASE(SourceReport_Coverage_AllFunctions_ForceCompile) {
|
|||
|
||||
// We generate a report with all functions in the VM.
|
||||
Script& null_script = Script::Handle();
|
||||
{
|
||||
TransitionNativeToVM transition(Thread::Current());
|
||||
report.PrintJSON(&js, null_script);
|
||||
}
|
||||
report.PrintJSON(&js, null_script);
|
||||
const char* result = js.ToCString();
|
||||
|
||||
// Sanity check the header.
|
||||
|
@ -457,7 +455,7 @@ TEST_CASE(SourceReport_Coverage_AllFunctions_ForceCompile) {
|
|||
EXPECT_SUBSTRING("\"scriptIndex\":2", result);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_CallSites_SimpleCall) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_CallSites_SimpleCall) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
|
@ -503,7 +501,7 @@ TEST_CASE(SourceReport_CallSites_SimpleCall) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_CallSites_PolymorphicCall) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_CallSites_PolymorphicCall) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"class Common {\n"
|
||||
|
@ -577,7 +575,7 @@ TEST_CASE(SourceReport_CallSites_PolymorphicCall) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_MultipleReports) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_MultipleReports) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
|
@ -625,7 +623,7 @@ TEST_CASE(SourceReport_MultipleReports) {
|
|||
buffer);
|
||||
}
|
||||
|
||||
TEST_CASE(SourceReport_PossibleBreakpoints_Simple) {
|
||||
ISOLATE_UNIT_TEST_CASE(SourceReport_PossibleBreakpoints_Simple) {
|
||||
char buffer[1024];
|
||||
const char* kScript =
|
||||
"helper0() {}\n"
|
||||
|
|
|
@ -85,6 +85,8 @@ void FUNCTION_NAME(StackFrame_validateFrame)(Dart_NativeArguments args) {
|
|||
|
||||
Dart_Handle index = Dart_GetNativeArgument(args, 0);
|
||||
Dart_Handle name = Dart_GetNativeArgument(args, 1);
|
||||
|
||||
TransitionNativeToVM transition(thread);
|
||||
const Smi& frame_index_smi = Smi::CheckedHandle(Api::UnwrapHandle(index));
|
||||
const char* expected_name =
|
||||
String::CheckedHandle(Api::UnwrapHandle(name)).ToCString();
|
||||
|
|
|
@ -632,6 +632,7 @@ Dart_Handle TestCase::TriggerReload() {
|
|||
if (Dart_IsError(result)) {
|
||||
// Keep load error.
|
||||
} else if (isolate->reload_context()->reload_aborted()) {
|
||||
TransitionNativeToVM transition(thread);
|
||||
result = Api::NewHandle(thread, isolate->reload_context()->error());
|
||||
} else {
|
||||
result = Dart_RootLibrary();
|
||||
|
|
Loading…
Reference in a new issue