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");
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;
}
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());
}
}
-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.
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));
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.
// 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.
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;
}
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());
}
}
-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();
__ 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 {
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.
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.
true);
ASSERT(isolate->has_pending_exception() != result);
if (!result) isolate->clear_pending_exception();
- isolate->debugger()->set_compiling_natives(false);
return result;
}
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,
}
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());
};
-// 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() {
ASSERT(isolate()->use_crankshaft());
ASSERT(info()->IsOptimizing());
// 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.
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);
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_; }
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);
}
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);
}
// 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.
// 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);
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"));
!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;
};
-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());
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),
// 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();
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());
// 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_);
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();
}
// 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;
// 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_);
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;
void Debugger::SetMessageHandler(v8::Debug::MessageHandler2 handler) {
- LockGuard<RecursiveMutex> with(debugger_access_);
+ LockGuard<RecursiveMutex> with(&debugger_access_);
message_handler_ = handler;
ListenersChanged();
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;
// 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);
}
-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,
Handle<Object> data) {
// When calling functions in the debugger prevent it from beeing unloaded.
}
// If leaving the debugger with the debugger no longer active unload it.
- if (!isolate_->debugger()->IsDebuggerActive()) {
+ if (!isolate_->debugger()->is_active()) {
isolate_->debugger()->UnloadDebugger();
}
}
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_; }
- bool IsDebuggerActive();
+ class IgnoreScope {
+ public:
+ explicit IgnoreScope(Debugger* debugger)
+ : debugger_(debugger),
+ old_state_(debugger_->ignore_debugger_) {
+ debugger_->ignore_debugger_ = true;
+ }
+
+ ~IgnoreScope() {
+ debugger_->ignore_debugger_ = old_state_;
+ }
+
+ private:
+ Debugger* debugger_;
+ bool old_state_;
+ DISALLOW_COPY_AND_ASSIGN(IgnoreScope);
+ };
private:
explicit Debugger(Isolate* isolate);
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?
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>();
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;
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());
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;
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);
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.
//
};
-// 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);
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
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
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");
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());
}
}
-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.
} 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);
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
}
-bool Isolate::IsCodePreAgingActive() {
- return FLAG_optimize_for_size && FLAG_age_code && !IsDebuggerActive();
-}
-
-
-bool Isolate::IsDebuggerActive() {
- return debugger()->IsDebuggerActive();
-}
-
-
bool Isolate::DebuggerHasBreakPoints() {
return debug()->has_break_points();
}
// 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);
// Access to top context (where the current function object was created).
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_; }
CodeRange* code_range_;
RecursiveMutex break_access_;
Atomic32 debugger_initialized_;
- RecursiveMutex debugger_access_;
Logger* logger_;
StackGuard stack_guard_;
StatsTable* stats_table_;
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");
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;
}
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());
}
}
-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.
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);
}
// Generates function and stub prologue code.
- void Prologue(PrologueFrameMode frame_mode);
+ void Prologue(CompilationInfo* info);
// Activation support.
void EnterFrame(StackFrame::Type type);
// 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);
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");
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());
}
}
-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.
} 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);
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
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(