| Index: src/runtime.cc
|
| diff --git a/src/runtime.cc b/src/runtime.cc
|
| index 95bc313d22d3c5cf67e20aa8f853106a92d1bdf9..5b44374591cefb4a10a25e89b7c1e90d365d6817 100644
|
| --- a/src/runtime.cc
|
| +++ b/src/runtime.cc
|
| @@ -12789,6 +12789,45 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditCompareStrings) {
|
| }
|
|
|
|
|
| +// Restarts a call frame and completely drops all frames above.
|
| +// Returns true if successful. Otherwise returns undefined or an error message.
|
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_LiveEditRestartFrame) {
|
| + HandleScope scope(isolate);
|
| + ASSERT(args.length() == 2);
|
| +
|
| + // Check arguments.
|
| + Object* check;
|
| + { MaybeObject* maybe_check = Runtime_CheckExecutionState(
|
| + RUNTIME_ARGUMENTS(isolate, args));
|
| + if (!maybe_check->ToObject(&check)) return maybe_check;
|
| + }
|
| + CONVERT_NUMBER_CHECKED(int, index, Int32, args[1]);
|
| + Heap* heap = isolate->heap();
|
| +
|
| + // Find the relevant frame with the requested index.
|
| + StackFrame::Id id = isolate->debug()->break_frame_id();
|
| + if (id == StackFrame::NO_ID) {
|
| + // If there are no JavaScript stack frames return undefined.
|
| + return heap->undefined_value();
|
| + }
|
| +
|
| + int count = 0;
|
| + JavaScriptFrameIterator it(isolate, id);
|
| + for (; !it.done(); it.Advance()) {
|
| + if (index < count + it.frame()->GetInlineCount()) break;
|
| + count += it.frame()->GetInlineCount();
|
| + }
|
| + if (it.done()) return heap->undefined_value();
|
| +
|
| + const char* error_message =
|
| + LiveEdit::RestartFrame(it.frame(), isolate->zone());
|
| + if (error_message) {
|
| + return *(isolate->factory()->LookupAsciiSymbol(error_message));
|
| + }
|
| + return heap->true_value();
|
| +}
|
| +
|
| +
|
| // A testing entry. Returns statement position which is the closest to
|
| // source_position.
|
| RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionCodePositionFromSource) {
|
|
|