Reviewers: ulan,
Message:
Last fix required before ool constant pool can run cleanly through the check
tests. PTAL.
Description:
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.
Please review this at https://codereview.chromium.org/226503003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+32, -7 lines):
M src/arm/code-stubs-arm.cc
M src/arm/full-codegen-arm.cc
M src/arm/lithium-codegen-arm.h
M src/arm/lithium-codegen-arm.cc
M src/arm/macro-assembler-arm.h
M src/arm/macro-assembler-arm.cc
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index
81691a347f9b2fb2c6e380385f676c2b230b99b0..a3d740bea65ba57d03f47e8f89fe0309f0335a37
100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -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);
Index: src/arm/full-codegen-arm.cc
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index
4ea2942f4df3b5690ef784ca6fc578b12738d74c..ba5053f95ab8e1618f70b104bb9aa884f1abb2a8
100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -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);
}
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index
a19f3aec4643ca704f88ead6baf626cad54ae31c..b20c0e557de0da3ffef1ea2c910ee07e5c959c50
100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -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());
Index: src/arm/lithium-codegen-arm.h
diff --git a/src/arm/lithium-codegen-arm.h b/src/arm/lithium-codegen-arm.h
index
38843f1719c173ed3ea687f5f3919dba6ab83747..4d1a8967eb132adffb380be829e7ea4ad682d52e
100644
--- a/src/arm/lithium-codegen-arm.h
+++ b/src/arm/lithium-codegen-arm.h
@@ -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,
Index: src/arm/macro-assembler-arm.cc
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
index
076c0429a3e30a57265209b42a23623cf3d30159..1633adc1331e203edbacf85a6419a81b02e13653
100644
--- a/src/arm/macro-assembler-arm.cc
+++ b/src/arm/macro-assembler-arm.cc
@@ -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;
Index: src/arm/macro-assembler-arm.h
diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h
index
9230df02c55769d21f4806778e037e19c3819726..c53669ee74c5450e5fa83e10f0f6fabc7bd41ba8
100644
--- a/src/arm/macro-assembler-arm.h
+++ b/src/arm/macro-assembler-arm.h
@@ -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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.