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

Unified Diff: runtime/vm/debugger.cc

Issue 1393373003: Remove isolate argument from handle allocation: Part I (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanups Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/exceptions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/debugger.cc
diff --git a/runtime/vm/debugger.cc b/runtime/vm/debugger.cc
index 231ea4c61ae4714eaf36c36fa9e9a2d0e5ed3048..a92b4d5238092d1420dee86ed77dd614202bbf3d 100644
--- a/runtime/vm/debugger.cc
+++ b/runtime/vm/debugger.cc
@@ -310,8 +310,8 @@ void Debugger::InvokeEventHandler(DebuggerEvent* event) {
if (ServiceNeedsDebuggerEvent(event->type()) && event->IsPauseEvent()) {
// If we were paused, notify the service that we have resumed.
- const Error& error =
- Error::Handle(isolate_, isolate_->object_store()->sticky_error());
+ const Error& error = Error::Handle(zone(),
+ isolate_->object_store()->sticky_error());
ASSERT(error.IsNull() || error.IsUnwindError());
// Only send a resume event when the isolate is not unwinding.
@@ -365,7 +365,7 @@ RawError* Debugger::SignalIsolateInterrupted() {
// If any error occurred while in the debug message loop, return it here.
const Error& error =
- Error::Handle(isolate_, isolate_->object_store()->sticky_error());
+ Error::Handle(zone(), isolate_->object_store()->sticky_error());
ASSERT(error.IsNull() || error.IsUnwindError());
isolate_->object_store()->clear_sticky_error();
return error.raw();
@@ -474,7 +474,7 @@ bool Debugger::HasBreakpoint(const Function& func) {
// is a user-defined breakpoint that falls into the token
// range of the function. This may be a false positive: the breakpoint
// might be inside a local closure.
- Script& script = Script::Handle(isolate_);
+ Script& script = Script::Handle(zone());
BreakpointLocation* sbpt = breakpoint_locations_;
while (sbpt != NULL) {
script = sbpt->script();
@@ -1432,11 +1432,11 @@ ActivationFrame* Debugger::CollectDartFrame(Isolate* isolate,
}
-RawArray* Debugger::DeoptimizeToArray(Isolate* isolate,
+RawArray* Debugger::DeoptimizeToArray(Thread* thread,
StackFrame* frame,
const Code& code) {
ASSERT(code.is_optimized());
-
+ Isolate* isolate = thread->isolate();
// Create the DeoptContext for this deoptimization.
DeoptContext* deopt_context =
new DeoptContext(frame, code,
@@ -1448,7 +1448,7 @@ RawArray* Debugger::DeoptimizeToArray(Isolate* isolate,
deopt_context->FillDestFrame();
deopt_context->MaterializeDeferredObjects();
- const Array& dest_frame = Array::Handle(isolate,
+ const Array& dest_frame = Array::Handle(thread->zone(),
deopt_context->DestFrameAsArray());
isolate->set_deopt_context(NULL);
@@ -1459,12 +1459,14 @@ RawArray* Debugger::DeoptimizeToArray(Isolate* isolate,
DebuggerStackTrace* Debugger::CollectStackTrace() {
- Isolate* isolate = Isolate::Current();
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ Isolate* isolate = thread->isolate();
DebuggerStackTrace* stack_trace = new DebuggerStackTrace(8);
StackFrameIterator iterator(false);
- Code& code = Code::Handle(isolate);
- Code& inlined_code = Code::Handle(isolate);
- Array& deopt_frame = Array::Handle(isolate);
+ Code& code = Code::Handle(zone);
+ Code& inlined_code = Code::Handle(zone);
+ Array& deopt_frame = Array::Handle(zone);
for (StackFrame* frame = iterator.NextFrame();
frame != NULL;
@@ -1477,14 +1479,14 @@ DebuggerStackTrace* Debugger::CollectStackTrace() {
if (frame->IsDartFrame()) {
code = frame->LookupDartCode();
if (code.is_optimized() && !Compiler::always_optimize()) {
- deopt_frame = DeoptimizeToArray(isolate, frame, code);
+ deopt_frame = DeoptimizeToArray(thread, frame, code);
for (InlinedFunctionsIterator it(code, frame->pc());
!it.Done();
it.Advance()) {
inlined_code = it.code();
if (FLAG_trace_debugger_stacktrace) {
const Function& function =
- Function::Handle(isolate, inlined_code.function());
+ Function::Handle(zone, inlined_code.function());
ASSERT(!function.IsNull());
OS::PrintErr("CollectStackTrace: visiting inlined function: %s\n",
function.ToFullyQualifiedCString());
@@ -1517,7 +1519,7 @@ ActivationFrame* Debugger::TopDartFrame() const {
while ((frame != NULL) && !frame->IsDartFrame()) {
frame = iterator.NextFrame();
}
- Code& code = Code::Handle(isolate_, frame->LookupDartCode());
+ Code& code = Code::Handle(zone(), frame->LookupDartCode());
ActivationFrame* activation =
new ActivationFrame(frame->pc(), frame->fp(), frame->sp(), code,
Object::null_array(), 0);
@@ -1864,10 +1866,11 @@ void Debugger::FindCompiledFunctions(const Script& script,
intptr_t start_pos,
intptr_t end_pos,
GrowableObjectArray* function_list) {
- Class& cls = Class::Handle(isolate_);
- Array& functions = Array::Handle(isolate_);
- GrowableObjectArray& closures = GrowableObjectArray::Handle(isolate_);
- Function& function = Function::Handle(isolate_);
+ Zone* zn = zone();
+ Class& cls = Class::Handle(zn);
+ Array& functions = Array::Handle(zn);
+ GrowableObjectArray& closures = GrowableObjectArray::Handle(zn);
+ Function& function = Function::Handle(zn);
const ClassTable& class_table = *isolate_->class_table();
const intptr_t num_classes = class_table.NumCids();
@@ -1947,12 +1950,13 @@ static void SelectBestFit(Function* best_fit, Function* func) {
RawFunction* Debugger::FindBestFit(const Script& script,
intptr_t token_pos) {
- Class& cls = Class::Handle(isolate_);
- Array& functions = Array::Handle(isolate_);
- GrowableObjectArray& closures = GrowableObjectArray::Handle(isolate_);
- Function& function = Function::Handle(isolate_);
- Function& best_fit = Function::Handle(isolate_);
- Error& error = Error::Handle(isolate_);
+ Zone* zn = zone();
+ Class& cls = Class::Handle(zn);
+ Array& functions = Array::Handle(zn);
+ GrowableObjectArray& closures = GrowableObjectArray::Handle(zn);
+ Function& function = Function::Handle(zn);
+ Function& best_fit = Function::Handle(zn);
+ Error& error = Error::Handle(zn);
const ClassTable& class_table = *isolate_->class_table();
const intptr_t num_classes = class_table.NumCids();
@@ -2011,7 +2015,7 @@ BreakpointLocation* Debugger::SetBreakpoint(const Script& script,
intptr_t last_token_pos,
intptr_t requested_line,
intptr_t requested_column) {
- Function& func = Function::Handle(isolate_);
+ Function& func = Function::Handle(zone());
func = FindBestFit(script, token_pos);
if (func.IsNull()) {
return NULL;
@@ -2203,12 +2207,12 @@ BreakpointLocation* Debugger::BreakpointLocationAtLineCol(
const String& script_url,
intptr_t line_number,
intptr_t column_number) {
- Library& lib = Library::Handle(isolate_);
- Script& script = Script::Handle(isolate_);
+ Library& lib = Library::Handle(zone());
+ Script& script = Script::Handle(zone());
const GrowableObjectArray& libs =
GrowableObjectArray::Handle(isolate_->object_store()->libraries());
const GrowableObjectArray& scripts =
- GrowableObjectArray::Handle(isolate_, GrowableObjectArray::New());
+ GrowableObjectArray::Handle(zone(), GrowableObjectArray::New());
for (intptr_t i = 0; i < libs.Length(); i++) {
lib ^= libs.At(i);
script = lib.LookupScript(script_url);
@@ -2398,10 +2402,10 @@ void Debugger::CollectLibraryFields(const GrowableObjectArray& field_list,
const String& prefix,
bool include_private_fields) {
DictionaryIterator it(lib);
- Object& entry = Object::Handle(isolate_);
- Field& field = Field::Handle(isolate_);
- String& field_name = String::Handle(isolate_);
- PassiveObject& field_value = PassiveObject::Handle(isolate_);
+ Object& entry = Object::Handle(isolate_->current_zone());
+ Field& field = Field::Handle(zone());
+ String& field_name = String::Handle(zone());
+ PassiveObject& field_value = PassiveObject::Handle(isolate_->current_zone());
while (it.HasNext()) {
entry = it.GetNext();
if (entry.IsField()) {
@@ -2434,7 +2438,7 @@ void Debugger::CollectLibraryFields(const GrowableObjectArray& field_list,
RawArray* Debugger::GetLibraryFields(const Library& lib) {
const GrowableObjectArray& field_list =
GrowableObjectArray::Handle(GrowableObjectArray::New(8));
- CollectLibraryFields(field_list, lib, String::Handle(isolate_), true);
+ CollectLibraryFields(field_list, lib, String::Handle(zone()), true);
return Array::MakeArray(field_list);
}
@@ -2442,16 +2446,16 @@ RawArray* Debugger::GetLibraryFields(const Library& lib) {
RawArray* Debugger::GetGlobalFields(const Library& lib) {
const GrowableObjectArray& field_list =
GrowableObjectArray::Handle(GrowableObjectArray::New(8));
- String& prefix_name = String::Handle(isolate_);
+ String& prefix_name = String::Handle(zone());
CollectLibraryFields(field_list, lib, prefix_name, true);
- Library& imported = Library::Handle(isolate_);
+ Library& imported = Library::Handle(zone());
intptr_t num_imports = lib.num_imports();
for (intptr_t i = 0; i < num_imports; i++) {
imported = lib.ImportLibraryAt(i);
ASSERT(!imported.IsNull());
CollectLibraryFields(field_list, imported, prefix_name, false);
}
- LibraryPrefix& prefix = LibraryPrefix::Handle(isolate_);
+ LibraryPrefix& prefix = LibraryPrefix::Handle(zone());
LibraryPrefixIterator it(lib);
while (it.HasNext()) {
prefix = it.GetNext();
@@ -2660,7 +2664,7 @@ RawError* Debugger::DebuggerStepCallback() {
// If any error occurred while in the debug message loop, return it here.
const Error& error =
- Error::Handle(isolate_, isolate_->object_store()->sticky_error());
+ Error::Handle(zone(), isolate_->object_store()->sticky_error());
isolate_->object_store()->clear_sticky_error();
return error.raw();
}
@@ -2749,7 +2753,7 @@ RawError* Debugger::SignalBpReached() {
// If any error occurred while in the debug message loop, return it here.
const Error& error =
- Error::Handle(isolate_, isolate_->object_store()->sticky_error());
+ Error::Handle(zone(), isolate_->object_store()->sticky_error());
isolate_->object_store()->clear_sticky_error();
return error.raw();
}
@@ -2806,7 +2810,7 @@ void Debugger::NotifyIsolateCreated() {
// the given token position.
RawFunction* Debugger::FindInnermostClosure(const Function& function,
intptr_t token_pos) {
- const Class& owner = Class::Handle(isolate_, function.Owner());
+ const Class& owner = Class::Handle(zone(), function.Owner());
if (owner.closures() == GrowableObjectArray::null()) {
return Function::null();
}
@@ -2814,12 +2818,12 @@ RawFunction* Debugger::FindInnermostClosure(const Function& function,
// script as the outer function. We could have closures originating
// in mixin classes whose source code is contained in a different
// script.
- const Script& outer_origin = Script::Handle(isolate_, function.script());
+ const Script& outer_origin = Script::Handle(zone(), function.script());
const GrowableObjectArray& closures =
- GrowableObjectArray::Handle(isolate_, owner.closures());
+ GrowableObjectArray::Handle(zone(), owner.closures());
const intptr_t num_closures = closures.Length();
- Function& closure = Function::Handle(isolate_);
- Function& best_fit = Function::Handle(isolate_);
+ Function& closure = Function::Handle(zone());
+ Function& best_fit = Function::Handle(zone());
for (intptr_t i = 0; i < num_closures; i++) {
closure ^= closures.At(i);
if ((function.token_pos() < closure.token_pos()) &&
@@ -2847,13 +2851,13 @@ void Debugger::NotifyCompilation(const Function& func) {
}
// Iterate over all source breakpoints to check whether breakpoints
// need to be set in the newly compiled function.
- Script& script = Script::Handle(isolate_);
+ Script& script = Script::Handle(zone());
for (BreakpointLocation* loc = breakpoint_locations_;
loc != NULL;
loc = loc->next()) {
script = loc->script();
if (FunctionContains(func, script, loc->token_pos())) {
- Function& inner_function = Function::Handle(isolate_);
+ Function& inner_function = Function::Handle(zone());
inner_function = FindInnermostClosure(func, loc->token_pos());
if (!inner_function.IsNull()) {
// The local function of a function we just compiled cannot
@@ -2934,9 +2938,10 @@ void Debugger::NotifyDoneLoading() {
// Common, fast path.
return;
}
- Library& lib = Library::Handle(isolate_);
- Script& script = Script::Handle(isolate_);
- String& url = String::Handle(isolate_);
+ Zone* zn = zone();
+ Library& lib = Library::Handle(zn);
+ Script& script = Script::Handle(zn);
+ String& url = String::Handle(zn);
BreakpointLocation* loc = latent_locations_;
BreakpointLocation* prev_loc = NULL;
const GrowableObjectArray& libs =
@@ -3209,7 +3214,7 @@ BreakpointLocation* Debugger::GetLatentBreakpoint(const String& url,
intptr_t line,
intptr_t column) {
BreakpointLocation* bpt = latent_locations_;
- String& bpt_url = String::Handle(isolate_);
+ String& bpt_url = String::Handle(zone());
while (bpt != NULL) {
bpt_url = bpt->url();
if (bpt_url.Equals(url) &&
« no previous file with comments | « runtime/vm/debugger.h ('k') | runtime/vm/exceptions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698