OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.h" |
| 11 #include "src/compiler/osr.h" |
11 #include "src/scopes.h" | 12 #include "src/scopes.h" |
12 #include "src/x64/assembler-x64.h" | 13 #include "src/x64/assembler-x64.h" |
13 #include "src/x64/macro-assembler-x64.h" | 14 #include "src/x64/macro-assembler-x64.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 namespace compiler { | 18 namespace compiler { |
18 | 19 |
19 #define __ masm()-> | 20 #define __ masm()-> |
20 | 21 |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 } else if (descriptor->IsJSFunctionCall()) { | 1195 } else if (descriptor->IsJSFunctionCall()) { |
1195 CompilationInfo* info = this->info(); | 1196 CompilationInfo* info = this->info(); |
1196 __ Prologue(info->IsCodePreAgingActive()); | 1197 __ Prologue(info->IsCodePreAgingActive()); |
1197 frame()->SetRegisterSaveAreaSize( | 1198 frame()->SetRegisterSaveAreaSize( |
1198 StandardFrameConstants::kFixedFrameSizeFromFp); | 1199 StandardFrameConstants::kFixedFrameSizeFromFp); |
1199 } else { | 1200 } else { |
1200 __ StubPrologue(); | 1201 __ StubPrologue(); |
1201 frame()->SetRegisterSaveAreaSize( | 1202 frame()->SetRegisterSaveAreaSize( |
1202 StandardFrameConstants::kFixedFrameSizeFromFp); | 1203 StandardFrameConstants::kFixedFrameSizeFromFp); |
1203 } | 1204 } |
| 1205 |
| 1206 if (info()->is_osr()) { |
| 1207 // TurboFan OSR-compiled functions cannot be entered directly. |
| 1208 __ Abort(kShouldNotDirectlyEnterOsrFunction); |
| 1209 |
| 1210 // Unoptimized code jumps directly to this entrypoint while the unoptimized |
| 1211 // frame is still on the stack. Optimized code uses OSR values directly from |
| 1212 // the unoptimized frame. Thus, all that needs to be done is to allocate the |
| 1213 // remaining stack slots. |
| 1214 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); |
| 1215 osr_pc_offset_ = __ pc_offset(); |
| 1216 int unoptimized_slots = |
| 1217 static_cast<int>(OsrHelper(info()).UnoptimizedFrameSlots()); |
| 1218 DCHECK(stack_slots >= unoptimized_slots); |
| 1219 stack_slots -= unoptimized_slots; |
| 1220 } |
| 1221 |
1204 if (stack_slots > 0) { | 1222 if (stack_slots > 0) { |
1205 __ subq(rsp, Immediate(stack_slots * kPointerSize)); | 1223 __ subq(rsp, Immediate(stack_slots * kPointerSize)); |
1206 } | 1224 } |
1207 } | 1225 } |
1208 | 1226 |
1209 | 1227 |
1210 void CodeGenerator::AssembleReturn() { | 1228 void CodeGenerator::AssembleReturn() { |
1211 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1229 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1212 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1230 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1213 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1231 if (frame()->GetRegisterSaveAreaSize() > 0) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1414 } | 1432 } |
1415 } | 1433 } |
1416 MarkLazyDeoptSite(); | 1434 MarkLazyDeoptSite(); |
1417 } | 1435 } |
1418 | 1436 |
1419 #undef __ | 1437 #undef __ |
1420 | 1438 |
1421 } // namespace internal | 1439 } // namespace internal |
1422 } // namespace compiler | 1440 } // namespace compiler |
1423 } // namespace v8 | 1441 } // namespace v8 |
OLD | NEW |