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

Side by Side 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: clean Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« src/mirror-debugger.js ('K') | « src/mirror-debugger.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 12354 matching lines...) Expand 10 before | Expand all | Expand 10 after
12365 // Evaluate a piece of JavaScript in the context of a stack frame for 12365 // Evaluate a piece of JavaScript in the context of a stack frame for
12366 // debugging. This is done by creating a new context which in its extension 12366 // debugging. This is done by creating a new context which in its extension
12367 // part has all the parameters and locals of the function on the stack frame 12367 // part has all the parameters and locals of the function on the stack frame
12368 // as well as a materialized arguments object. As this context replaces 12368 // as well as a materialized arguments object. As this context replaces
12369 // the context of the function on the stack frame a new (empty) function 12369 // the context of the function on the stack frame a new (empty) function
12370 // is created as well to be used as the closure for the context. 12370 // is created as well to be used as the closure for the context.
12371 // This closure as replacements for the one on the stack frame presenting 12371 // This closure as replacements for the one on the stack frame presenting
12372 // the same view of the values of parameters and local variables as if the 12372 // the same view of the values of parameters and local variables as if the
12373 // piece of JavaScript was evaluated at the point where the function on the 12373 // piece of JavaScript was evaluated at the point where the function on the
12374 // stack frame is currently stopped when we compile and run the (direct) eval. 12374 // stack frame is currently stopped when we compile and run the (direct) eval.
12375 // Returns array of
12376 // #0: evaluate result
12377 // #1: local variables scope materizalized as object before evaluation
12378 // #2: local variables scope materizalized as object after evaluation
12379 // Since user expression only reaches (and modifies) copies of local variables,
12380 // those copies are returned to the caller to allow it track the changes and
Yang 2013/06/25 11:15:01 do you mean "... to allow tracking the changes..."
Peter Rybin 2013/06/25 12:22:41 Yes. Done.
12381 // manually update the actual variables.
12375 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) { 12382 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluate) {
12376 HandleScope scope(isolate); 12383 HandleScope scope(isolate);
12377 12384
12378 // Check the execution state and decode arguments frame and source to be 12385 // Check the execution state and decode arguments frame and source to be
12379 // evaluated. 12386 // evaluated.
12380 ASSERT(args.length() == 6); 12387 ASSERT(args.length() == 6);
12381 Object* check_result; 12388 Object* check_result;
12382 { MaybeObject* maybe_result = Runtime_CheckExecutionState( 12389 { MaybeObject* maybe_result = Runtime_CheckExecutionState(
12383 RUNTIME_ARGUMENTS(isolate, args)); 12390 RUNTIME_ARGUMENTS(isolate, args));
12384 if (!maybe_result->ToObject(&check_result)) return maybe_result; 12391 if (!maybe_result->ToObject(&check_result)) return maybe_result;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
12464 frame, 12471 frame,
12465 inlined_jsframe_index); 12472 inlined_jsframe_index);
12466 if (context.is_null()) { 12473 if (context.is_null()) {
12467 ASSERT(isolate->has_pending_exception()); 12474 ASSERT(isolate->has_pending_exception());
12468 MaybeObject* exception = isolate->pending_exception(); 12475 MaybeObject* exception = isolate->pending_exception();
12469 isolate->clear_pending_exception(); 12476 isolate->clear_pending_exception();
12470 return exception; 12477 return exception;
12471 } 12478 }
12472 12479
12473 Handle<Object> receiver(frame->receiver(), isolate); 12480 Handle<Object> receiver(frame->receiver(), isolate);
12474 return DebugEvaluate(isolate, context, context_extension, receiver, source); 12481 Object* evaluate_result_object;
12482 { MaybeObject* maybe_result =
12483 DebugEvaluate(isolate, context, context_extension, receiver, source);
12484 if (!maybe_result->ToObject(&evaluate_result_object)) return maybe_result;
12485 }
12486 Handle<Object> evaluate_result(evaluate_result_object, isolate);
12487
12488 Handle<JSObject> local_scope_after = MaterializeLocalScopeWithFrameInspector(
12489 isolate, frame, &frame_inspector);
12490
12491 Handle<FixedArray> resultArray =
12492 isolate->factory()->NewFixedArray(3);
12493 resultArray->set(0, *evaluate_result);
12494 resultArray->set(2, *local_scope);
12495 resultArray->set(1, *local_scope_after);
12496
12497 return *(isolate->factory()->NewJSArrayWithElements(resultArray));
12475 } 12498 }
12476 12499
12477 12500
12478 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) { 12501 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugEvaluateGlobal) {
12479 HandleScope scope(isolate); 12502 HandleScope scope(isolate);
12480 12503
12481 // Check the execution state and decode arguments frame and source to be 12504 // Check the execution state and decode arguments frame and source to be
12482 // evaluated. 12505 // evaluated.
12483 ASSERT(args.length() == 4); 12506 ASSERT(args.length() == 4);
12484 Object* check_result; 12507 Object* check_result;
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after
13847 // Handle last resort GC and make sure to allow future allocations 13870 // Handle last resort GC and make sure to allow future allocations
13848 // to grow the heap without causing GCs (if possible). 13871 // to grow the heap without causing GCs (if possible).
13849 isolate->counters()->gc_last_resort_from_js()->Increment(); 13872 isolate->counters()->gc_last_resort_from_js()->Increment();
13850 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13873 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13851 "Runtime::PerformGC"); 13874 "Runtime::PerformGC");
13852 } 13875 }
13853 } 13876 }
13854 13877
13855 13878
13856 } } // namespace v8::internal 13879 } } // namespace v8::internal
OLDNEW
« src/mirror-debugger.js ('K') | « src/mirror-debugger.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698