Commit 46aeea9d authored by sgjesse@chromium.org's avatar sgjesse@chromium.org

Revert r7909

r7909: Optimise the deoptimisation check to improve performance on modern ARM cores.

Assert failure on mozilla/ecma/Date/15.9.3.8-2 and mozilla/ecma/Date/15.9.3.8-4.

R=ricow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7916 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 92510704
...@@ -85,7 +85,6 @@ bool LCodeGen::GenerateCode() { ...@@ -85,7 +85,6 @@ bool LCodeGen::GenerateCode() {
return GeneratePrologue() && return GeneratePrologue() &&
GenerateBody() && GenerateBody() &&
GenerateDeferredCode() && GenerateDeferredCode() &&
GenerateDeoptJumpTable() &&
GenerateSafepointTable(); GenerateSafepointTable();
} }
...@@ -250,41 +249,13 @@ bool LCodeGen::GenerateDeferredCode() { ...@@ -250,41 +249,13 @@ bool LCodeGen::GenerateDeferredCode() {
__ jmp(code->exit()); __ jmp(code->exit());
} }
return !is_aborted(); // Force constant pool emission at the end of deferred code to make
}
bool LCodeGen::GenerateDeoptJumpTable() {
// Check that the jump table is accessible from everywhere in the function
// code, ie that offsets to the table can be encoded in the 24bit signed
// immediate of a branch instruction.
// To simplify we consider the code size from the first instruction to the
// end of the jump table. We also don't consider the pc load delta.
// Each entry in the jump table generates only one instruction.
if (!is_int24((masm()->pc_offset() / Assembler::kInstrSize) +
deopt_jump_table_.length())) {
Abort("Generated code is too large");
}
__ RecordComment("[ Deoptimisation jump table");
Label table_start;
__ bind(&table_start);
for (int i = 0; i < deopt_jump_table_.length(); i++) {
__ bind(&deopt_jump_table_[i].label);
__ mov(pc, Operand(reinterpret_cast<int32_t>(deopt_jump_table_[i].address),
RelocInfo::RUNTIME_ENTRY));
}
ASSERT(masm()->InstructionsGeneratedSince(&table_start) ==
deopt_jump_table_.length());
__ RecordComment("]");
// Force constant pool emission at the end of the jump table to make
// sure that no constant pools are emitted after the official end of // sure that no constant pools are emitted after the official end of
// the instruction sequence. // the instruction sequence.
masm()->CheckConstPool(true, false); masm()->CheckConstPool(true, false);
// The deoptimization jump table is the last part of the instruction // Deferred code is the last part of the instruction sequence. Mark
// sequence. Mark the generated code as done unless we bailed out. // the generated code as done unless we bailed out.
if (!is_aborted()) status_ = DONE; if (!is_aborted()) status_ = DONE;
return !is_aborted(); return !is_aborted();
} }
...@@ -624,18 +595,19 @@ void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) { ...@@ -624,18 +595,19 @@ void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) {
return; return;
} }
if (FLAG_trap_on_deopt) __ stop("trap_on_deopt", cc);
if (cc == al) { if (cc == al) {
if (FLAG_trap_on_deopt) __ stop("trap_on_deopt");
__ Jump(entry, RelocInfo::RUNTIME_ENTRY);
} else {
if (FLAG_trap_on_deopt) {
Label done;
__ b(&done, NegateCondition(cc));
__ stop("trap_on_deopt");
__ Jump(entry, RelocInfo::RUNTIME_ENTRY); __ Jump(entry, RelocInfo::RUNTIME_ENTRY);
__ bind(&done);
} else { } else {
// We often have several deopts to the same entry, reuse the last __ Jump(entry, RelocInfo::RUNTIME_ENTRY, cc);
// jump entry if this is the case.
if (deopt_jump_table_.is_empty() ||
(deopt_jump_table_.last().address != entry)) {
deopt_jump_table_.Add(JumpTableEntry(entry));
} }
__ b(cc, &deopt_jump_table_.last().label);
} }
} }
......
...@@ -51,7 +51,6 @@ class LCodeGen BASE_EMBEDDED { ...@@ -51,7 +51,6 @@ class LCodeGen BASE_EMBEDDED {
current_instruction_(-1), current_instruction_(-1),
instructions_(chunk->instructions()), instructions_(chunk->instructions()),
deoptimizations_(4), deoptimizations_(4),
deopt_jump_table_(4),
deoptimization_literals_(8), deoptimization_literals_(8),
inlined_function_count_(0), inlined_function_count_(0),
scope_(info->scope()), scope_(info->scope()),
...@@ -173,7 +172,6 @@ class LCodeGen BASE_EMBEDDED { ...@@ -173,7 +172,6 @@ class LCodeGen BASE_EMBEDDED {
bool GeneratePrologue(); bool GeneratePrologue();
bool GenerateBody(); bool GenerateBody();
bool GenerateDeferredCode(); bool GenerateDeferredCode();
bool GenerateDeoptJumpTable();
bool GenerateSafepointTable(); bool GenerateSafepointTable();
enum SafepointMode { enum SafepointMode {
...@@ -291,14 +289,6 @@ class LCodeGen BASE_EMBEDDED { ...@@ -291,14 +289,6 @@ class LCodeGen BASE_EMBEDDED {
Handle<Map> type, Handle<Map> type,
Handle<String> name); Handle<String> name);
struct JumpTableEntry {
explicit inline JumpTableEntry(Address entry)
: label(),
address(entry) { }
Label label;
Address address;
};
LChunk* const chunk_; LChunk* const chunk_;
MacroAssembler* const masm_; MacroAssembler* const masm_;
CompilationInfo* const info_; CompilationInfo* const info_;
...@@ -307,7 +297,6 @@ class LCodeGen BASE_EMBEDDED { ...@@ -307,7 +297,6 @@ class LCodeGen BASE_EMBEDDED {
int current_instruction_; int current_instruction_;
const ZoneList<LInstruction*>* instructions_; const ZoneList<LInstruction*>* instructions_;
ZoneList<LEnvironment*> deoptimizations_; ZoneList<LEnvironment*> deoptimizations_;
ZoneList<JumpTableEntry> deopt_jump_table_;
ZoneList<Handle<Object> > deoptimization_literals_; ZoneList<Handle<Object> > deoptimization_literals_;
int inlined_function_count_; int inlined_function_count_;
Scope* const scope_; Scope* const scope_;
......
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