Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: src/compiler/ia32/code-generator-ia32.cc

Issue 809333002: [turbofan] Implement OSR for outer loops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/graph-builder.cc ('k') | src/compiler/instruction-selector.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ia32/assembler-ia32.h" 12 #include "src/ia32/assembler-ia32.h"
12 #include "src/ia32/macro-assembler-ia32.h" 13 #include "src/ia32/macro-assembler-ia32.h"
13 #include "src/scopes.h" 14 #include "src/scopes.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 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 if (saves != 0) { // Save callee-saved registers. 1017 if (saves != 0) { // Save callee-saved registers.
1017 int register_save_area_size = 0; 1018 int register_save_area_size = 0;
1018 for (int i = Register::kNumRegisters - 1; i >= 0; i--) { 1019 for (int i = Register::kNumRegisters - 1; i >= 0; i--) {
1019 if (!((1 << i) & saves)) continue; 1020 if (!((1 << i) & saves)) continue;
1020 __ push(Register::from_code(i)); 1021 __ push(Register::from_code(i));
1021 register_save_area_size += kPointerSize; 1022 register_save_area_size += kPointerSize;
1022 } 1023 }
1023 frame->SetRegisterSaveAreaSize(register_save_area_size); 1024 frame->SetRegisterSaveAreaSize(register_save_area_size);
1024 } 1025 }
1025 } else if (descriptor->IsJSFunctionCall()) { 1026 } else if (descriptor->IsJSFunctionCall()) {
1027 // TODO(turbofan): this prologue is redundant with OSR, but needed for
1028 // code aging.
1026 CompilationInfo* info = this->info(); 1029 CompilationInfo* info = this->info();
1027 __ Prologue(info->IsCodePreAgingActive()); 1030 __ Prologue(info->IsCodePreAgingActive());
1028 frame->SetRegisterSaveAreaSize( 1031 frame->SetRegisterSaveAreaSize(
1029 StandardFrameConstants::kFixedFrameSizeFromFp); 1032 StandardFrameConstants::kFixedFrameSizeFromFp);
1030 } else { 1033 } else {
1031 __ StubPrologue(); 1034 __ StubPrologue();
1032 frame->SetRegisterSaveAreaSize( 1035 frame->SetRegisterSaveAreaSize(
1033 StandardFrameConstants::kFixedFrameSizeFromFp); 1036 StandardFrameConstants::kFixedFrameSizeFromFp);
1034 } 1037 }
1038
1039 if (info()->is_osr()) {
1040 // TurboFan OSR-compiled functions cannot be entered directly.
1041 __ Abort(kShouldNotDirectlyEnterOsrFunction);
1042
1043 // Unoptimized code jumps directly to this entrypoint while the unoptimized
1044 // frame is still on the stack. Optimized code uses OSR values directly from
1045 // the unoptimized frame. Thus, all that needs to be done is to allocate the
1046 // remaining stack slots.
1047 if (FLAG_code_comments) __ RecordComment("-- OSR entrypoint --");
1048 osr_pc_offset_ = __ pc_offset();
1049 int unoptimized_slots =
1050 static_cast<int>(OsrHelper(info()).UnoptimizedFrameSlots());
1051 DCHECK(stack_slots >= unoptimized_slots);
1052 stack_slots -= unoptimized_slots;
1053 }
1054
1035 if (stack_slots > 0) { 1055 if (stack_slots > 0) {
1056 // Allocate the stack slots used by this frame.
1036 __ sub(esp, Immediate(stack_slots * kPointerSize)); 1057 __ sub(esp, Immediate(stack_slots * kPointerSize));
1037 } 1058 }
1038 } 1059 }
1039 1060
1040 1061
1041 void CodeGenerator::AssembleReturn() { 1062 void CodeGenerator::AssembleReturn() {
1042 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); 1063 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor();
1043 if (descriptor->kind() == CallDescriptor::kCallAddress) { 1064 if (descriptor->kind() == CallDescriptor::kCallAddress) {
1044 const RegList saves = descriptor->CalleeSavedRegisters(); 1065 const RegList saves = descriptor->CalleeSavedRegisters();
1045 if (frame()->GetRegisterSaveAreaSize() > 0) { 1066 if (frame()->GetRegisterSaveAreaSize() > 0) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 } 1266 }
1246 } 1267 }
1247 MarkLazyDeoptSite(); 1268 MarkLazyDeoptSite();
1248 } 1269 }
1249 1270
1250 #undef __ 1271 #undef __
1251 1272
1252 } // namespace compiler 1273 } // namespace compiler
1253 } // namespace internal 1274 } // namespace internal
1254 } // namespace v8 1275 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/graph-builder.cc ('k') | src/compiler/instruction-selector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698