Avoid pre-aging when debugger is active

BUG=None
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/47023003

Patch from Ross McIlroy <rmcilroy@chromium.org>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17443 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 316271fc
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "codegen.h" #include "codegen.h"
#include "cpu-profiler.h" #include "cpu-profiler.h"
#include "debug.h" #include "debug.h"
#include "isolate-inl.h"
#include "runtime.h" #include "runtime.h"
namespace v8 { namespace v8 {
...@@ -926,7 +927,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { ...@@ -926,7 +927,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); this, kNoCodeAgeSequenceLength * Assembler::kInstrSize);
// The following three instructions must remain together and unmodified // The following three instructions must remain together and unmodified
// for code aging to work properly. // for code aging to work properly.
if (FLAG_optimize_for_size && FLAG_age_code) { if (isolate()->IsCodePreAgingActive()) {
// Pre-age the code. // Pre-age the code.
Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
add(r0, pc, Operand(-8)); add(r0, pc, Operand(-8));
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "codegen.h" #include "codegen.h"
#include "cpu-profiler.h" #include "cpu-profiler.h"
#include "debug.h" #include "debug.h"
#include "isolate-inl.h"
#include "runtime.h" #include "runtime.h"
#include "serialize.h" #include "serialize.h"
...@@ -1022,7 +1023,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { ...@@ -1022,7 +1023,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
} else { } else {
PredictableCodeSizeScope predictible_code_size_scope(this, PredictableCodeSizeScope predictible_code_size_scope(this,
kNoCodeAgeSequenceLength); kNoCodeAgeSequenceLength);
if (FLAG_optimize_for_size && FLAG_age_code) { if (isolate()->IsCodePreAgingActive()) {
// Pre-age the code. // Pre-age the code.
call(isolate()->builtins()->MarkCodeAsExecutedOnce(), call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
RelocInfo::CODE_AGE_SEQUENCE); RelocInfo::CODE_AGE_SEQUENCE);
......
...@@ -48,6 +48,11 @@ SaveContext::SaveContext(Isolate* isolate) ...@@ -48,6 +48,11 @@ SaveContext::SaveContext(Isolate* isolate)
} }
bool Isolate::IsCodePreAgingActive() {
return FLAG_optimize_for_size && FLAG_age_code && !IsDebuggerActive();
}
bool Isolate::IsDebuggerActive() { bool Isolate::IsDebuggerActive() {
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT
if (!NoBarrier_Load(&debugger_initialized_)) return false; if (!NoBarrier_Load(&debugger_initialized_)) return false;
......
...@@ -994,6 +994,8 @@ class Isolate { ...@@ -994,6 +994,8 @@ class Isolate {
void PreallocatedStorageDelete(void* p); void PreallocatedStorageDelete(void* p);
void PreallocatedStorageInit(size_t size); void PreallocatedStorageInit(size_t size);
inline bool IsCodePreAgingActive();
#ifdef ENABLE_DEBUGGER_SUPPORT #ifdef ENABLE_DEBUGGER_SUPPORT
Debugger* debugger() { Debugger* debugger() {
if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger(); if (!NoBarrier_Load(&debugger_initialized_)) InitializeDebugger();
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "codegen.h" #include "codegen.h"
#include "cpu-profiler.h" #include "cpu-profiler.h"
#include "debug.h" #include "debug.h"
#include "isolate-inl.h"
#include "runtime.h" #include "runtime.h"
namespace v8 { namespace v8 {
...@@ -4596,7 +4597,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { ...@@ -4596,7 +4597,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
this, kNoCodeAgeSequenceLength * Assembler::kInstrSize); this, kNoCodeAgeSequenceLength * Assembler::kInstrSize);
// The following three instructions must remain together and unmodified // The following three instructions must remain together and unmodified
// for code aging to work properly. // for code aging to work properly.
if (FLAG_optimize_for_size && FLAG_age_code) { if (isolate()->IsCodePreAgingActive()) {
// Pre-age the code. // Pre-age the code.
Code* stub = Code::GetPreAgedCodeAgeStub(isolate()); Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
nop(Assembler::CODE_AGE_MARKER_NOP); nop(Assembler::CODE_AGE_MARKER_NOP);
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "serialize.h" #include "serialize.h"
#include "debug.h" #include "debug.h"
#include "heap.h" #include "heap.h"
#include "isolate-inl.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -3659,7 +3660,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) { ...@@ -3659,7 +3660,7 @@ void MacroAssembler::Prologue(PrologueFrameMode frame_mode) {
} else { } else {
PredictableCodeSizeScope predictible_code_size_scope(this, PredictableCodeSizeScope predictible_code_size_scope(this,
kNoCodeAgeSequenceLength); kNoCodeAgeSequenceLength);
if (FLAG_optimize_for_size && FLAG_age_code) { if (isolate()->IsCodePreAgingActive()) {
// Pre-age the code. // Pre-age the code.
Call(isolate()->builtins()->MarkCodeAsExecutedOnce(), Call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
RelocInfo::CODE_AGE_SEQUENCE); RelocInfo::CODE_AGE_SEQUENCE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment