Commit 612d6d32 authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Use the information from the last recorded safepoint for the padding after the deferrred code.

R=kmillikin@chromium.org

BUG=none
TEST=none

Review URL: http://codereview.chromium.org//7248077

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8543 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 57b7a67d
......@@ -257,29 +257,20 @@ LInstruction* LCodeGen::GetNextInstruction() {
bool LCodeGen::GenerateDeferredCode() {
ASSERT(is_generating());
Label last_jump;
if (deferred_.length() > 0) {
for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
LDeferredCode* code = deferred_[i];
__ bind(code->entry());
code->Generate();
#ifdef DEBUG
if (i == deferred_.length() - 1) {
__ bind(&last_jump);
}
#endif
__ jmp(code->exit());
}
// Reserve some space to ensure that the last piece of deferred code
// have room for lazy bailout.
__ nop();
__ nop();
int code_generated =
masm_->InstructionsGeneratedSince(&last_jump) * Assembler::kInstrSize;
ASSERT(Deoptimizer::patch_size() <= code_generated);
USE(code_generated);
// Pad code to ensure that the last piece of deferred code have
// room for lazy bailout.
while ((masm()->pc_offset() - LastSafepointEnd())
< Deoptimizer::patch_size()) {
__ nop();
}
}
// Force constant pool emission at the end of the deferred code to make
......
......@@ -255,28 +255,20 @@ LInstruction* LCodeGen::GetNextInstruction() {
bool LCodeGen::GenerateDeferredCode() {
ASSERT(is_generating());
Label last_jump;
if (deferred_.length() > 0) {
for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
LDeferredCode* code = deferred_[i];
__ bind(code->entry());
code->Generate();
#ifdef DEBUG
if (i == deferred_.length() - 1) {
__ bind(&last_jump);
}
#endif
__ jmp(code->exit());
}
// Reserve some space to ensure that the last piece of deferred code
// have room for lazy bailout.
__ nop();
__ nop();
__ nop();
ASSERT(Deoptimizer::patch_size() <=
masm_->SizeOfCodeGeneratedSince(&last_jump));
// Pad code to ensure that the last piece of deferred code have
// room for lazy bailout.
while ((masm()->pc_offset() - LastSafepointEnd())
< Deoptimizer::patch_size()) {
__ nop();
}
}
// Deferred code is the last part of the instruction sequence. Mark
......
......@@ -248,6 +248,9 @@ class LCodeGen BASE_EMBEDDED {
int arguments,
int deoptimization_index);
void RecordPosition(int position);
int LastSafepointEnd() {
return static_cast<int>(safepoints_.GetPcAfterGap());
}
static Condition TokenToCondition(Token::Value op, bool is_unsigned);
void EmitGoto(int block);
......
......@@ -275,34 +275,25 @@ bool LCodeGen::GenerateJumpTable() {
bool LCodeGen::GenerateDeferredCode() {
ASSERT(is_generating());
Label last_jump;
if (deferred_.length() > 0) {
for (int i = 0; !is_aborted() && i < deferred_.length(); i++) {
LDeferredCode* code = deferred_[i];
__ bind(code->entry());
code->Generate();
#ifdef DEBUG
if (i == (deferred_.length() - 1)) {
__ bind(&last_jump);
}
#endif
__ jmp(code->exit());
}
// Reserve some space to ensure that the last piece of deferred code
// have room for lazy bailout.
int padding =
Deoptimizer::patch_size() - masm_->SizeOfCodeGeneratedSince(&last_jump);
if (padding > 0) {
while (padding > 9) {
// Pad code to ensure that the last piece of deferred code have
// room for lazy bailout.
while ((masm()->pc_offset() - LastSafepointEnd())
< Deoptimizer::patch_size()) {
int padding = masm()->pc_offset() - LastSafepointEnd();
if (padding > 9) {
__ nop(9);
padding -= 9;
} else {
__ nop(padding);
}
__ nop(padding);
}
ASSERT(Deoptimizer::patch_size() <=
masm_->SizeOfCodeGeneratedSince(&last_jump));
}
// Deferred code is the last part of the instruction sequence. Mark
......
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