Index: src/compiler/arm64/code-generator-arm64.cc |
diff --git a/src/compiler/arm64/code-generator-arm64.cc b/src/compiler/arm64/code-generator-arm64.cc |
index e0252360590296072bf353a576b629dfb743a119..23cc22724064254892d34779d5f97edd821416ce 100644 |
--- a/src/compiler/arm64/code-generator-arm64.cc |
+++ b/src/compiler/arm64/code-generator-arm64.cc |
@@ -9,6 +9,7 @@ |
#include "src/compiler/gap-resolver.h" |
#include "src/compiler/node-matchers.h" |
#include "src/compiler/node-properties-inl.h" |
+#include "src/compiler/osr.h" |
#include "src/scopes.h" |
namespace v8 { |
@@ -976,6 +977,23 @@ void CodeGenerator::AssemblePrologue() { |
StandardFrameConstants::kFixedFrameSizeFromFp); |
} |
int stack_slots = frame()->GetSpillSlotCount(); |
+ |
+ if (info()->is_osr()) { |
+ // TurboFan OSR-compiled functions cannot be entered directly. |
+ __ Abort(kShouldNotDirectlyEnterOsrFunction); |
+ |
+ // Unoptimized code jumps directly to this entrypoint while the unoptimized |
+ // frame is still on the stack. Optimized code uses OSR values directly from |
+ // the unoptimized frame. Thus, all that needs to be done is to allocate the |
+ // remaining stack slots. |
+ if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); |
+ osr_pc_offset_ = __ pc_offset(); |
+ int unoptimized_slots = |
+ static_cast<int>(OsrHelper(info()).UnoptimizedFrameSlots()); |
+ DCHECK(stack_slots >= unoptimized_slots); |
+ stack_slots -= unoptimized_slots; |
+ } |
+ |
if (stack_slots > 0) { |
Register sp = __ StackPointer(); |
if (!sp.Is(csp)) { |