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

Unified Diff: src/runtime.cc

Issue 17636007: Allow debugger evaluate expressions to mute local variables (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: follow code review Created 7 years, 6 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 | « src/mirror-debugger.js ('k') | test/mjsunit/debug-evaluate-locals.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 02a97e24b17156f16e7a407bcbaa30af594356ab..4da776f6caccef807254753026ae8888be0a3351 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -12372,6 +12372,13 @@ static MaybeObject* DebugEvaluate(Isolate* isolate,
// the same view of the values of parameters and local variables as if the
// piece of JavaScript was evaluated at the point where the function on the
// stack frame is currently stopped when we compile and run the (direct) eval.
+// Returns array of
+// #0: evaluate result
+// #1: local variables scope materizalized as object before evaluation
+// #2: local variables scope materizalized as object after evaluation
+// Since user expression only reaches (and modifies) copies of local variables,
+// those copies are returned to the caller to allow tracking the changes and
+// manually updating the actual variables.
RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
HandleScope scope(isolate);
@@ -12471,7 +12478,23 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
}
Handle<Object> receiver(frame->receiver(), isolate);
- return DebugEvaluate(isolate, context, context_extension, receiver, source);
+ Object* evaluate_result_object;
+ { MaybeObject* maybe_result =
+ DebugEvaluate(isolate, context, context_extension, receiver, source);
+ if (!maybe_result->ToObject(&evaluate_result_object)) return maybe_result;
+ }
+ Handle<Object> evaluate_result(evaluate_result_object, isolate);
+
+ Handle<JSObject> local_scope_after = MaterializeLocalScopeWithFrameInspector(
+ isolate, frame, &frame_inspector);
+
+ Handle<FixedArray> resultArray =
+ isolate->factory()->NewFixedArray(3);
+ resultArray->set(0, *evaluate_result);
+ resultArray->set(2, *local_scope);
+ resultArray->set(1, *local_scope_after);
+
+ return *(isolate->factory()->NewJSArrayWithElements(resultArray));
}
« no previous file with comments | « src/mirror-debugger.js ('k') | test/mjsunit/debug-evaluate-locals.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698