Index: src/compiler/code-generator.cc |
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc |
index 6789f3a9fee75c5c1b6e1b08180e9eb390087f10..d4622c0a351d1962c415bee3d9f92050e1e53d50 100644 |
--- a/src/compiler/code-generator.cc |
+++ b/src/compiler/code-generator.cc |
@@ -27,7 +27,8 @@ CodeGenerator::CodeGenerator(Frame* frame, Linkage* linkage, |
deoptimization_states_(code->zone()), |
deoptimization_literals_(code->zone()), |
translations_(code->zone()), |
- last_lazy_deopt_pc_(0) { |
+ last_lazy_deopt_pc_(0), |
+ ools_(nullptr) { |
for (int i = 0; i < code->InstructionBlockCount(); ++i) { |
new (&labels_[i]) Label; |
} |
@@ -71,6 +72,16 @@ Handle<Code> CodeGenerator::GenerateCode() { |
} |
} |
+ // Assemble all out-of-line code. |
+ if (ools_) { |
+ masm()->RecordComment("-- Out of line code --"); |
+ for (OutOfLineCode* ool = ools_; ool; ool = ool->next()) { |
+ masm()->bind(ool->entry()); |
+ ool->Generate(); |
+ masm()->jmp(ool->exit()); |
+ } |
+ } |
+ |
FinishCode(masm()); |
// Ensure there is space for lazy deopt. |
@@ -555,6 +566,15 @@ void CodeGenerator::AddNopForSmiCodeInlining() { UNIMPLEMENTED(); } |
#endif // !V8_TURBOFAN_BACKEND |
+ |
+OutOfLineCode::OutOfLineCode(CodeGenerator* gen) |
+ : masm_(gen->masm()), next_(gen->ools_) { |
+ gen->ools_ = this; |
+} |
+ |
+ |
+OutOfLineCode::~OutOfLineCode() {} |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |