Revision: 21270
Author: [email protected]
Date: Mon May 12 13:47:01 2014 UTC
Log: Clean up debugger flags.
[email protected]
Review URL: https://codereview.chromium.org/261253005
http://code.google.com/p/v8/source/detail?r=21270
Modified:
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/arm/macro-assembler-arm.cc
/branches/bleeding_edge/src/arm/macro-assembler-arm.h
/branches/bleeding_edge/src/arm64/full-codegen-arm64.cc
/branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc
/branches/bleeding_edge/src/arm64/macro-assembler-arm64.cc
/branches/bleeding_edge/src/arm64/macro-assembler-arm64.h
/branches/bleeding_edge/src/bootstrapper.cc
/branches/bleeding_edge/src/codegen.cc
/branches/bleeding_edge/src/compiler.cc
/branches/bleeding_edge/src/compiler.h
/branches/bleeding_edge/src/debug.cc
/branches/bleeding_edge/src/debug.h
/branches/bleeding_edge/src/execution.cc
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/factory.h
/branches/bleeding_edge/src/flag-definitions.h
/branches/bleeding_edge/src/frames.h
/branches/bleeding_edge/src/full-codegen.cc
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc
/branches/bleeding_edge/src/ia32/macro-assembler-ia32.h
/branches/bleeding_edge/src/isolate-inl.h
/branches/bleeding_edge/src/isolate.h
/branches/bleeding_edge/src/mips/full-codegen-mips.cc
/branches/bleeding_edge/src/mips/lithium-codegen-mips.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.cc
/branches/bleeding_edge/src/mips/macro-assembler-mips.h
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x64/macro-assembler-x64.cc
/branches/bleeding_edge/src/x64/macro-assembler-x64.h
/branches/bleeding_edge/test/cctest/test-heap.cc
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Mon May 12 07:49:11
2014 UTC
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Mon May 12 13:47:01
2014 UTC
@@ -171,7 +171,8 @@
FrameScope frame_scope(masm_, StackFrame::MANUAL);
info->set_prologue_offset(masm_->pc_offset());
- __ Prologue(BUILD_FUNCTION_FRAME);
+ ASSERT(!info->IsStub());
+ __ Prologue(info);
info->AddNoFrameRange(0, masm_->pc_offset());
{ Comment cmnt(masm_, "[ Allocate locals");
@@ -349,7 +350,7 @@
void FullCodeGenerator::EmitProfilingCounterReset() {
int reset_value = FLAG_interrupt_budget;
- if (isolate()->IsDebuggerActive()) {
+ if (info_->is_debug()) {
// Detect debug break requests as soon as possible.
reset_value = FLAG_interrupt_budget >> 4;
}
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Fri May 9
08:28:25 2014 UTC
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon May 12
13:47:01 2014 UTC
@@ -140,7 +140,7 @@
info()->set_prologue_offset(masm_->pc_offset());
if (NeedsEagerFrame()) {
- __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME :
BUILD_FUNCTION_FRAME);
+ __ Prologue(info());
frame_is_built_ = true;
info_->AddNoFrameRange(0, masm_->pc_offset());
}
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Fri May 9
16:18:58 2014 UTC
+++ /branches/bleeding_edge/src/arm/macro-assembler-arm.cc Mon May 12
13:47:01 2014 UTC
@@ -902,8 +902,8 @@
}
-void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
- if (frame_mode == BUILD_STUB_FRAME) {
+void MacroAssembler::Prologue(CompilationInfo* info) {
+ if (info->IsStub()) {
PushFixedFrame();
Push(Smi::FromInt(StackFrame::STUB));
// Adjust FP to point to saved FP.
@@ -913,7 +913,7 @@
this, kNoCodeAgeSequenceLength);
// The following three instructions must remain together and unmodified
// for code aging to work properly.
- if (isolate()->IsCodePreAgingActive()) {
+ if (info->IsCodePreAgingActive()) {
// Pre-age the code.
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
add(r0, pc, Operand(-8));
=======================================
--- /branches/bleeding_edge/src/arm/macro-assembler-arm.h Fri May 9
16:18:58 2014 UTC
+++ /branches/bleeding_edge/src/arm/macro-assembler-arm.h Mon May 12
13:47:01 2014 UTC
@@ -519,7 +519,7 @@
Label* not_int32);
// Generates function and stub prologue code.
- void Prologue(PrologueFrameMode frame_mode);
+ void Prologue(CompilationInfo* info);
// Enter exit frame.
// stack_space - extra stack space, used for alignment before call to C.
=======================================
--- /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Mon May 12
07:49:11 2014 UTC
+++ /branches/bleeding_edge/src/arm64/full-codegen-arm64.cc Mon May 12
13:47:01 2014 UTC
@@ -170,7 +170,8 @@
// Push(lr, fp, cp, x1);
// Add(fp, jssp, 2 * kPointerSize);
info->set_prologue_offset(masm_->pc_offset());
- __ Prologue(BUILD_FUNCTION_FRAME);
+ ASSERT(!info->IsStub());
+ __ Prologue(info);
info->AddNoFrameRange(0, masm_->pc_offset());
// Reserve space on the stack for locals.
@@ -347,7 +348,7 @@
void FullCodeGenerator::EmitProfilingCounterReset() {
int reset_value = FLAG_interrupt_budget;
- if (isolate()->IsDebuggerActive()) {
+ if (info_->is_debug()) {
// Detect debug break requests as soon as possible.
reset_value = FLAG_interrupt_budget >> 4;
}
=======================================
--- /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Mon May 12
13:30:54 2014 UTC
+++ /branches/bleeding_edge/src/arm64/lithium-codegen-arm64.cc Mon May 12
13:47:01 2014 UTC
@@ -671,7 +671,7 @@
ASSERT(__ StackPointer().Is(jssp));
info()->set_prologue_offset(masm_->pc_offset());
if (NeedsEagerFrame()) {
- __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME :
BUILD_FUNCTION_FRAME);
+ __ Prologue(info());
frame_is_built_ = true;
info_->AddNoFrameRange(0, masm_->pc_offset());
}
=======================================
--- /branches/bleeding_edge/src/arm64/macro-assembler-arm64.cc Fri May 9
16:18:58 2014 UTC
+++ /branches/bleeding_edge/src/arm64/macro-assembler-arm64.cc Mon May 12
13:47:01 2014 UTC
@@ -2982,8 +2982,8 @@
}
-void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
- if (frame_mode == BUILD_STUB_FRAME) {
+void MacroAssembler::Prologue(CompilationInfo* info) {
+ if (info->IsStub()) {
ASSERT(StackPointer().Is(jssp));
UseScratchRegisterScope temps(this);
Register temp = temps.AcquireX();
@@ -2993,7 +2993,7 @@
__ Push(lr, fp, cp, temp);
__ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp);
} else {
- if (isolate()->IsCodePreAgingActive()) {
+ if (info->IsCodePreAgingActive()) {
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
__ EmitCodeAgeSequence(stub);
} else {
=======================================
--- /branches/bleeding_edge/src/arm64/macro-assembler-arm64.h Fri May 9
16:18:58 2014 UTC
+++ /branches/bleeding_edge/src/arm64/macro-assembler-arm64.h Mon May 12
13:47:01 2014 UTC
@@ -1648,7 +1648,7 @@
void ExitFrameRestoreFPRegs();
// Generates function and stub prologue code.
- void Prologue(PrologueFrameMode frame_mode);
+ void Prologue(CompilationInfo* info);
// Enter exit frame. Exit frames are used when calling C code from
generated
// (JavaScript) code.
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Fri May 9 17:59:15 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Mon May 12 13:47:01 2014 UTC
@@ -1421,7 +1421,7 @@
Vector<const char> name,
Handle<String> source) {
HandleScope scope(isolate);
- isolate->debugger()->set_compiling_natives(true);
+ Debugger::IgnoreScope compiling_natives(isolate->debugger());
// During genesis, the boilerplate for stack overflow won't work until
the
// environment has been at least partially initialized. Add a stack check
// before entering JS code to catch overflow early.
@@ -1437,7 +1437,6 @@
true);
ASSERT(isolate->has_pending_exception() != result);
if (!result) isolate->clear_pending_exception();
- isolate->debugger()->set_compiling_natives(false);
return result;
}
=======================================
--- /branches/bleeding_edge/src/codegen.cc Tue May 6 11:14:37 2014 UTC
+++ /branches/bleeding_edge/src/codegen.cc Mon May 12 13:47:01 2014 UTC
@@ -150,7 +150,8 @@
Handle<Code> code =
isolate->factory()->NewCode(desc, flags, masm->CodeObject(),
false, is_crankshafted,
- info->prologue_offset());
+ info->prologue_offset(),
+ info->is_debug());
isolate->counters()->total_compiled_code_size()->Increment(
code->instruction_size());
isolate->heap()->IncrementCodeGeneratedBytes(is_crankshafted,
=======================================
--- /branches/bleeding_edge/src/compiler.cc Wed Apr 30 10:51:01 2014 UTC
+++ /branches/bleeding_edge/src/compiler.cc Mon May 12 13:47:01 2014 UTC
@@ -110,9 +110,9 @@
}
mode_ = mode;
abort_due_to_dependency_ = false;
- if (script_->type()->value() == Script::TYPE_NATIVE) {
- MarkAsNative();
- }
+ if (script_->type()->value() == Script::TYPE_NATIVE) MarkAsNative();
+ if (isolate_->debugger()->is_active()) MarkAsDebug();
+
if (!shared_info_.is_null()) {
ASSERT(strict_mode() == SLOPPY);
SetStrictMode(shared_info_->strict_mode());
@@ -277,21 +277,6 @@
DECLARATION_NODE_LIST(DEF_VISIT)
#undef DEF_VISIT
};
-
-
-// Determine whether to use the full compiler for all code. If the flag
-// --always-full-compiler is specified this is the case. For the virtual
frame
-// based compiler the full compiler is also used if a debugger is
connected, as
-// the code from the full compiler supports mode precise break points. For
the
-// crankshaft adaptive compiler debugging the optimized code is not
possible at
-// all. However crankshaft support recompilation of functions, so in this
case
-// the full compiler need not be be used if a debugger is attached, but
only if
-// break points has actually been set.
-static bool IsDebuggerActive(Isolate* isolate) {
- return isolate->use_crankshaft() ?
- isolate->debug()->has_break_points() :
- isolate->debugger()->IsDebuggerActive();
-}
OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
@@ -311,7 +296,9 @@
// to use the Hydrogen-based optimizing compiler. We already have
// generated code for this from the shared function object.
if (FLAG_always_full_compiler) return AbortOptimization();
- if (IsDebuggerActive(isolate())) return
AbortOptimization(kDebuggerIsActive);
+
+ // Do not use crankshaft if compiling for debugging.
+ if (info()->is_debug()) return AbortOptimization(kDebuggerIsActive);
// Limit the number of times we re-compile a functions with
// the optimizing compiler.
@@ -711,6 +698,8 @@
Isolate* isolate = info.isolate();
VMState<COMPILER> state(isolate);
+ info.MarkAsDebug();
+
ASSERT(!isolate->has_pending_exception());
Handle<Code> old_code(function->shared()->code());
ASSERT(old_code->kind() == Code::FUNCTION);
=======================================
--- /branches/bleeding_edge/src/compiler.h Mon May 12 07:49:11 2014 UTC
+++ /branches/bleeding_edge/src/compiler.h Mon May 12 13:47:01 2014 UTC
@@ -50,7 +50,6 @@
bool is_eval() const { return IsEval::decode(flags_); }
bool is_global() const { return IsGlobal::decode(flags_); }
StrictMode strict_mode() const { return StrictModeField::decode(flags_);
}
- bool is_in_loop() const { return IsInLoop::decode(flags_); }
FunctionLiteral* function() const { return function_; }
Scope* scope() const { return scope_; }
Scope* global_scope() const { return global_scope_; }
@@ -95,10 +94,6 @@
ASSERT(this->strict_mode() == SLOPPY || this->strict_mode() ==
strict_mode);
flags_ = StrictModeField::update(flags_, strict_mode);
}
- void MarkAsInLoop() {
- ASSERT(is_lazy());
- flags_ |= IsInLoop::encode(true);
- }
void MarkAsNative() {
flags_ |= IsNative::encode(true);
}
@@ -150,6 +145,18 @@
bool GetMustNotHaveEagerFrame() const {
return MustNotHaveEagerFrame::decode(flags_);
}
+
+ void MarkAsDebug() {
+ flags_ |= IsDebug::encode(true);
+ }
+
+ bool is_debug() const {
+ return IsDebug::decode(flags_);
+ }
+
+ bool IsCodePreAgingActive() const {
+ return FLAG_optimize_for_size && FLAG_age_code && !is_debug();
+ }
void SetParseRestriction(ParseRestriction restriction) {
flags_ = ParseRestricitonField::update(flags_, restriction);
@@ -353,8 +360,8 @@
// Flags that can be set for eager compilation.
class IsEval: public BitField<bool, 1, 1> {};
class IsGlobal: public BitField<bool, 2, 1> {};
- // Flags that can be set for lazy compilation.
- class IsInLoop: public BitField<bool, 3, 1> {};
+ // If the function is being compiled for the debugger.
+ class IsDebug: public BitField<bool, 3, 1> {};
// Strict mode - used in eager compilation.
class StrictModeField: public BitField<StrictMode, 4, 1> {};
// Is this a function from our natives.
=======================================
--- /branches/bleeding_edge/src/debug.cc Fri May 9 09:24:32 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc Mon May 12 13:47:01 2014 UTC
@@ -766,11 +766,9 @@
// Bail out if we're already in the process of compiling the native
// JavaScript source code for the debugger.
- if (debugger->compiling_natives() ||
- debugger->is_loading_debugger())
- return false;
- debugger->set_loading_debugger(true);
+ if (debugger->ignore_debugger()) return false;
+ Debugger::IgnoreScope during_load(debugger);
// Disable breakpoints and interrupts while compiling and running the
// debugger scripts including the context creation code.
DisableBreak disable(isolate_, true);
@@ -806,7 +804,6 @@
false);
// Compile the JavaScript for the debugger in the debugger context.
- debugger->set_compiling_natives(true);
bool caught_exception =
!CompileDebuggerScript(isolate_, Natives::GetIndex("mirror")) ||
!CompileDebuggerScript(isolate_, Natives::GetIndex("debug"));
@@ -815,12 +812,9 @@
caught_exception = caught_exception ||
!CompileDebuggerScript(isolate_, Natives::GetIndex("liveedit"));
}
-
- debugger->set_compiling_natives(false);
// Make sure we mark the debugger as not loading before we might
// return.
- debugger->set_loading_debugger(false);
// Check for caught exceptions.
if (caught_exception) return false;
@@ -1998,37 +1992,15 @@
};
-class ForceDebuggerActive {
- public:
- explicit ForceDebuggerActive(Isolate *isolate) {
- isolate_ = isolate;
- old_state_ = isolate->debugger()->force_debugger_active();
- isolate_->debugger()->set_force_debugger_active(true);
- }
-
- ~ForceDebuggerActive() {
- isolate_->debugger()->set_force_debugger_active(old_state_);
- }
-
- private:
- Isolate *isolate_;
- bool old_state_;
-
- DISALLOW_COPY_AND_ASSIGN(ForceDebuggerActive);
-};
-
-
void Debug::EnsureFunctionHasDebugBreakSlots(Handle<JSFunction> function) {
if (function->code()->kind() == Code::FUNCTION &&
function->code()->has_debug_break_slots()) {
// Nothing to do. Function code already had debug break slots.
return;
}
-
// Make sure that the shared full code is compiled with debug
// break slots.
if (!function->shared()->code()->has_debug_break_slots()) {
- ForceDebuggerActive force_debugger_active(isolate_);
MaybeHandle<Code> code = Compiler::GetCodeForDebugging(function);
// Recompilation can fail. In that case leave the code as it was.
if (!code.is_null()) function->ReplaceCode(*code.ToHandleChecked());
@@ -2652,14 +2624,12 @@
Debugger::Debugger(Isolate* isolate)
- : debugger_access_(isolate->debugger_access()),
- event_listener_(Handle<Object>()),
+ : event_listener_(Handle<Object>()),
event_listener_data_(Handle<Object>()),
- compiling_natives_(false),
- is_loading_debugger_(false),
+ is_active_(false),
+ ignore_debugger_(false),
live_edit_enabled_(true),
never_unload_debugger_(false),
- force_debugger_active_(false),
message_handler_(NULL),
debugger_unload_pending_(false),
debug_message_dispatch_handler_(NULL),
@@ -2760,7 +2730,7 @@
// Bail out based on state or if there is no listener for this event
if (debug->InDebugger()) return;
- if (!Debugger::EventActive(v8::Exception)) return;
+ if (!Debugger::EventActive()) return;
Handle<Object> promise = debug->GetPromiseForUncaughtException();
uncaught |= !promise->IsUndefined();
@@ -2804,7 +2774,7 @@
ASSERT(isolate_->context() == *isolate_->debug()->debug_context());
// Bail out if there is no listener for this event
- if (!Debugger::EventActive(v8::Break)) return;
+ if (!Debugger::EventActive()) return;
// Debugger must be entered in advance.
ASSERT(isolate_->context() == *isolate_->debug()->debug_context());
@@ -2826,8 +2796,7 @@
// Bail out based on state or if there is no listener for this event
if (isolate_->debug()->InDebugger()) return;
- if (compiling_natives()) return;
- if (!EventActive(v8::BeforeCompile)) return;
+ if (!EventActive()) return;
// Enter the debugger.
EnterDebugger debugger(isolate_);
@@ -2855,10 +2824,7 @@
debug->AddScriptToScriptCache(script);
// No more to do if not debugging.
- if (!IsDebuggerActive()) return;
-
- // No compile events while compiling natives.
- if (compiling_natives()) return;
+ if (!Debugger::EventActive()) return;
// Store whether in debugger before entering debugger.
bool in_debugger = debug->InDebugger();
@@ -2897,7 +2863,6 @@
}
// Bail out based on state or if there is no listener for this event
if (in_debugger && (after_compile_flags & SEND_WHEN_DEBUGGING) == 0)
return;
- if (!Debugger::EventActive(v8::AfterCompile)) return;
// Create the compile state object.
Handle<Object> event_data;
@@ -2914,8 +2879,7 @@
// No more to do if not debugging.
if (isolate_->debug()->InDebugger()) return;
- if (!IsDebuggerActive()) return;
- if (!Debugger::EventActive(v8::ScriptCollected)) return;
+ if (!Debugger::EventActive()) return;
// Enter the debugger.
EnterDebugger debugger(isolate_);
@@ -3129,7 +3093,7 @@
CommandMessage command = command_queue_.Get();
isolate_->logger()->DebugTag(
"Got request from command queue, in interactive loop.");
- if (!Debugger::IsDebuggerActive()) {
+ if (!Debugger::is_active()) {
// Delete command text and user data.
command.Dispose();
return;
@@ -3217,7 +3181,7 @@
void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
- LockGuard<RecursiveMutex> with(debugger_access_);
+ LockGuard<RecursiveMutex> with(&debugger_access_);
message_handler_ = handler;
ListenersChanged();
@@ -3232,8 +3196,9 @@
void Debugger::ListenersChanged() {
- bool active = IsDebuggerActive();
- if (active) {
+ LockGuard<RecursiveMutex> with(&debugger_access_);
+ is_active_ = message_handler_ != NULL || !event_listener_.is_null();
+ if (is_active_) {
// Disable the compilation cache when the debugger is active.
isolate_->compilation_cache()->Disable();
debugger_unload_pending_ = false;
@@ -3261,7 +3226,7 @@
// Calls the registered debug message handler. This callback is part of the
// public API.
void Debugger::InvokeMessageHandler(MessageImpl message) {
- LockGuard<RecursiveMutex> with(debugger_access_);
+ LockGuard<RecursiveMutex> with(&debugger_access_);
if (message_handler_ != NULL) {
message_handler_(message);
@@ -3317,15 +3282,6 @@
isolate_->stack_guard()->RequestDebugCommand();
}
}
-
-
-bool Debugger::IsDebuggerActive() {
- LockGuard<RecursiveMutex> with(debugger_access_);
-
- return message_handler_ != NULL ||
- !event_listener_.is_null() ||
- force_debugger_active_;
-}
MaybeHandle<Object> Debugger::Call(Handle<JSFunction> fun,
@@ -3478,7 +3434,7 @@
}
// If leaving the debugger with the debugger no longer active unload
it.
- if (!isolate_->debugger()->IsDebuggerActive()) {
+ if (!isolate_->debugger()->is_active()) {
isolate_->debugger()->UnloadDebugger();
}
}
=======================================
--- /branches/bleeding_edge/src/debug.h Fri May 9 09:24:32 2014 UTC
+++ /branches/bleeding_edge/src/debug.h Mon May 12 13:47:01 2014 UTC
@@ -822,45 +822,49 @@
void UnloadDebugger();
friend void ForceUnloadDebugger(); // In test-debug.cc
- inline bool EventActive(v8::DebugEvent event) {
- LockGuard<RecursiveMutex> lock_guard(debugger_access_);
+ inline bool EventActive() {
+ LockGuard<RecursiveMutex> lock_guard(&debugger_access_);
// Check whether the message handler was been cleared.
+ // TODO(yangguo): handle loading and unloading of the debugger
differently.
if (debugger_unload_pending_) {
if (isolate_->debug()->debugger_entry() == NULL) {
UnloadDebugger();
}
}
-
- if (((event == v8::BeforeCompile) || (event == v8::AfterCompile)) &&
- !FLAG_debug_compile_events) {
- return false;
-
- } else if ((event == v8::ScriptCollected) &&
- !FLAG_debug_script_collected_events) {
- return false;
- }
// Currently argument event is not used.
- return !compiling_natives_ && Debugger::IsDebuggerActive();
+ return !ignore_debugger_ && is_active_;
}
- void set_compiling_natives(bool compiling_natives) {
- compiling_natives_ = compiling_natives;
- }
- bool compiling_natives() const { return compiling_natives_; }
- void set_loading_debugger(bool v) { is_loading_debugger_ = v; }
- bool is_loading_debugger() const { return is_loading_debugger_; }
+ bool ignore_debugger() const { return ignore_debugger_; }
void set_live_edit_enabled(bool v) { live_edit_enabled_ = v; }
bool live_edit_enabled() const {
return FLAG_enable_liveedit && live_edit_enabled_ ;
}
- void set_force_debugger_active(bool force_debugger_active) {
- force_debugger_active_ = force_debugger_active;
+
+ bool is_active() {
+ LockGuard<RecursiveMutex> lock_guard(&debugger_access_);
+ return is_active_;
}
- bool force_debugger_active() const { return force_debugger_active_; }
+
+ class IgnoreScope {
+ public:
+ explicit IgnoreScope(Debugger* debugger)
+ : debugger_(debugger),
+ old_state_(debugger_->ignore_debugger_) {
+ debugger_->ignore_debugger_ = true;
+ }
+
+ ~IgnoreScope() {
+ debugger_->ignore_debugger_ = old_state_;
+ }
- bool IsDebuggerActive();
+ private:
+ Debugger* debugger_;
+ bool old_state_;
+ DISALLOW_COPY_AND_ASSIGN(IgnoreScope);
+ };
private:
explicit Debugger(Isolate* isolate);
@@ -878,14 +882,13 @@
Handle<Object> event_data);
void ListenersChanged();
- RecursiveMutex* debugger_access_; // Mutex guarding debugger variables.
+ RecursiveMutex debugger_access_; // Mutex guarding debugger variables.
Handle<Object> event_listener_; // Global handle to listener.
Handle<Object> event_listener_data_;
- bool compiling_natives_; // Are we compiling natives?
- bool is_loading_debugger_; // Are we loading the debugger?
+ bool is_active_;
+ bool ignore_debugger_; // Are we temporarily ignoring the debugger?
bool live_edit_enabled_; // Enable LiveEdit.
bool never_unload_debugger_; // Can we unload the debugger?
- bool force_debugger_active_; // Activate debugger without event
listeners.
v8::Debug::MessageHandler2 message_handler_;
bool debugger_unload_pending_; // Was message handler cleared?
=======================================
--- /branches/bleeding_edge/src/execution.cc Mon May 12 11:52:44 2014 UTC
+++ /branches/bleeding_edge/src/execution.cc Mon May 12 13:47:01 2014 UTC
@@ -104,7 +104,7 @@
if (has_exception) {
isolate->ReportPendingMessages();
// Reset stepping state when script exits with uncaught exception.
- if (isolate->debugger()->IsDebuggerActive()) {
+ if (isolate->debugger()->is_active()) {
isolate->debug()->ClearStepping();
}
return MaybeHandle<Object>();
@@ -685,7 +685,7 @@
if (isolate->bootstrapper()->IsActive()) return;
// Ignore debug break if debugger is not active.
- if (!isolate->debugger()->IsDebuggerActive()) return;
+ if (!isolate->debugger()->is_active()) return;
StackLimitCheck check(isolate);
if (check.HasOverflowed()) return;
=======================================
--- /branches/bleeding_edge/src/factory.cc Fri May 9 17:59:15 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc Mon May 12 13:47:01 2014 UTC
@@ -1395,7 +1395,8 @@
Handle<Object> self_ref,
bool immovable,
bool crankshafted,
- int prologue_offset) {
+ int prologue_offset,
+ bool is_debug) {
Handle<ByteArray> reloc_info = NewByteArray(desc.reloc_size, TENURED);
Handle<ConstantPoolArray> constant_pool =
desc.origin->NewConstantPool(isolate());
@@ -1427,14 +1428,15 @@
if (code->kind() == Code::OPTIMIZED_FUNCTION) {
code->set_marked_for_deoptimization(false);
}
+
+ if (is_debug) {
+ ASSERT(code->kind() == Code::FUNCTION);
+ code->set_has_debug_break_slots(true);
+ }
desc.origin->PopulateConstantPool(*constant_pool);
code->set_constant_pool(*constant_pool);
- if (code->kind() == Code::FUNCTION) {
-
code->set_has_debug_break_slots(isolate()->debugger()->IsDebuggerActive());
- }
-
// Allow self references to created code object by patching the handle to
// point to the newly allocated Code object.
if (!self_ref.is_null()) *(self_ref.location()) = *code;
=======================================
--- /branches/bleeding_edge/src/factory.h Fri May 9 17:59:15 2014 UTC
+++ /branches/bleeding_edge/src/factory.h Mon May 12 13:47:01 2014 UTC
@@ -489,7 +489,8 @@
Handle<Object> self_reference,
bool immovable = false,
bool crankshafted = false,
- int prologue_offset = Code::kPrologueOffsetNotSet);
+ int prologue_offset = Code::kPrologueOffsetNotSet,
+ bool is_debug = false);
Handle<Code> CopyCode(Handle<Code> code);
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Mon May 12 09:25:32 2014
UTC
+++ /branches/bleeding_edge/src/flag-definitions.h Mon May 12 13:47:01 2014
UTC
@@ -671,17 +671,6 @@
DEFINE_args(js_arguments,
"Pass all remaining arguments to the script. Alias for
\"--\".")
-#if defined(WEBOS__)
-DEFINE_bool(debug_compile_events, false, "Enable debugger compile events")
-DEFINE_bool(debug_script_collected_events, false,
- "Enable debugger script collected events")
-#else
-DEFINE_bool(debug_compile_events, true, "Enable debugger compile events")
-DEFINE_bool(debug_script_collected_events, true,
- "Enable debugger script collected events")
-#endif
-
-
//
// GDB JIT integration flags.
//
=======================================
--- /branches/bleeding_edge/src/frames.h Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/frames.h Mon May 12 13:47:01 2014 UTC
@@ -930,13 +930,6 @@
};
-// Used specify the type of prologue to generate.
-enum PrologueFrameMode {
- BUILD_FUNCTION_FRAME,
- BUILD_STUB_FRAME
-};
-
-
// Reads all frames on the current stack and copies them into the current
// zone memory.
Vector<StackFrame*> CreateStackMap(Isolate* isolate, Zone* zone);
=======================================
--- /branches/bleeding_edge/src/full-codegen.cc Wed Apr 30 12:33:16 2014 UTC
+++ /branches/bleeding_edge/src/full-codegen.cc Mon May 12 13:47:01 2014 UTC
@@ -805,7 +805,7 @@
void FullCodeGenerator::SetStatementPosition(Statement* stmt) {
- if (!isolate()->debugger()->IsDebuggerActive()) {
+ if (!info_->is_debug()) {
CodeGenerator::RecordPositions(masm_, stmt->position());
} else {
// Check if the statement will be breakable without adding a debug
break
@@ -827,7 +827,7 @@
void FullCodeGenerator::SetExpressionPosition(Expression* expr) {
- if (!isolate()->debugger()->IsDebuggerActive()) {
+ if (!info_->is_debug()) {
CodeGenerator::RecordPositions(masm_, expr->position());
} else {
// Check if the expression will be breakable without adding a debug
break
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Mon May 12
07:49:11 2014 UTC
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Mon May 12
13:47:01 2014 UTC
@@ -157,7 +157,8 @@
FrameScope frame_scope(masm_, StackFrame::MANUAL);
info->set_prologue_offset(masm_->pc_offset());
- __ Prologue(BUILD_FUNCTION_FRAME);
+ ASSERT(!info->IsStub());
+ __ Prologue(info);
info->AddNoFrameRange(0, masm_->pc_offset());
{ Comment cmnt(masm_, "[ Allocate locals");
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Fri May 9
13:01:50 2014 UTC
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon May 12
13:47:01 2014 UTC
@@ -188,7 +188,7 @@
if (NeedsEagerFrame()) {
ASSERT(!frame_is_built_);
frame_is_built_ = true;
- __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME :
BUILD_FUNCTION_FRAME);
+ __ Prologue(info());
info()->AddNoFrameRange(0, masm_->pc_offset());
}
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Fri May 9
16:18:58 2014 UTC
+++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.cc Mon May 12
13:47:01 2014 UTC
@@ -908,8 +908,8 @@
}
-void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
- if (frame_mode == BUILD_STUB_FRAME) {
+void MacroAssembler::Prologue(CompilationInfo* info) {
+ if (info->IsStub()) {
push(ebp); // Caller's frame pointer.
mov(ebp, esp);
push(esi); // Callee's context.
@@ -917,7 +917,7 @@
} else {
PredictableCodeSizeScope predictible_code_size_scope(this,
kNoCodeAgeSequenceLength);
- if (isolate()->IsCodePreAgingActive()) {
+ if (info->IsCodePreAgingActive()) {
// Pre-age the code.
call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
RelocInfo::CODE_AGE_SEQUENCE);
=======================================
--- /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Fri May 9
16:18:58 2014 UTC
+++ /branches/bleeding_edge/src/ia32/macro-assembler-ia32.h Mon May 12
13:47:01 2014 UTC
@@ -204,7 +204,7 @@
void DebugBreak();
// Generates function and stub prologue code.
- void Prologue(PrologueFrameMode frame_mode);
+ void Prologue(CompilationInfo* info);
// Enter specific kind of exit frame. Expects the number of
// arguments in register eax and sets up the number of arguments in
=======================================
--- /branches/bleeding_edge/src/isolate-inl.h Mon May 5 07:10:38 2014 UTC
+++ /branches/bleeding_edge/src/isolate-inl.h Mon May 12 13:47:01 2014 UTC
@@ -23,16 +23,6 @@
c_entry_fp_ = isolate->c_entry_fp(isolate->thread_local_top());
}
-
-
-bool Isolate::IsCodePreAgingActive() {
- return FLAG_optimize_for_size && FLAG_age_code && !IsDebuggerActive();
-}
-
-
-bool Isolate::IsDebuggerActive() {
- return debugger()->IsDebuggerActive();
-}
bool Isolate::DebuggerHasBreakPoints() {
=======================================
--- /branches/bleeding_edge/src/isolate.h Fri May 9 09:13:12 2014 UTC
+++ /branches/bleeding_edge/src/isolate.h Mon May 12 13:47:01 2014 UTC
@@ -511,9 +511,6 @@
// Mutex for serializing access to break control structures.
RecursiveMutex* break_access() { return &break_access_; }
-
- // Mutex for serializing access to debugger.
- RecursiveMutex* debugger_access() { return &debugger_access_; }
Address get_address_from_id(AddressId id);
@@ -929,13 +926,10 @@
interp_canonicalize_mapping() {
return &interp_canonicalize_mapping_;
}
-
- inline bool IsCodePreAgingActive();
Debugger* debugger() { return debugger_; }
Debug* debug() { return debug_; }
- inline bool IsDebuggerActive();
inline bool DebuggerHasBreakPoints();
CpuProfiler* cpu_profiler() const { return cpu_profiler_; }
@@ -1194,7 +1188,6 @@
CodeRange* code_range_;
RecursiveMutex break_access_;
Atomic32 debugger_initialized_;
- RecursiveMutex debugger_access_;
Logger* logger_;
StackGuard stack_guard_;
StatsTable* stats_table_;
=======================================
--- /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon May 12
07:49:11 2014 UTC
+++ /branches/bleeding_edge/src/mips/full-codegen-mips.cc Mon May 12
13:47:01 2014 UTC
@@ -176,7 +176,8 @@
FrameScope frame_scope(masm_, StackFrame::MANUAL);
info->set_prologue_offset(masm_->pc_offset());
- __ Prologue(BUILD_FUNCTION_FRAME);
+ ASSERT(!info->IsStub());
+ __ Prologue(info);
info->AddNoFrameRange(0, masm_->pc_offset());
{ Comment cmnt(masm_, "[ Allocate locals");
@@ -353,7 +354,7 @@
void FullCodeGenerator::EmitProfilingCounterReset() {
int reset_value = FLAG_interrupt_budget;
- if (isolate()->IsDebuggerActive()) {
+ if (info_->is_debug()) {
// Detect debug break requests as soon as possible.
reset_value = FLAG_interrupt_budget >> 4;
}
=======================================
--- /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Fri May 9
15:49:42 2014 UTC
+++ /branches/bleeding_edge/src/mips/lithium-codegen-mips.cc Mon May 12
13:47:01 2014 UTC
@@ -162,7 +162,7 @@
info()->set_prologue_offset(masm_->pc_offset());
if (NeedsEagerFrame()) {
- __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME :
BUILD_FUNCTION_FRAME);
+ __ Prologue(info());
frame_is_built_ = true;
info_->AddNoFrameRange(0, masm_->pc_offset());
}
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Fri May 9
17:39:04 2014 UTC
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.cc Mon May 12
13:47:01 2014 UTC
@@ -4452,8 +4452,8 @@
}
-void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
- if (frame_mode == BUILD_STUB_FRAME) {
+void MacroAssembler::Prologue(CompilationInfo* info) {
+ if (info->IsStub()) {
Push(ra, fp, cp);
Push(Smi::FromInt(StackFrame::STUB));
// Adjust FP to point to saved FP.
@@ -4463,7 +4463,7 @@
this, kNoCodeAgeSequenceLength);
// The following three instructions must remain together and unmodified
// for code aging to work properly.
- if (isolate()->IsCodePreAgingActive()) {
+ if (info->IsCodePreAgingActive()) {
// Pre-age the code.
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
nop(Assembler::CODE_AGE_MARKER_NOP);
=======================================
--- /branches/bleeding_edge/src/mips/macro-assembler-mips.h Fri May 9
17:39:04 2014 UTC
+++ /branches/bleeding_edge/src/mips/macro-assembler-mips.h Mon May 12
13:47:01 2014 UTC
@@ -1492,7 +1492,7 @@
}
// Generates function and stub prologue code.
- void Prologue(PrologueFrameMode frame_mode);
+ void Prologue(CompilationInfo* info);
// Activation support.
void EnterFrame(StackFrame::Type type);
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon May 12 12:05:00 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Mon May 12 13:47:01 2014 UTC
@@ -5609,7 +5609,7 @@
// to a built-in function such as Array.forEach.
RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) {
ASSERT(args.length() == 1);
- if (!isolate->IsDebuggerActive() || !isolate->debug()->StepInActive()) {
+ if (!isolate->debugger()->is_active() |
| !isolate->debug()->StepInActive()) {
return isolate->heap()->false_value();
}
CONVERT_ARG_CHECKED(Object, callback, 0);
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Mon May 12 07:49:11
2014 UTC
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Mon May 12 13:47:01
2014 UTC
@@ -157,7 +157,8 @@
FrameScope frame_scope(masm_, StackFrame::MANUAL);
info->set_prologue_offset(masm_->pc_offset());
- __ Prologue(BUILD_FUNCTION_FRAME);
+ ASSERT(!info->IsStub());
+ __ Prologue(info);
info->AddNoFrameRange(0, masm_->pc_offset());
{ Comment cmnt(masm_, "[ Allocate locals");
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Fri May 9
08:28:25 2014 UTC
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Mon May 12
13:47:01 2014 UTC
@@ -149,7 +149,7 @@
if (NeedsEagerFrame()) {
ASSERT(!frame_is_built_);
frame_is_built_ = true;
- __ Prologue(info()->IsStub() ? BUILD_STUB_FRAME :
BUILD_FUNCTION_FRAME);
+ __ Prologue(info());
info()->AddNoFrameRange(0, masm_->pc_offset());
}
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Fri May 9
16:18:58 2014 UTC
+++ /branches/bleeding_edge/src/x64/macro-assembler-x64.cc Mon May 12
13:47:01 2014 UTC
@@ -3889,8 +3889,8 @@
}
-void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
- if (frame_mode == BUILD_STUB_FRAME) {
+void MacroAssembler::Prologue(CompilationInfo* info) {
+ if (info->IsStub()) {
pushq(rbp); // Caller's frame pointer.
movp(rbp, rsp);
Push(rsi); // Callee's context.
@@ -3898,7 +3898,7 @@
} else {
PredictableCodeSizeScope predictible_code_size_scope(this,
kNoCodeAgeSequenceLength);
- if (isolate()->IsCodePreAgingActive()) {
+ if (info->IsCodePreAgingActive()) {
// Pre-age the code.
Call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
RelocInfo::CODE_AGE_SEQUENCE);
=======================================
--- /branches/bleeding_edge/src/x64/macro-assembler-x64.h Fri May 9
16:18:58 2014 UTC
+++ /branches/bleeding_edge/src/x64/macro-assembler-x64.h Mon May 12
13:47:01 2014 UTC
@@ -274,7 +274,7 @@
void DebugBreak();
// Generates function and stub prologue code.
- void Prologue(PrologueFrameMode frame_mode);
+ void Prologue(CompilationInfo* info);
// Enter specific kind of exit frame; either in normal or
// debug mode. Expects the number of arguments in register rax and
=======================================
--- /branches/bleeding_edge/test/cctest/test-heap.cc Fri May 9 16:39:33
2014 UTC
+++ /branches/bleeding_edge/test/cctest/test-heap.cc Mon May 12 13:47:01
2014 UTC
@@ -3947,7 +3947,8 @@
i::byte buffer[i::Assembler::kMinimalBufferSize];
MacroAssembler masm(isolate, buffer, sizeof(buffer));
CodeDesc desc;
- masm.Prologue(BUILD_FUNCTION_FRAME);
+ masm.Push(isolate->factory()->undefined_value());
+ masm.Drop(1);
masm.GetCode(&desc);
Handle<Object> undefined(isolate->heap()->undefined_value(), isolate);
Handle<Code> code = isolate->factory()->NewCode(
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.