Ensure enough space for lazy deoptimization relocation information.
Was not done for runtime calls and for recursive calls. Only ia32 for now. We need to refactor x64 and look into arm as well. R=sgjesse@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/6728001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7331 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
1dc8f7edb3
commit
363ef7f750
@ -43,20 +43,16 @@ class SafepointGenerator : public PostCallGenerator {
|
||||
public:
|
||||
SafepointGenerator(LCodeGen* codegen,
|
||||
LPointerMap* pointers,
|
||||
int deoptimization_index,
|
||||
bool ensure_reloc_space = false)
|
||||
int deoptimization_index)
|
||||
: codegen_(codegen),
|
||||
pointers_(pointers),
|
||||
deoptimization_index_(deoptimization_index),
|
||||
ensure_reloc_space_(ensure_reloc_space) { }
|
||||
deoptimization_index_(deoptimization_index) {}
|
||||
virtual ~SafepointGenerator() { }
|
||||
|
||||
virtual void Generate() {
|
||||
// Ensure that we have enough space in the reloc info to patch
|
||||
// this with calls when doing deoptimization.
|
||||
if (ensure_reloc_space_) {
|
||||
codegen_->EnsureRelocSpaceForDeoptimization();
|
||||
}
|
||||
codegen_->EnsureRelocSpaceForDeoptimization();
|
||||
codegen_->RecordSafepoint(pointers_, deoptimization_index_);
|
||||
}
|
||||
|
||||
@ -64,7 +60,6 @@ class SafepointGenerator : public PostCallGenerator {
|
||||
LCodeGen* codegen_;
|
||||
LPointerMap* pointers_;
|
||||
int deoptimization_index_;
|
||||
bool ensure_reloc_space_;
|
||||
};
|
||||
|
||||
|
||||
@ -386,10 +381,10 @@ void LCodeGen::WriteTranslation(LEnvironment* environment,
|
||||
|
||||
|
||||
void LCodeGen::EnsureRelocSpaceForDeoptimization() {
|
||||
// Since we patch the reloc info with RUNTIME_ENTRY calls every patch
|
||||
// site will take up 2 bytes + any pc-jumps.
|
||||
// We are conservative and always reserver 6 bytes in case where a
|
||||
// simple pc-jump is not enough.
|
||||
// Since we patch the reloc info with RUNTIME_ENTRY calls every
|
||||
// patch site will take up 2 bytes + any pc-jumps. We are
|
||||
// conservative and always reserve 6 bytes in case a simple pc-jump
|
||||
// is not enough.
|
||||
uint32_t pc_delta =
|
||||
masm()->pc_offset() - deoptimization_reloc_size.last_pc_offset;
|
||||
if (is_uintn(pc_delta, 6)) {
|
||||
@ -479,6 +474,7 @@ void LCodeGen::CallRuntime(const Runtime::Function* fun,
|
||||
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||
}
|
||||
__ CallRuntime(fun, argc);
|
||||
EnsureRelocSpaceForDeoptimization();
|
||||
RegisterLazyDeoptimization(instr);
|
||||
}
|
||||
|
||||
@ -2369,8 +2365,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
|
||||
RegisterEnvironmentForDeoptimization(env);
|
||||
SafepointGenerator safepoint_generator(this,
|
||||
pointers,
|
||||
env->deoptimization_index(),
|
||||
true);
|
||||
env->deoptimization_index());
|
||||
v8::internal::ParameterCount actual(eax);
|
||||
__ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator);
|
||||
}
|
||||
@ -2442,8 +2437,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
||||
__ CallSelf();
|
||||
} else {
|
||||
__ call(FieldOperand(edi, JSFunction::kCodeEntryOffset));
|
||||
EnsureRelocSpaceForDeoptimization();
|
||||
}
|
||||
EnsureRelocSpaceForDeoptimization();
|
||||
|
||||
// Setup deoptimization.
|
||||
RegisterLazyDeoptimization(instr);
|
||||
@ -3971,8 +3966,7 @@ void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
|
||||
// builtin)
|
||||
SafepointGenerator safepoint_generator(this,
|
||||
pointers,
|
||||
env->deoptimization_index(),
|
||||
true);
|
||||
env->deoptimization_index());
|
||||
__ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
|
||||
__ push(Immediate(Smi::FromInt(strict_mode_flag())));
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator);
|
||||
|
@ -43,12 +43,10 @@ class SafepointGenerator : public CallWrapper {
|
||||
public:
|
||||
SafepointGenerator(LCodeGen* codegen,
|
||||
LPointerMap* pointers,
|
||||
int deoptimization_index,
|
||||
bool ensure_reloc_space = false)
|
||||
int deoptimization_index)
|
||||
: codegen_(codegen),
|
||||
pointers_(pointers),
|
||||
deoptimization_index_(deoptimization_index),
|
||||
ensure_reloc_space_(ensure_reloc_space) { }
|
||||
deoptimization_index_(deoptimization_index) { }
|
||||
virtual ~SafepointGenerator() { }
|
||||
|
||||
virtual void BeforeCall(int call_size) {
|
||||
@ -67,9 +65,7 @@ class SafepointGenerator : public CallWrapper {
|
||||
virtual void AfterCall() {
|
||||
// Ensure that we have enough space in the reloc info to patch
|
||||
// this with calls when doing deoptimization.
|
||||
if (ensure_reloc_space_) {
|
||||
codegen_->masm()->RecordComment(RelocInfo::kFillerCommentString, true);
|
||||
}
|
||||
codegen_->masm()->RecordComment(RelocInfo::kFillerCommentString, true);
|
||||
codegen_->RecordSafepoint(pointers_, deoptimization_index_);
|
||||
}
|
||||
|
||||
@ -79,7 +75,6 @@ class SafepointGenerator : public CallWrapper {
|
||||
LCodeGen* codegen_;
|
||||
LPointerMap* pointers_;
|
||||
int deoptimization_index_;
|
||||
bool ensure_reloc_space_;
|
||||
};
|
||||
|
||||
|
||||
@ -2342,8 +2337,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
|
||||
RegisterEnvironmentForDeoptimization(env);
|
||||
SafepointGenerator safepoint_generator(this,
|
||||
pointers,
|
||||
env->deoptimization_index(),
|
||||
true);
|
||||
env->deoptimization_index());
|
||||
v8::internal::ParameterCount actual(rax);
|
||||
__ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator);
|
||||
}
|
||||
@ -3789,8 +3783,7 @@ void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
|
||||
// builtin)
|
||||
SafepointGenerator safepoint_generator(this,
|
||||
pointers,
|
||||
env->deoptimization_index(),
|
||||
true);
|
||||
env->deoptimization_index());
|
||||
__ Push(Smi::FromInt(strict_mode_flag()));
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user