| Index: runtime/vm/debugger_api_impl.cc
|
| diff --git a/runtime/vm/debugger_api_impl.cc b/runtime/vm/debugger_api_impl.cc
|
| index 84c245ab29de94bf556a34ca811eb80e82f01b74..9fd26d88030e6cfb14ca3210fcacc358d39ab61c 100644
|
| --- a/runtime/vm/debugger_api_impl.cc
|
| +++ b/runtime/vm/debugger_api_impl.cc
|
| @@ -15,6 +15,10 @@
|
|
|
| namespace dart {
|
|
|
| +// Facilitate quick access to the current zone once we have the curren thread.
|
| +#define Z (T->zone())
|
| +
|
| +
|
| #define UNWRAP_AND_CHECK_PARAM(type, var, param) \
|
| type& var = type::Handle(); \
|
| do { \
|
| @@ -51,32 +55,29 @@ namespace dart {
|
|
|
|
|
| DART_EXPORT intptr_t Dart_CacheObject(Dart_Handle object_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - const Object& obj = Object::Handle(Api::UnwrapHandle(object_in));
|
| + DARTSCOPE(Thread::Current());
|
| + const Object& obj = Object::Handle(Z, Api::UnwrapHandle(object_in));
|
| if (obj.IsApiError()) {
|
| return -1;
|
| }
|
| - return isolate->debugger()->CacheObject(obj);
|
| + return I->debugger()->CacheObject(obj);
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetCachedObject(intptr_t obj_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - if (!isolate->debugger()->IsValidObjectId(obj_id)) {
|
| + DARTSCOPE(Thread::Current());
|
| + if (!I->debugger()->IsValidObjectId(obj_id)) {
|
| return Api::NewError("%s: object id %" Pd " is invalid",
|
| CURRENT_FUNC, obj_id);
|
| }
|
| - return Api::NewHandle(isolate, isolate->debugger()->GetCachedObject(obj_id));
|
| + return Api::NewHandle(I, I->debugger()->GetCachedObject(obj_id));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_StackTraceLength(
|
| Dart_StackTrace trace,
|
| intptr_t* length) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_NOT_NULL(length);
|
| CHECK_AND_CAST(DebuggerStackTrace, stack_trace, trace);
|
| *length = stack_trace->Length();
|
| @@ -88,8 +89,7 @@ DART_EXPORT Dart_Handle Dart_GetActivationFrame(
|
| Dart_StackTrace trace,
|
| int frame_index,
|
| Dart_ActivationFrame* frame) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_NOT_NULL(frame);
|
| CHECK_AND_CAST(DebuggerStackTrace, stack_trace, trace);
|
| if ((frame_index < 0) || (frame_index >= stack_trace->Length())) {
|
| @@ -196,45 +196,41 @@ DART_EXPORT void Dart_SetIsolateEventHandler(Dart_IsolateEventHandler handler) {
|
|
|
| DART_EXPORT Dart_Handle Dart_SetExceptionPauseInfo(
|
| Dart_ExceptionPauseInfo pause_info) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - isolate->debugger()->SetExceptionPauseInfo(pause_info);
|
| + DARTSCOPE(Thread::Current());
|
| + I->debugger()->SetExceptionPauseInfo(pause_info);
|
| return Api::Success();
|
| }
|
|
|
|
|
| DART_EXPORT Dart_ExceptionPauseInfo Dart_GetExceptionPauseInfo() {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - return isolate->debugger()->GetExceptionPauseInfo();
|
| + DARTSCOPE(Thread::Current());
|
| + return I->debugger()->GetExceptionPauseInfo();
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetStackTrace(Dart_StackTrace* trace) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_NOT_NULL(trace);
|
| *trace = reinterpret_cast<Dart_StackTrace>(
|
| - isolate->debugger()->CurrentStackTrace());
|
| + I->debugger()->CurrentStackTrace());
|
| return Api::Success();
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetStackTraceFromError(Dart_Handle handle,
|
| Dart_StackTrace* trace) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_NOT_NULL(trace);
|
| - const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle));
|
| + const Object& obj = Object::Handle(Z, Api::UnwrapHandle(handle));
|
| if (obj.IsUnhandledException()) {
|
| const UnhandledException& error = UnhandledException::Cast(obj);
|
| - Stacktrace& dart_stacktrace = Stacktrace::Handle(isolate);
|
| + Stacktrace& dart_stacktrace = Stacktrace::Handle(Z);
|
| dart_stacktrace ^= error.stacktrace();
|
| if (dart_stacktrace.IsNull()) {
|
| *trace = NULL;
|
| } else {
|
| *trace = reinterpret_cast<Dart_StackTrace>(
|
| - isolate->debugger()->StackTraceFrom(dart_stacktrace));
|
| + I->debugger()->StackTraceFrom(dart_stacktrace));
|
| }
|
| return Api::Success();
|
| } else {
|
| @@ -250,14 +246,13 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameInfo(
|
| Dart_Handle* script_url,
|
| intptr_t* line_number,
|
| intptr_t* column_number) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_AND_CAST(ActivationFrame, frame, activation_frame);
|
| if (function_name != NULL) {
|
| - *function_name = Api::NewHandle(isolate, frame->QualifiedFunctionName());
|
| + *function_name = Api::NewHandle(I, frame->QualifiedFunctionName());
|
| }
|
| if (script_url != NULL) {
|
| - *script_url = Api::NewHandle(isolate, frame->SourceUrl());
|
| + *script_url = Api::NewHandle(I, frame->SourceUrl());
|
| }
|
| if (line_number != NULL) {
|
| *line_number = frame->LineNumber();
|
| @@ -276,19 +271,18 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameGetLocation(
|
| Dart_CodeLocation* location) {
|
| // TODO(hausner): Implement a way to recognize when there
|
| // is no source code for the code in the frame.
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_AND_CAST(ActivationFrame, frame, activation_frame);
|
| if (function_name != NULL) {
|
| - *function_name = Api::NewHandle(isolate, frame->QualifiedFunctionName());
|
| + *function_name = Api::NewHandle(I, frame->QualifiedFunctionName());
|
| }
|
| if (function != NULL) {
|
| - *function = Api::NewHandle(isolate, frame->function().raw());
|
| + *function = Api::NewHandle(I, frame->function().raw());
|
| }
|
|
|
| if (location != NULL) {
|
| - location->script_url = Api::NewHandle(isolate, frame->SourceUrl());
|
| - const Library& lib = Library::Handle(frame->Library());
|
| + location->script_url = Api::NewHandle(I, frame->SourceUrl());
|
| + const Library& lib = Library::Handle(Z, frame->Library());
|
| location->library_id = lib.index();
|
| location->token_pos = frame->TokenPos();
|
| }
|
| @@ -298,8 +292,7 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameGetLocation(
|
| DART_EXPORT Dart_Handle Dart_ActivationFrameGetFramePointer(
|
| Dart_ActivationFrame activation_frame,
|
| uintptr_t* frame_pointer) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_AND_CAST(ActivationFrame, frame, activation_frame);
|
|
|
| if (frame_pointer != NULL) {
|
| @@ -310,11 +303,10 @@ DART_EXPORT Dart_Handle Dart_ActivationFrameGetFramePointer(
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(Function, function, function_in);
|
|
|
| - const Class& cls = Class::Handle(function.origin());
|
| + const Class& cls = Class::Handle(Z, function.origin());
|
| if (!cls.IsTopLevel()) {
|
| return Dart_NewInteger(cls.id());
|
| }
|
| @@ -324,21 +316,19 @@ DART_EXPORT Dart_Handle Dart_GetFunctionOrigin(Dart_Handle function_in) {
|
|
|
| DART_EXPORT Dart_Handle Dart_GetLocalVariables(
|
| Dart_ActivationFrame activation_frame) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_AND_CAST(ActivationFrame, frame, activation_frame);
|
| - return Api::NewHandle(isolate, frame->GetLocalVariables());
|
| + return Api::NewHandle(I, frame->GetLocalVariables());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_SetBreakpoint(
|
| Dart_Handle script_url_in,
|
| intptr_t line_number) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
|
|
|
| - Debugger* debugger = isolate->debugger();
|
| + Debugger* debugger = I->debugger();
|
| Breakpoint* bpt =
|
| debugger->SetBreakpointAtLine(script_url, line_number);
|
| if (bpt == NULL) {
|
| @@ -350,23 +340,21 @@ DART_EXPORT Dart_Handle Dart_SetBreakpoint(
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetBreakpointURL(intptr_t bp_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - Debugger* debugger = isolate->debugger();
|
| + DARTSCOPE(Thread::Current());
|
| + Debugger* debugger = I->debugger();
|
|
|
| Breakpoint* bpt = debugger->GetBreakpointById(bp_id);
|
| if (bpt == NULL) {
|
| return Api::NewError("%s: breakpoint with id %" Pd " does not exist",
|
| CURRENT_FUNC, bp_id);
|
| }
|
| - return Api::NewHandle(isolate, bpt->bpt_location()->url());
|
| + return Api::NewHandle(I, bpt->bpt_location()->url());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetBreakpointLine(intptr_t bp_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - Debugger* debugger = isolate->debugger();
|
| + DARTSCOPE(Thread::Current());
|
| + Debugger* debugger = I->debugger();
|
|
|
| Breakpoint* bpt = debugger->GetBreakpointById(bp_id);
|
| if (bpt == NULL) {
|
| @@ -381,8 +369,7 @@ DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
|
| Dart_Handle library_in,
|
| Dart_Handle class_name_in,
|
| Dart_Handle function_name_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(Library, library, library_in);
|
| UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in);
|
| UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in);
|
| @@ -395,7 +382,7 @@ DART_EXPORT Dart_Handle Dart_SetBreakpointAtEntry(
|
| }
|
|
|
| // Resolve the breakpoint target function.
|
| - Debugger* debugger = isolate->debugger();
|
| + Debugger* debugger = I->debugger();
|
| const Function& bp_target = Function::Handle(
|
| debugger->ResolveFunction(library, class_name, function_name));
|
| if (bp_target.IsNull()) {
|
| @@ -421,8 +408,7 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
|
| Dart_Handle library_in,
|
| Dart_Handle class_name_in,
|
| Dart_Handle function_name_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(Library, library, library_in);
|
| UNWRAP_AND_CHECK_PARAM(String, class_name, class_name_in);
|
| UNWRAP_AND_CHECK_PARAM(String, function_name, function_name_in);
|
| @@ -435,7 +421,7 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
|
| }
|
|
|
| // Resolve the breakpoint target function.
|
| - Debugger* debugger = isolate->debugger();
|
| + Debugger* debugger = I->debugger();
|
| const Function& bp_target = Function::Handle(
|
| debugger->ResolveFunction(library, class_name, function_name));
|
| if (bp_target.IsNull()) {
|
| @@ -447,111 +433,101 @@ DART_EXPORT Dart_Handle Dart_OneTimeBreakAtEntry(
|
| function_name.ToCString());
|
| }
|
|
|
| - const Error& error =
|
| - Error::Handle(isolate, debugger->OneTimeBreakAtEntry(bp_target));
|
| + const Error& error = Error::Handle(Z,
|
| + debugger->OneTimeBreakAtEntry(bp_target));
|
| if (!error.IsNull()) {
|
| - return Api::NewHandle(isolate, error.raw());
|
| + return Api::NewHandle(I, error.raw());
|
| }
|
| return Api::Success();
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_RemoveBreakpoint(intptr_t bp_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - isolate->debugger()->RemoveBreakpoint(bp_id);
|
| + DARTSCOPE(Thread::Current());
|
| + I->debugger()->RemoveBreakpoint(bp_id);
|
| return Api::Success();
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_SetStepOver() {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - isolate->debugger()->SetStepOver();
|
| + DARTSCOPE(Thread::Current());
|
| + I->debugger()->SetStepOver();
|
| return Api::Success();
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_SetStepInto() {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - isolate->debugger()->SetSingleStep();
|
| + DARTSCOPE(Thread::Current());
|
| + I->debugger()->SetSingleStep();
|
| return Api::Success();
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_SetStepOut() {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - isolate->debugger()->SetStepOut();
|
| + DARTSCOPE(Thread::Current());
|
| + I->debugger()->SetStepOut();
|
| return Api::Success();
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetInstanceFields(Dart_Handle object_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in);
|
| - return Api::NewHandle(isolate, isolate->debugger()->GetInstanceFields(obj));
|
| + return Api::NewHandle(I, I->debugger()->GetInstanceFields(obj));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetStaticFields(Dart_Handle target) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - const Type& type_obj = Api::UnwrapTypeHandle(isolate, target);
|
| + DARTSCOPE(Thread::Current());
|
| + const Type& type_obj = Api::UnwrapTypeHandle(I, target);
|
| if (type_obj.IsNull()) {
|
| return Api::NewError("%s expects argument 'target' to be a type",
|
| CURRENT_FUNC);
|
| }
|
| - const Class& cls = Class::Handle(isolate, type_obj.type_class());
|
| - return Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls));
|
| + const Class& cls = Class::Handle(Z, type_obj.type_class());
|
| + return Api::NewHandle(I, I->debugger()->GetStaticFields(cls));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetLibraryFields(intptr_t library_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| const Library& lib =
|
| - Library::Handle(isolate, Library::GetLibrary(library_id));
|
| + Library::Handle(Z, Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| return Api::NewError("%s: %" Pd " is not a valid library id",
|
| CURRENT_FUNC, library_id);
|
| }
|
| - return Api::NewHandle(isolate, isolate->debugger()->GetLibraryFields(lib));
|
| + return Api::NewHandle(I, I->debugger()->GetLibraryFields(lib));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetGlobalVariables(intptr_t library_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - ASSERT(isolate != NULL);
|
| - DARTSCOPE(isolate);
|
| - const Library& lib = Library::Handle(Library::GetLibrary(library_id));
|
| + DARTSCOPE(Thread::Current());
|
| +
|
| + const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| return Api::NewError("%s: %" Pd " is not a valid library id",
|
| CURRENT_FUNC, library_id);
|
| }
|
| - return Api::NewHandle(isolate, isolate->debugger()->GetGlobalFields(lib));
|
| + return Api::NewHandle(I, I->debugger()->GetGlobalFields(lib));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_ActivationFrameEvaluate(
|
| Dart_ActivationFrame activation_frame,
|
| Dart_Handle expr_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_AND_CAST(ActivationFrame, frame, activation_frame);
|
| UNWRAP_AND_CHECK_PARAM(String, expr, expr_in);
|
| - return Api::NewHandle(isolate, frame->Evaluate(expr));
|
| + return Api::NewHandle(I, frame->Evaluate(expr));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in,
|
| Dart_Handle expr_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
|
|
| - const Object& target = Object::Handle(isolate, Api::UnwrapHandle(target_in));
|
| + const Object& target = Object::Handle(Z, Api::UnwrapHandle(target_in));
|
| if (target.IsError()) return target_in;
|
| if (target.IsNull()) {
|
| return Api::NewError("%s expects argument 'target' to be non-null",
|
| @@ -560,42 +536,40 @@ DART_EXPORT Dart_Handle Dart_EvaluateExpr(Dart_Handle target_in,
|
| UNWRAP_AND_CHECK_PARAM(String, expr, expr_in);
|
| // Type extends Instance, must check first.
|
| if (target.IsType()) {
|
| - const Class& cls = Class::Handle(isolate, Type::Cast(target).type_class());
|
| - return Api::NewHandle(isolate, cls.Evaluate(expr,
|
| - Array::empty_array(),
|
| - Array::empty_array()));
|
| + const Class& cls = Class::Handle(Z, Type::Cast(target).type_class());
|
| + return Api::NewHandle(I, cls.Evaluate(expr,
|
| + Array::empty_array(),
|
| + Array::empty_array()));
|
| } else if (target.IsInstance()) {
|
| const Instance& inst = Instance::Cast(target);
|
| - return Api::NewHandle(isolate, inst.Evaluate(expr,
|
| - Array::empty_array(),
|
| - Array::empty_array()));
|
| + return Api::NewHandle(I, inst.Evaluate(expr,
|
| + Array::empty_array(),
|
| + Array::empty_array()));
|
| } else if (target.IsLibrary()) {
|
| const Library& lib = Library::Cast(target);
|
| - return Api::NewHandle(isolate, lib.Evaluate(expr,
|
| - Array::empty_array(),
|
| - Array::empty_array()));
|
| + return Api::NewHandle(I, lib.Evaluate(expr,
|
| + Array::empty_array(),
|
| + Array::empty_array()));
|
| } else if (target.IsClass()) {
|
| const Class& cls = Class::Cast(target);
|
| - return Api::NewHandle(isolate, cls.Evaluate(expr,
|
| - Array::empty_array(),
|
| - Array::empty_array()));
|
| + return Api::NewHandle(I, cls.Evaluate(expr,
|
| + Array::empty_array(),
|
| + Array::empty_array()));
|
| }
|
| return Api::NewError("%s: unsupported target type", CURRENT_FUNC);
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetObjClass(Dart_Handle object_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in);
|
| - return Api::NewHandle(isolate, obj.GetType());
|
| + return Api::NewHandle(I, obj.GetType());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in,
|
| intptr_t* class_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(Instance, obj, object_in);
|
| CHECK_NOT_NULL(class_id);
|
| *class_id = obj.GetClassId();
|
| @@ -604,19 +578,17 @@ DART_EXPORT Dart_Handle Dart_GetObjClassId(Dart_Handle object_in,
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetClassFromId(intptr_t class_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - if (!isolate->class_table()->IsValidIndex(class_id)) {
|
| + DARTSCOPE(Thread::Current());
|
| + if (!I->class_table()->IsValidIndex(class_id)) {
|
| return Api::NewError("%s: %" Pd " is not a valid class id",
|
| CURRENT_FUNC, class_id);
|
| }
|
| - return Api::NewHandle(isolate, isolate->class_table()->At(class_id));
|
| + return Api::NewHandle(I, I->class_table()->At(class_id));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
|
|
| UNWRAP_AND_CHECK_PARAM(Type, type, type_in);
|
| if (!type.IsFinalized()) {
|
| @@ -635,7 +607,7 @@ DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type_in) {
|
| if (type.IsNull()) {
|
| return Dart_Null();
|
| }
|
| - return Api::NewHandle(isolate, type.Canonicalize());
|
| + return Api::NewHandle(I, type.Canonicalize());
|
| }
|
| // Set up the type arguments array for the super class type.
|
| const Class& super_cls = Class::Handle(cls.SuperClass());
|
| @@ -657,7 +629,7 @@ DART_EXPORT Dart_Handle Dart_GetSupertype(Dart_Handle type_in) {
|
| Type::New(super_cls, super_type_args_array, Scanner::kNoSourcePos));
|
| ASSERT(!instantiated_type.IsNull());
|
| instantiated_type.SetIsFinalized();
|
| - return Api::NewHandle(isolate, instantiated_type.Canonicalize());
|
| + return Api::NewHandle(I, instantiated_type.Canonicalize());
|
| }
|
|
|
|
|
| @@ -666,8 +638,7 @@ DART_EXPORT Dart_Handle Dart_GetClosureInfo(
|
| Dart_Handle* name,
|
| Dart_Handle* signature,
|
| Dart_CodeLocation* location) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(Instance, instance, closure);
|
| CHECK_NOT_NULL(location);
|
|
|
| @@ -677,26 +648,26 @@ DART_EXPORT Dart_Handle Dart_GetClosureInfo(
|
| const Function& func = Function::Handle(Closure::function(instance));
|
| ASSERT(!func.IsNull());
|
| if (name != NULL) {
|
| - *name = Api::NewHandle(isolate, func.QualifiedUserVisibleName());
|
| + *name = Api::NewHandle(I, func.QualifiedUserVisibleName());
|
| }
|
| if (signature != NULL) {
|
| - *signature = Api::NewHandle(isolate, func.UserVisibleSignature());
|
| + *signature = Api::NewHandle(I, func.UserVisibleSignature());
|
| }
|
|
|
| if (location != NULL) {
|
| if (func.token_pos() >= 0) {
|
| - const Class& cls = Class::Handle(func.origin());
|
| + const Class& cls = Class::Handle(Z, func.origin());
|
| ASSERT(!cls.IsNull());
|
| - const Library& lib = Library::Handle(isolate, cls.library());
|
| + const Library& lib = Library::Handle(Z, cls.library());
|
| ASSERT(!lib.IsNull());
|
| // Note func.script() is not the same as cls.script() for eval functions.
|
| - const Script& script = Script::Handle(func.script());
|
| + const Script& script = Script::Handle(Z, func.script());
|
| ASSERT(!script.IsNull());
|
| - location->script_url = Api::NewHandle(isolate, script.url());
|
| + location->script_url = Api::NewHandle(I, script.url());
|
| location->library_id = lib.index();
|
| location->token_pos = func.token_pos();
|
| } else {
|
| - location->script_url = Api::NewHandle(isolate, String::null());
|
| + location->script_url = Api::NewHandle(I, String::null());
|
| location->library_id = -1;
|
| location->token_pos = -1;
|
| }
|
| @@ -711,30 +682,29 @@ DART_EXPORT Dart_Handle Dart_GetClassInfo(
|
| intptr_t* library_id,
|
| intptr_t* super_class_id,
|
| Dart_Handle* static_fields) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - if (!isolate->class_table()->IsValidIndex(cls_id)) {
|
| + DARTSCOPE(Thread::Current());
|
| + if (!I->class_table()->IsValidIndex(cls_id)) {
|
| return Api::NewError("%s: %" Pd " is not a valid class id",
|
| CURRENT_FUNC, cls_id);
|
| }
|
| - Class& cls = Class::Handle(isolate, isolate->class_table()->At(cls_id));
|
| + Class& cls = Class::Handle(Z, I->class_table()->At(cls_id));
|
| if (class_name != NULL) {
|
| - *class_name = Api::NewHandle(isolate, cls.Name());
|
| + *class_name = Api::NewHandle(I, cls.Name());
|
| }
|
| if (library_id != NULL) {
|
| - const Library& lib = Library::Handle(isolate, cls.library());
|
| + const Library& lib = Library::Handle(Z, cls.library());
|
| *library_id = lib.index();
|
| }
|
| if (super_class_id != NULL) {
|
| *super_class_id = 0;
|
| - Class& super_cls = Class::Handle(isolate, cls.SuperClass());
|
| + Class& super_cls = Class::Handle(Z, cls.SuperClass());
|
| if (!super_cls.IsNull()) {
|
| *super_class_id = super_cls.id();
|
| }
|
| }
|
| if (static_fields != NULL) {
|
| *static_fields =
|
| - Api::NewHandle(isolate, isolate->debugger()->GetStaticFields(cls));
|
| + Api::NewHandle(I, I->debugger()->GetStaticFields(cls));
|
| }
|
| return Api::Success();
|
| }
|
| @@ -743,8 +713,7 @@ DART_EXPORT Dart_Handle Dart_GetClassInfo(
|
| DART_EXPORT Dart_Handle Dart_ScriptGetSource(
|
| intptr_t library_id,
|
| Dart_Handle script_url_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| const Library& lib = Library::Handle(Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| return Api::NewError("%s: %" Pd " is not a valid library id",
|
| @@ -757,15 +726,14 @@ DART_EXPORT Dart_Handle Dart_ScriptGetSource(
|
| CURRENT_FUNC, script_url.ToCString(),
|
| String::Handle(lib.url()).ToCString());
|
| }
|
| - return Api::NewHandle(isolate, script.Source());
|
| + return Api::NewHandle(I, script.Source());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(
|
| intptr_t library_id,
|
| Dart_Handle script_url_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| const Library& lib = Library::Handle(Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| return Api::NewError("%s: %" Pd " is not a valid library id",
|
| @@ -781,14 +749,13 @@ DART_EXPORT Dart_Handle Dart_ScriptGetTokenInfo(
|
|
|
| const GrowableObjectArray& info =
|
| GrowableObjectArray::Handle(script.GenerateLineNumberArray());
|
| - return Api::NewHandle(isolate, Array::MakeArray(info));
|
| + return Api::NewHandle(I, Array::MakeArray(info));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in,
|
| Dart_Handle script_url_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in);
|
| UNWRAP_AND_CHECK_PARAM(String, script_url, script_url_in);
|
|
|
| @@ -805,13 +772,12 @@ DART_EXPORT Dart_Handle Dart_GenerateScriptSource(Dart_Handle library_url_in,
|
| library_url.ToCString());
|
| }
|
|
|
| - return Api::NewHandle(isolate, script.GenerateSource());
|
| + return Api::NewHandle(I, script.GenerateSource());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| UNWRAP_AND_CHECK_PARAM(String, library_url, library_url_in);
|
|
|
| const Library& library = Library::Handle(Library::LookupLibrary(library_url));
|
| @@ -830,52 +796,47 @@ DART_EXPORT Dart_Handle Dart_GetScriptURLs(Dart_Handle library_url_in) {
|
| url = script.url();
|
| script_list.SetAt(i, url);
|
| }
|
| - return Api::NewHandle(isolate, script_list.raw());
|
| + return Api::NewHandle(I, script_list.raw());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetLibraryIds() {
|
| - Isolate* isolate = Isolate::Current();
|
| - ASSERT(isolate != NULL);
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
|
|
| const GrowableObjectArray& libs =
|
| - GrowableObjectArray::Handle(isolate->object_store()->libraries());
|
| + GrowableObjectArray::Handle(Z, I->object_store()->libraries());
|
| int num_libs = libs.Length();
|
|
|
| // Create new list and populate with the url of loaded libraries.
|
| Library &lib = Library::Handle();
|
| - const Array& library_id_list = Array::Handle(Array::New(num_libs));
|
| + const Array& library_id_list = Array::Handle(Z, Array::New(num_libs));
|
| for (int i = 0; i < num_libs; i++) {
|
| lib ^= libs.At(i);
|
| ASSERT(!lib.IsNull());
|
| ASSERT(Smi::IsValid(lib.index()));
|
| library_id_list.SetAt(i, Smi::Handle(Smi::New(lib.index())));
|
| }
|
| - return Api::NewHandle(isolate, library_id_list.raw());
|
| + return Api::NewHandle(I, library_id_list.raw());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetLibraryFromId(intptr_t library_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - ASSERT(isolate != NULL);
|
| - DARTSCOPE(isolate);
|
| - const Library& lib = Library::Handle(Library::GetLibrary(library_id));
|
| + DARTSCOPE(Thread::Current());
|
| + const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| return Api::NewError("%s: %" Pd " is not a valid library id",
|
| CURRENT_FUNC, library_id);
|
| }
|
| - return Api::NewHandle(isolate, lib.raw());
|
| + return Api::NewHandle(I, lib.raw());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library,
|
| intptr_t* library_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - DARTSCOPE(isolate);
|
| - const Library& lib = Api::UnwrapLibraryHandle(isolate, library);
|
| + DARTSCOPE(Thread::Current());
|
| + const Library& lib = Api::UnwrapLibraryHandle(I, library);
|
| if (lib.IsNull()) {
|
| - RETURN_TYPE_ERROR(isolate, library, Library);
|
| + RETURN_TYPE_ERROR(I, library, Library);
|
| }
|
| if (library_id == NULL) {
|
| RETURN_NULL_ERROR(library_id);
|
| @@ -886,9 +847,7 @@ DART_EXPORT Dart_Handle Dart_LibraryId(Dart_Handle library,
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - ASSERT(isolate != NULL);
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| const Library& lib = Library::Handle(Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| return Api::NewError("%s: %" Pd " is not a valid library id",
|
| @@ -897,18 +856,18 @@ DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) {
|
| const GrowableObjectArray& import_list =
|
| GrowableObjectArray::Handle(GrowableObjectArray::New(8));
|
|
|
| - String& prefix_name = String::Handle(isolate);
|
| - Library& imported = Library::Handle(isolate);
|
| + String& prefix_name = String::Handle(Z);
|
| + Library& imported = Library::Handle(Z);
|
| intptr_t num_imports = lib.num_imports();
|
| for (int i = 0; i < num_imports; i++) {
|
| import_list.Add(prefix_name); // Null prefix name means no prefix.
|
| imported = lib.ImportLibraryAt(i);
|
| ASSERT(!imported.IsNull());
|
| ASSERT(Smi::IsValid(imported.index()));
|
| - import_list.Add(Smi::Handle(Smi::New(imported.index())));
|
| + import_list.Add(Smi::Handle(Z, Smi::New(imported.index())));
|
| }
|
| LibraryPrefixIterator it(lib);
|
| - LibraryPrefix& prefix = LibraryPrefix::Handle(isolate);
|
| + LibraryPrefix& prefix = LibraryPrefix::Handle(Z);
|
| while (it.HasNext()) {
|
| prefix = it.GetNext();
|
| prefix_name = prefix.name();
|
| @@ -920,28 +879,24 @@ DART_EXPORT Dart_Handle Dart_GetLibraryImports(intptr_t library_id) {
|
| import_list.Add(Smi::Handle(Smi::New(imported.index())));
|
| }
|
| }
|
| - return Api::NewHandle(isolate, Array::MakeArray(import_list));
|
| + return Api::NewHandle(I, Array::MakeArray(import_list));
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetLibraryURL(intptr_t library_id) {
|
| - Isolate* isolate = Isolate::Current();
|
| - ASSERT(isolate != NULL);
|
| - DARTSCOPE(isolate);
|
| - const Library& lib = Library::Handle(Library::GetLibrary(library_id));
|
| + DARTSCOPE(Thread::Current());
|
| + const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| return Api::NewError("%s: %" Pd " is not a valid library id",
|
| CURRENT_FUNC, library_id);
|
| }
|
| - return Api::NewHandle(isolate, lib.url());
|
| + return Api::NewHandle(I, lib.url());
|
| }
|
|
|
|
|
| DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id,
|
| bool* is_debuggable) {
|
| - Isolate* isolate = Isolate::Current();
|
| - ASSERT(isolate != NULL);
|
| - DARTSCOPE(isolate);
|
| + DARTSCOPE(Thread::Current());
|
| CHECK_NOT_NULL(is_debuggable);
|
| const Library& lib = Library::Handle(Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| @@ -955,10 +910,8 @@ DART_EXPORT Dart_Handle Dart_GetLibraryDebuggable(intptr_t library_id,
|
|
|
| DART_EXPORT Dart_Handle Dart_SetLibraryDebuggable(intptr_t library_id,
|
| bool is_debuggable) {
|
| - Isolate* isolate = Isolate::Current();
|
| - ASSERT(isolate != NULL);
|
| - DARTSCOPE(isolate);
|
| - const Library& lib = Library::Handle(Library::GetLibrary(library_id));
|
| + DARTSCOPE(Thread::Current());
|
| + const Library& lib = Library::Handle(Z, Library::GetLibrary(library_id));
|
| if (lib.IsNull()) {
|
| return Api::NewError("%s: %" Pd " is not a valid library id",
|
| CURRENT_FUNC, library_id);
|
|
|