| Index: src/liveedit.cc
|
| diff --git a/src/liveedit.cc b/src/liveedit.cc
|
| index feaafd471e1882a782b88d5e8414bba9d33abcc1..19323e5f7d8d3e55366d8f50fbf57fc68e515122 100644
|
| --- a/src/liveedit.cc
|
| +++ b/src/liveedit.cc
|
| @@ -1699,7 +1699,7 @@ static bool FixTryCatchHandler(StackFrame* top_frame,
|
| // Returns error message or NULL.
|
| static const char* DropFrames(Vector<StackFrame*> frames,
|
| int top_frame_index,
|
| - int bottom_js_frame_index,
|
| + const int bottom_js_frame_index,
|
| Debug::FrameDropMode* mode,
|
| Object*** restarter_frame_function_pointer) {
|
| if (!Debug::kFrameDropperSupported) {
|
| @@ -1730,36 +1730,42 @@ static const char* DropFrames(Vector<StackFrame*> frames,
|
| isolate->builtins()->builtin(
|
| Builtins::kFrameDropper_LiveEdit)) {
|
| // OK, we can drop our own code.
|
| - pre_top_frame = frames[top_frame_index - 2];
|
| - top_frame = frames[top_frame_index - 1];
|
| + top_frame_index--;
|
| *mode = Debug::CURRENTLY_SET_MODE;
|
| frame_has_padding = false;
|
| } else if (pre_top_frame_code ==
|
| isolate->builtins()->builtin(Builtins::kReturn_DebugBreak)) {
|
| *mode = Debug::FRAME_DROPPED_IN_RETURN_CALL;
|
| frame_has_padding = Debug::FramePaddingLayout::kIsSupported;
|
| - } else if (pre_top_frame_code->kind() == Code::STUB &&
|
| - pre_top_frame_code->major_key() == CodeStub::CEntry) {
|
| - // Entry from our unit tests on 'debugger' statement.
|
| + } else if (pre_top_frame->type() == StackFrame::EXIT) {
|
| + // Exit to C++ code. Could be 'debugger' statement or some regular code
|
| + // that cause exception throwing (including 'throw' statement).
|
| // It's fine, we support this case.
|
| *mode = Debug::FRAME_DROPPED_IN_DIRECT_CALL;
|
| // We don't have a padding from 'debugger' statement call.
|
| // Here the stub is CEntry, it's not debug-only and can't be padded.
|
| // If anyone would complain, a proxy padded stub could be added.
|
| frame_has_padding = false;
|
| + } else if (frames[top_frame_index - 2]->type() == StackFrame::EXIT) {
|
| + top_frame_index--;
|
| + // Same as above case.
|
| + *mode = Debug::FRAME_DROPPED_IN_DIRECT_CALL;
|
| + frame_has_padding = false;
|
| } else if (pre_top_frame->type() == StackFrame::ARGUMENTS_ADAPTOR) {
|
| // This must be adaptor that remain from the frame dropping that
|
| // is still on stack. A frame dropper frame must be above it.
|
| ASSERT(frames[top_frame_index - 2]->LookupCode() ==
|
| isolate->builtins()->builtin(Builtins::kFrameDropper_LiveEdit));
|
| - pre_top_frame = frames[top_frame_index - 3];
|
| - top_frame = frames[top_frame_index - 2];
|
| + top_frame_index -= 2;
|
| *mode = Debug::CURRENTLY_SET_MODE;
|
| frame_has_padding = false;
|
| } else {
|
| return "Unknown structure of stack above changing function";
|
| }
|
|
|
| + pre_top_frame = frames[top_frame_index - 1];
|
| + top_frame = frames[top_frame_index];
|
| +
|
| Address unused_stack_top = top_frame->sp();
|
| Address unused_stack_bottom = bottom_js_frame->fp()
|
| - Debug::kFrameDropperFrameSize * kPointerSize // Size of the new frame.
|
| @@ -1770,8 +1776,21 @@ static const char* DropFrames(Vector<StackFrame*> frames,
|
| // top_frame may be damaged below this point. Do not used it.
|
| ASSERT(!(top_frame = NULL));
|
|
|
| + bool use_padding = false;
|
| if (unused_stack_top > unused_stack_bottom) {
|
| if (frame_has_padding) {
|
| + use_padding = true;
|
| + } else {
|
| + return "Not enough space for frame dropper frame";
|
| + }
|
| + }
|
| +
|
| + // Committing now. After this point we should return only NULL value.
|
| +
|
| + if (use_padding) {
|
| + // Extra parenthses are temporary to retain indentation to keep diff clear.
|
| + // TODO(prybin): drop parenthses in a separate change.
|
| + {
|
| int shortage_bytes =
|
| static_cast<int>(unused_stack_top - unused_stack_bottom);
|
|
|
| @@ -1805,12 +1824,14 @@ static const char* DropFrames(Vector<StackFrame*> frames,
|
|
|
| STATIC_ASSERT(sizeof(Address) == kPointerSize);
|
| top_frame_pc_address -= shortage_bytes / kPointerSize;
|
| - } else {
|
| - return "Not enough space for frame dropper frame";
|
| }
|
| }
|
|
|
| - // Committing now. After this point we should return only NULL value.
|
| +
|
| + if (pre_top_frame->type() == StackFrame::EXIT) {
|
| + isolate->debug()->set_c_entry_frame_to_ignore_exception(
|
| + pre_top_frame->fp());
|
| + }
|
|
|
| FixTryCatchHandler(pre_top_frame, bottom_js_frame);
|
| // Make sure FixTryCatchHandler is idempotent.
|
|
|