summaryrefslogtreecommitdiff
path: root/deps/v8/src/debug/ia32/debug-ia32.cc
blob: 1e3ab38966a0391cca340a446800a999715acd33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if V8_TARGET_ARCH_IA32

#include "src/debug/debug.h"

#include "src/debug/liveedit.h"
#include "src/frames-inl.h"
#include "src/macro-assembler.h"

namespace v8 {
namespace internal {

#define __ ACCESS_MASM(masm)

void DebugCodegen::GenerateHandleDebuggerStatement(MacroAssembler* masm) {
  Assembler::SupportsRootRegisterScope supports_root_register(masm);

  {
    FrameScope scope(masm, StackFrame::INTERNAL);
    __ CallRuntime(Runtime::kHandleDebuggerStatement, 0);
  }
  __ MaybeDropFrames();

  // Return to caller.
  __ ret(0);
}

void DebugCodegen::GenerateFrameDropperTrampoline(MacroAssembler* masm) {
  Assembler::SupportsRootRegisterScope supports_root_register(masm);

  // Frame is being dropped:
  // - Drop to the target frame specified by eax.
  // - Look up current function on the frame.
  // - Leave the frame.
  // - Restart the frame by calling the function.
  __ mov(ebp, eax);
  __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
  __ leave();

  __ mov(eax, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
  __ movzx_w(
      eax, FieldOperand(eax, SharedFunctionInfo::kFormalParameterCountOffset));

  // The expected and actual argument counts don't matter as long as they match
  // and we don't enter the ArgumentsAdaptorTrampoline.
  ParameterCount dummy(0);
  __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
  __ InvokeFunctionCode(edi, no_reg, dummy, dummy, JUMP_FUNCTION);
}

const bool LiveEdit::kFrameDropperSupported = true;

#undef __

}  // namespace internal
}  // namespace v8

#endif  // V8_TARGET_ARCH_IA32