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 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 } else if (descriptor->IsJSFunctionCall()) { | 1218 } else if (descriptor->IsJSFunctionCall()) { |
1218 CompilationInfo* info = this->info(); | 1219 CompilationInfo* info = this->info(); |
1219 __ Prologue(info->IsCodePreAgingActive()); | 1220 __ Prologue(info->IsCodePreAgingActive()); |
1220 frame()->SetRegisterSaveAreaSize( | 1221 frame()->SetRegisterSaveAreaSize( |
1221 StandardFrameConstants::kFixedFrameSizeFromFp); | 1222 StandardFrameConstants::kFixedFrameSizeFromFp); |
1222 } else { | 1223 } else { |
1223 __ StubPrologue(); | 1224 __ StubPrologue(); |
1224 frame()->SetRegisterSaveAreaSize( | 1225 frame()->SetRegisterSaveAreaSize( |
1225 StandardFrameConstants::kFixedFrameSizeFromFp); | 1226 StandardFrameConstants::kFixedFrameSizeFromFp); |
1226 } | 1227 } |
| 1228 |
| 1229 if (info()->is_osr()) { |
| 1230 // TurboFan OSR-compiled functions cannot be entered directly. |
| 1231 __ int3(); |
| 1232 |
| 1233 // Unoptimized code jumps directly to this entrypoint while the unoptimized |
| 1234 // frame is still on the stack. Optimized code uses OSR values directly from |
| 1235 // the unoptimized frame. Thus, all that needs to be done is to allocate the |
| 1236 // remaining stack slots. |
| 1237 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --"); |
| 1238 osr_pc_offset_ = __ pc_offset(); |
| 1239 size_t unoptimized_slots = OsrHelper(info()).UnoptimizedFrameSlots(); |
| 1240 DCHECK(stack_slots >= static_cast<int>(unoptimized_slots)); |
| 1241 stack_slots -= unoptimized_slots; |
| 1242 } |
| 1243 |
1227 if (stack_slots > 0) { | 1244 if (stack_slots > 0) { |
1228 __ subq(rsp, Immediate(stack_slots * kPointerSize)); | 1245 __ subq(rsp, Immediate(stack_slots * kPointerSize)); |
1229 } | 1246 } |
1230 } | 1247 } |
1231 | 1248 |
1232 | 1249 |
1233 void CodeGenerator::AssembleReturn() { | 1250 void CodeGenerator::AssembleReturn() { |
1234 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1251 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1235 if (descriptor->kind() == CallDescriptor::kCallAddress) { | 1252 if (descriptor->kind() == CallDescriptor::kCallAddress) { |
1236 if (frame()->GetRegisterSaveAreaSize() > 0) { | 1253 if (frame()->GetRegisterSaveAreaSize() > 0) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 } | 1454 } |
1438 } | 1455 } |
1439 MarkLazyDeoptSite(); | 1456 MarkLazyDeoptSite(); |
1440 } | 1457 } |
1441 | 1458 |
1442 #undef __ | 1459 #undef __ |
1443 | 1460 |
1444 } // namespace internal | 1461 } // namespace internal |
1445 } // namespace compiler | 1462 } // namespace compiler |
1446 } // namespace v8 | 1463 } // namespace v8 |
OLD | NEW |