Introduce DontEmitDebugCodeScope to fix the x64 nosnapshot build.

R=yangguo@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20784 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
haitao.feng@intel.com 2014-04-16 02:06:14 +00:00
parent a2f7637332
commit 7ffbbbef3c
2 changed files with 31 additions and 8 deletions

View File

@ -107,6 +107,22 @@ class AssemblerBase: public Malloced {
}; };
// Avoids emitting debug code during the lifetime of this scope object.
class DontEmitDebugCodeScope BASE_EMBEDDED {
public:
explicit DontEmitDebugCodeScope(AssemblerBase* assembler)
: assembler_(assembler), old_value_(assembler->emit_debug_code()) {
assembler_->set_emit_debug_code(false);
}
~DontEmitDebugCodeScope() {
assembler_->set_emit_debug_code(old_value_);
};
private:
AssemblerBase* assembler_;
bool old_value_;
};
// Avoids using instructions that vary in size in unpredictable ways between the // Avoids using instructions that vary in size in unpredictable ways between the
// snapshot and the running VM. // snapshot and the running VM.
class PredictableCodeSizeScope { class PredictableCodeSizeScope {

View File

@ -363,6 +363,9 @@ void FullCodeGenerator::EmitProfilingCounterReset() {
} }
static const byte kJnsOffset = kPointerSize == kInt64Size ? 0x1d : 0x14;
void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt,
Label* back_edge_target) { Label* back_edge_target) {
Comment cmnt(masm_, "[ Back edge bookkeeping"); Comment cmnt(masm_, "[ Back edge bookkeeping");
@ -373,17 +376,22 @@ void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt,
int weight = Min(kMaxBackEdgeWeight, int weight = Min(kMaxBackEdgeWeight,
Max(1, distance / kCodeSizeMultiplier)); Max(1, distance / kCodeSizeMultiplier));
EmitProfilingCounterDecrement(weight); EmitProfilingCounterDecrement(weight);
__ j(positive, &ok, Label::kNear); __ j(positive, &ok, Label::kNear);
__ call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET); {
PredictableCodeSizeScope predictible_code_size_scope(masm_, kJnsOffset);
DontEmitDebugCodeScope dont_emit_debug_code_scope(masm_);
__ call(isolate()->builtins()->InterruptCheck(), RelocInfo::CODE_TARGET);
// Record a mapping of this PC offset to the OSR id. This is used to find // Record a mapping of this PC offset to the OSR id. This is used to find
// the AST id from the unoptimized code in order to use it as a key into // the AST id from the unoptimized code in order to use it as a key into
// the deoptimization input data found in the optimized code. // the deoptimization input data found in the optimized code.
RecordBackEdge(stmt->OsrEntryId()); RecordBackEdge(stmt->OsrEntryId());
EmitProfilingCounterReset();
EmitProfilingCounterReset();
}
__ bind(&ok); __ bind(&ok);
PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
// Record a mapping of the OSR id to this PC. This is used if the OSR // Record a mapping of the OSR id to this PC. This is used if the OSR
// entry becomes the target of a bailout. We don't expect it to be, but // entry becomes the target of a bailout. We don't expect it to be, but
@ -4844,7 +4852,6 @@ FullCodeGenerator::NestedStatement* FullCodeGenerator::TryFinally::Exit(
static const byte kJnsInstruction = 0x79; static const byte kJnsInstruction = 0x79;
static const byte kJnsOffset = kPointerSize == kInt64Size ? 0x1d : 0x14;
static const byte kNopByteOne = 0x66; static const byte kNopByteOne = 0x66;
static const byte kNopByteTwo = 0x90; static const byte kNopByteTwo = 0x90;
#ifdef DEBUG #ifdef DEBUG