Use correct call size for PredictableCodeSizeScopes.
If out-of-line constant pool is enabled, then calls can be 3 instructions rather than 2. Fix the hard-coded PredictableCodeSizeScopes values with values based on CallSize instead. R=ulan@chromium.org Review URL: https://codereview.chromium.org/226503003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20577 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
c9d8b90f1b
commit
c8df5f42a2
@ -4951,8 +4951,9 @@ void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
|
||||
|
||||
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
|
||||
if (masm->isolate()->function_entry_hook() != NULL) {
|
||||
PredictableCodeSizeScope predictable(masm, 4 * Assembler::kInstrSize);
|
||||
ProfileEntryHookStub stub;
|
||||
int code_size = masm->CallStubSize(&stub) + 2 * Assembler::kInstrSize;
|
||||
PredictableCodeSizeScope predictable(masm, code_size);
|
||||
__ push(lr);
|
||||
__ CallStub(&stub);
|
||||
__ pop(lr);
|
||||
|
@ -128,8 +128,10 @@ static void EmitStackCheck(MacroAssembler* masm_,
|
||||
__ LoadRoot(stack_limit_scratch, index);
|
||||
__ cmp(scratch, Operand(stack_limit_scratch));
|
||||
__ b(hs, &ok);
|
||||
PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize);
|
||||
__ Call(isolate->builtins()->StackCheck(), RelocInfo::CODE_TARGET);
|
||||
Handle<Code> stack_check = isolate->builtins()->StackCheck();
|
||||
PredictableCodeSizeScope predictable(masm_,
|
||||
masm_->CallSize(stack_check, RelocInfo::CODE_TARGET));
|
||||
__ Call(stack_check, RelocInfo::CODE_TARGET);
|
||||
__ bind(&ok);
|
||||
}
|
||||
|
||||
|
@ -714,6 +714,16 @@ void LCodeGen::AddToTranslation(LEnvironment* environment,
|
||||
}
|
||||
|
||||
|
||||
int LCodeGen::CallCodeSize(Handle<Code> code, RelocInfo::Mode mode) {
|
||||
int size = masm()->CallSize(code, mode);
|
||||
if (code->kind() == Code::BINARY_OP_IC ||
|
||||
code->kind() == Code::COMPARE_IC) {
|
||||
size += Assembler::kInstrSize; // extra nop() added in CallCodeGeneric.
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
void LCodeGen::CallCode(Handle<Code> code,
|
||||
RelocInfo::Mode mode,
|
||||
LInstruction* instr,
|
||||
@ -5672,12 +5682,12 @@ void LCodeGen::DoStackCheck(LStackCheck* instr) {
|
||||
__ LoadRoot(ip, Heap::kStackLimitRootIndex);
|
||||
__ cmp(sp, Operand(ip));
|
||||
__ b(hs, &done);
|
||||
PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize);
|
||||
Handle<Code> stack_check = isolate()->builtins()->StackCheck();
|
||||
PredictableCodeSizeScope predictable(masm(),
|
||||
CallCodeSize(stack_check, RelocInfo::CODE_TARGET));
|
||||
ASSERT(instr->context()->IsRegister());
|
||||
ASSERT(ToRegister(instr->context()).is(cp));
|
||||
CallCode(isolate()->builtins()->StackCheck(),
|
||||
RelocInfo::CODE_TARGET,
|
||||
instr);
|
||||
CallCode(stack_check, RelocInfo::CODE_TARGET, instr);
|
||||
__ bind(&done);
|
||||
} else {
|
||||
ASSERT(instr->hydrogen()->is_backwards_branch());
|
||||
|
@ -209,6 +209,8 @@ class LCodeGen: public LCodeGenBase {
|
||||
RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS
|
||||
};
|
||||
|
||||
int CallCodeSize(Handle<Code> code, RelocInfo::Mode mode);
|
||||
|
||||
void CallCode(
|
||||
Handle<Code> code,
|
||||
RelocInfo::Mode mode,
|
||||
|
@ -107,6 +107,13 @@ int MacroAssembler::CallSize(
|
||||
}
|
||||
|
||||
|
||||
int MacroAssembler::CallStubSize(
|
||||
CodeStub* stub, TypeFeedbackId ast_id, Condition cond) {
|
||||
return CallSize(
|
||||
stub->GetCode(isolate()), RelocInfo::CODE_TARGET, ast_id, cond);
|
||||
}
|
||||
|
||||
|
||||
int MacroAssembler::CallSizeNotPredictableCodeSize(
|
||||
Address target, RelocInfo::Mode rmode, Condition cond) {
|
||||
int size = 2 * kInstrSize;
|
||||
|
@ -102,6 +102,9 @@ class MacroAssembler: public Assembler {
|
||||
static int CallSize(Register target, Condition cond = al);
|
||||
void Call(Register target, Condition cond = al);
|
||||
int CallSize(Address target, RelocInfo::Mode rmode, Condition cond = al);
|
||||
int CallStubSize(CodeStub* stub,
|
||||
TypeFeedbackId ast_id = TypeFeedbackId::None(),
|
||||
Condition cond = al);
|
||||
static int CallSizeNotPredictableCodeSize(Address target,
|
||||
RelocInfo::Mode rmode,
|
||||
Condition cond = al);
|
||||
|
Loading…
Reference in New Issue
Block a user