Index: src/compiler/x64/code-generator-x64.cc |
diff --git a/src/compiler/x64/code-generator-x64.cc b/src/compiler/x64/code-generator-x64.cc |
index 84b88f249efa3f47ec68b87ce7922bc5e37e3ff1..b7319776b2128706223fb9c0b9ad11c0869120a0 100644 |
--- a/src/compiler/x64/code-generator-x64.cc |
+++ b/src/compiler/x64/code-generator-x64.cc |
@@ -8,6 +8,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" |
#include "src/x64/assembler-x64.h" |
#include "src/x64/macro-assembler-x64.h" |
@@ -1224,6 +1225,22 @@ void CodeGenerator::AssemblePrologue() { |
frame()->SetRegisterSaveAreaSize( |
StandardFrameConstants::kFixedFrameSizeFromFp); |
} |
+ |
+ if (info()->is_osr()) { |
+ // TurboFan OSR-compiled functions cannot be entered directly. |
+ __ int3(); |
+ |
+ // 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(); |
+ size_t unoptimized_slots = OsrHelper(info()).UnoptimizedFrameSlots(); |
+ DCHECK(stack_slots >= static_cast<int>(unoptimized_slots)); |
+ stack_slots -= unoptimized_slots; |
+ } |
+ |
if (stack_slots > 0) { |
__ subq(rsp, Immediate(stack_slots * kPointerSize)); |
} |