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

Side by Side Diff: runtime/vm/flow_graph_compiler_x64.cc

Issue 70183010: Fixes a couple problems with GC of unoptimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/flow_graph_compiler.h" 8 #include "vm/flow_graph_compiler.h"
9 9
10 #include "vm/ast_printer.h" 10 #include "vm/ast_printer.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 Environment* current = deopt_env_; 55 Environment* current = deopt_env_;
56 56
57 // Emit all kMaterializeObject instructions describing objects to be 57 // Emit all kMaterializeObject instructions describing objects to be
58 // materialized on the deoptimization as a prefix to the deoptimization info. 58 // materialized on the deoptimization as a prefix to the deoptimization info.
59 EmitMaterializations(deopt_env_, builder); 59 EmitMaterializations(deopt_env_, builder);
60 60
61 // The real frame starts here. 61 // The real frame starts here.
62 builder->MarkFrameStart(); 62 builder->MarkFrameStart();
63 63
64 // Current PP, FP, and PC. 64 // Current PP, FP, and PC.
65 builder->AddPp(current->function(), slot_ix++); 65 builder->AddPp(current->code(), slot_ix++);
66 builder->AddPcMarker(Function::Handle(), slot_ix++); 66 builder->AddPcMarker(Code::Handle(), slot_ix++);
67 builder->AddCallerFp(slot_ix++); 67 builder->AddCallerFp(slot_ix++);
68 builder->AddReturnAddress(current->function(), deopt_id(), slot_ix++); 68 builder->AddReturnAddress(current->code(), deopt_id(), slot_ix++);
69 69
70 // Emit all values that are needed for materialization as a part of the 70 // Emit all values that are needed for materialization as a part of the
71 // expression stack for the bottom-most frame. This guarantees that GC 71 // expression stack for the bottom-most frame. This guarantees that GC
72 // will be able to find them during materialization. 72 // will be able to find them during materialization.
73 slot_ix = builder->EmitMaterializationArguments(slot_ix); 73 slot_ix = builder->EmitMaterializationArguments(slot_ix);
74 74
75 // For the innermost environment, set outgoing arguments and the locals. 75 // For the innermost environment, set outgoing arguments and the locals.
76 for (intptr_t i = current->Length() - 1; 76 for (intptr_t i = current->Length() - 1;
77 i >= current->fixed_parameter_count(); 77 i >= current->fixed_parameter_count();
78 i--) { 78 i--) {
79 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); 79 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++);
80 } 80 }
81 81
82 Environment* previous = current; 82 Environment* previous = current;
83 current = current->outer(); 83 current = current->outer();
84 while (current != NULL) { 84 while (current != NULL) {
85 // PP, FP, and PC. 85 // PP, FP, and PC.
86 builder->AddPp(current->function(), slot_ix++); 86 builder->AddPp(current->code(), slot_ix++);
87 builder->AddPcMarker(previous->function(), slot_ix++); 87 builder->AddPcMarker(previous->code(), slot_ix++);
88 builder->AddCallerFp(slot_ix++); 88 builder->AddCallerFp(slot_ix++);
89 89
90 // For any outer environment the deopt id is that of the call instruction 90 // For any outer environment the deopt id is that of the call instruction
91 // which is recorded in the outer environment. 91 // which is recorded in the outer environment.
92 builder->AddReturnAddress(current->function(), 92 builder->AddReturnAddress(current->code(),
93 Isolate::ToDeoptAfter(current->deopt_id()), 93 Isolate::ToDeoptAfter(current->deopt_id()),
94 slot_ix++); 94 slot_ix++);
95 95
96 // The values of outgoing arguments can be changed from the inlined call so 96 // The values of outgoing arguments can be changed from the inlined call so
97 // we must read them from the previous environment. 97 // we must read them from the previous environment.
98 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { 98 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
99 builder->AddCopy(previous->ValueAt(i), 99 builder->AddCopy(previous->ValueAt(i),
100 previous->LocationAt(i), 100 previous->LocationAt(i),
101 slot_ix++); 101 slot_ix++);
102 } 102 }
(...skipping 10 matching lines...) Expand all
113 // Iterate on the outer environment. 113 // Iterate on the outer environment.
114 previous = current; 114 previous = current;
115 current = current->outer(); 115 current = current->outer();
116 } 116 }
117 // The previous pointer is now the outermost environment. 117 // The previous pointer is now the outermost environment.
118 ASSERT(previous != NULL); 118 ASSERT(previous != NULL);
119 119
120 // For the outermost environment, set caller PC, caller PP, and caller FP. 120 // For the outermost environment, set caller PC, caller PP, and caller FP.
121 builder->AddCallerPp(slot_ix++); 121 builder->AddCallerPp(slot_ix++);
122 // PC marker. 122 // PC marker.
123 builder->AddPcMarker(previous->function(), slot_ix++); 123 builder->AddPcMarker(previous->code(), slot_ix++);
124 builder->AddCallerFp(slot_ix++); 124 builder->AddCallerFp(slot_ix++);
125 builder->AddCallerPc(slot_ix++); 125 builder->AddCallerPc(slot_ix++);
126 126
127 // For the outermost environment, set the incoming arguments. 127 // For the outermost environment, set the incoming arguments.
128 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { 128 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
129 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); 129 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++);
130 } 130 }
131 131
132 const DeoptInfo& deopt_info = 132 const DeoptInfo& deopt_info =
133 DeoptInfo::Handle(builder->CreateDeoptInfo(deopt_table)); 133 DeoptInfo::Handle(builder->CreateDeoptInfo(deopt_table));
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1898 __ movups(reg, Address(RSP, 0)); 1898 __ movups(reg, Address(RSP, 0));
1899 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1899 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1900 } 1900 }
1901 1901
1902 1902
1903 #undef __ 1903 #undef __
1904 1904
1905 } // namespace dart 1905 } // namespace dart
1906 1906
1907 #endif // defined TARGET_ARCH_X64 1907 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698