OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/code-generator.h" | 5 #include "src/compiler/code-generator.h" |
6 | 6 |
7 #include "src/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
11 #include "src/compiler/node-properties-inl.h" | 11 #include "src/compiler/node-properties-inl.h" |
| 12 #include "src/compiler/osr.h" |
12 #include "src/scopes.h" | 13 #include "src/scopes.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 namespace compiler { | 17 namespace compiler { |
17 | 18 |
18 #define __ masm()-> | 19 #define __ masm()-> |
19 | 20 |
20 | 21 |
21 #define kScratchReg r9 | 22 #define kScratchReg r9 |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 CompilationInfo* info = this->info(); | 877 CompilationInfo* info = this->info(); |
877 __ Prologue(info->IsCodePreAgingActive()); | 878 __ Prologue(info->IsCodePreAgingActive()); |
878 frame()->SetRegisterSaveAreaSize( | 879 frame()->SetRegisterSaveAreaSize( |
879 StandardFrameConstants::kFixedFrameSizeFromFp); | 880 StandardFrameConstants::kFixedFrameSizeFromFp); |
880 } else { | 881 } else { |
881 __ StubPrologue(); | 882 __ StubPrologue(); |
882 frame()->SetRegisterSaveAreaSize( | 883 frame()->SetRegisterSaveAreaSize( |
883 StandardFrameConstants::kFixedFrameSizeFromFp); | 884 StandardFrameConstants::kFixedFrameSizeFromFp); |
884 } | 885 } |
885 int stack_slots = frame()->GetSpillSlotCount(); | 886 int stack_slots = frame()->GetSpillSlotCount(); |
| 887 |
| 888 if (info()->is_osr()) { |
| 889 // TurboFan OSR-compiled functions cannot be entered directly. |
| 890 __ Abort(kShouldNotDirectlyEnterOsrFunction); |
| 891 |
| 892 // Unoptimized code jumps directly to this entrypoint while the unoptimized |
| 893 // frame is still on the stack. Optimized code uses OSR values directly from |
| 894 // the unoptimized frame. Thus, all that needs to be done is to allocate the |
| 895 // remaining stack slots. |
| 896 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); |
| 897 osr_pc_offset_ = __ pc_offset(); |
| 898 int unoptimized_slots = |
| 899 static_cast<int>(OsrHelper(info()).UnoptimizedFrameSlots()); |
| 900 DCHECK(stack_slots >= unoptimized_slots); |
| 901 stack_slots -= unoptimized_slots; |
| 902 } |
| 903 |
886 if (stack_slots > 0) { | 904 if (stack_slots > 0) { |
887 __ sub(sp, sp, Operand(stack_slots * kPointerSize)); | 905 __ sub(sp, sp, Operand(stack_slots * kPointerSize)); |
888 } | 906 } |
889 } | 907 } |
890 | 908 |
891 | 909 |
892 void CodeGenerator::AssembleReturn() { | 910 void CodeGenerator::AssembleReturn() { |
893 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 911 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
894 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 912 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
895 if (frame()->GetRegisterSaveAreaSize() > 0) { | 913 if (frame()->GetRegisterSaveAreaSize() > 0) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 } | 1123 } |
1106 } | 1124 } |
1107 MarkLazyDeoptSite(); | 1125 MarkLazyDeoptSite(); |
1108 } | 1126 } |
1109 | 1127 |
1110 #undef __ | 1128 #undef __ |
1111 | 1129 |
1112 } // namespace compiler | 1130 } // namespace compiler |
1113 } // namespace internal | 1131 } // namespace internal |
1114 } // namespace v8 | 1132 } // namespace v8 |
OLD | NEW |