Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(611)

Unified Diff: src/compiler/x87/code-generator-x87.cc

Issue 1702383005: x87: fix x87 FPU stack depth check fail issue in TurboFan's exception handler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove the redundant test instruction as the and instruction will set the ZF flag Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/x87/code-generator-x87.cc
diff --git a/src/compiler/x87/code-generator-x87.cc b/src/compiler/x87/code-generator-x87.cc
index 8a1dbb0d9afe04a5b4278c97e171f638077dcd19..b73787b6d50be0f17d41f26289e8a411e4cd7e4b 100644
--- a/src/compiler/x87/code-generator-x87.cc
+++ b/src/compiler/x87/code-generator-x87.cc
@@ -360,41 +360,18 @@ void CodeGenerator::AssemblePrepareTailCall(int stack_param_delta) {
frame_access_state()->SetFrameAccessToSP();
}
-thread_local bool is_handler_entry_point = false;
-static void DoEnsureSpaceForLazyDeopt(CompilationInfo* info,
- MacroAssembler* masm,
- int last_lazy_deopt_pc) {
- if (!info->ShouldEnsureSpaceForLazyDeopt()) {
- return;
- }
-
- int space_needed = Deoptimizer::patch_size();
- // Ensure that we have enough space after the previous lazy-bailout
- // instruction for patching the code here.
- int current_pc = masm->pc_offset();
- if (current_pc < last_lazy_deopt_pc + space_needed) {
- int padding_size = last_lazy_deopt_pc + space_needed - current_pc;
- masm->Nop(padding_size);
- }
-}
// Assembles an instruction after register allocation, producing machine code.
void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
X87OperandConverter i(this, instr);
- if (is_handler_entry_point) {
- // Lazy Bailout entry, need to re-initialize FPU state.
- __ fninit();
- __ fld1();
- is_handler_entry_point = false;
- }
switch (ArchOpcodeField::decode(instr->opcode())) {
case kArchCallCodeObject: {
- DoEnsureSpaceForLazyDeopt(info(), masm(), last_lazy_deopt_pc_);
if (FLAG_debug_code && FLAG_enable_slow_asserts) {
__ VerifyX87StackDepth(1);
}
__ fstp(0);
+ EnsureSpaceForLazyDeopt();
if (HasImmediateInput(instr, 0)) {
Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
__ call(code, RelocInfo::CODE_TARGET);
@@ -439,7 +416,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
break;
}
case kArchCallJSFunction: {
- DoEnsureSpaceForLazyDeopt(info(), masm(), last_lazy_deopt_pc_);
+ EnsureSpaceForLazyDeopt();
Register func = i.InputRegister(0);
if (FLAG_debug_code) {
// Check the function's context matches the context argument.
@@ -2239,8 +2216,18 @@ void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); }
void CodeGenerator::EnsureSpaceForLazyDeopt() {
- is_handler_entry_point = true;
- DoEnsureSpaceForLazyDeopt(info(), masm(), last_lazy_deopt_pc_);
+ if (!info()->ShouldEnsureSpaceForLazyDeopt()) {
+ return;
+ }
+
+ int space_needed = Deoptimizer::patch_size();
+ // Ensure that we have enough space after the previous lazy-bailout
+ // instruction for patching the code here.
+ int current_pc = masm()->pc_offset();
+ if (current_pc < last_lazy_deopt_pc_ + space_needed) {
+ int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
+ __ Nop(padding_size);
+ }
}
#undef __
« no previous file with comments | « no previous file | src/x87/code-stubs-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698