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

Side by Side Diff: runtime/vm/flow_graph_compiler_arm.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 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
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('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 (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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 Environment* current = deopt_env_; 54 Environment* current = deopt_env_;
55 55
56 // Emit all kMaterializeObject instructions describing objects to be 56 // Emit all kMaterializeObject instructions describing objects to be
57 // materialized on the deoptimization as a prefix to the deoptimization info. 57 // materialized on the deoptimization as a prefix to the deoptimization info.
58 EmitMaterializations(deopt_env_, builder); 58 EmitMaterializations(deopt_env_, builder);
59 59
60 // The real frame starts here. 60 // The real frame starts here.
61 builder->MarkFrameStart(); 61 builder->MarkFrameStart();
62 62
63 // Current PP, FP, and PC. 63 // Current PP, FP, and PC.
64 builder->AddPp(current->function(), slot_ix++); 64 builder->AddPp(current->code(), slot_ix++);
65 builder->AddCallerFp(slot_ix++); 65 builder->AddCallerFp(slot_ix++);
66 builder->AddReturnAddress(current->function(), deopt_id(), slot_ix++); 66 builder->AddReturnAddress(current->code(), deopt_id(), slot_ix++);
67 67
68 // Callee's PC marker is not used anymore. Pass Function::null() to set to 0. 68 // Callee's PC marker is not used anymore. Pass Function::null() to set to 0.
69 builder->AddPcMarker(Function::Handle(), slot_ix++); 69 builder->AddPcMarker(Code::Handle(), slot_ix++);
70 70
71 // Emit all values that are needed for materialization as a part of the 71 // Emit all values that are needed for materialization as a part of the
72 // expression stack for the bottom-most frame. This guarantees that GC 72 // expression stack for the bottom-most frame. This guarantees that GC
73 // will be able to find them during materialization. 73 // will be able to find them during materialization.
74 slot_ix = builder->EmitMaterializationArguments(slot_ix); 74 slot_ix = builder->EmitMaterializationArguments(slot_ix);
75 75
76 // For the innermost environment, set outgoing arguments and the locals. 76 // For the innermost environment, set outgoing arguments and the locals.
77 for (intptr_t i = current->Length() - 1; 77 for (intptr_t i = current->Length() - 1;
78 i >= current->fixed_parameter_count(); 78 i >= current->fixed_parameter_count();
79 i--) { 79 i--) {
80 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); 80 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++);
81 } 81 }
82 82
83 Environment* previous = current; 83 Environment* previous = current;
84 current = current->outer(); 84 current = current->outer();
85 while (current != NULL) { 85 while (current != NULL) {
86 // PP, FP, and PC. 86 // PP, FP, and PC.
87 builder->AddPp(current->function(), slot_ix++); 87 builder->AddPp(current->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 // PC marker. 96 // PC marker.
97 builder->AddPcMarker(previous->function(), slot_ix++); 97 builder->AddPcMarker(previous->code(), slot_ix++);
98 98
99 // The values of outgoing arguments can be changed from the inlined call so 99 // The values of outgoing arguments can be changed from the inlined call so
100 // we must read them from the previous environment. 100 // we must read them from the previous environment.
101 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { 101 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
102 builder->AddCopy(previous->ValueAt(i), 102 builder->AddCopy(previous->ValueAt(i),
103 previous->LocationAt(i), 103 previous->LocationAt(i),
104 slot_ix++); 104 slot_ix++);
105 } 105 }
106 106
107 // Set the locals, note that outgoing arguments are not in the environment. 107 // Set the locals, note that outgoing arguments are not in the environment.
(...skipping 11 matching lines...) Expand all
119 } 119 }
120 // The previous pointer is now the outermost environment. 120 // The previous pointer is now the outermost environment.
121 ASSERT(previous != NULL); 121 ASSERT(previous != NULL);
122 122
123 // For the outermost environment, set caller PC, caller PP, and caller FP. 123 // For the outermost environment, set caller PC, caller PP, and caller FP.
124 builder->AddCallerPp(slot_ix++); 124 builder->AddCallerPp(slot_ix++);
125 builder->AddCallerFp(slot_ix++); 125 builder->AddCallerFp(slot_ix++);
126 builder->AddCallerPc(slot_ix++); 126 builder->AddCallerPc(slot_ix++);
127 127
128 // PC marker. 128 // PC marker.
129 builder->AddPcMarker(previous->function(), slot_ix++); 129 builder->AddPcMarker(previous->code(), slot_ix++);
130 130
131 // For the outermost environment, set the incoming arguments. 131 // For the outermost environment, set the incoming arguments.
132 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { 132 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
133 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++); 133 builder->AddCopy(previous->ValueAt(i), previous->LocationAt(i), slot_ix++);
134 } 134 }
135 135
136 const DeoptInfo& deopt_info = 136 const DeoptInfo& deopt_info =
137 DeoptInfo::Handle(builder->CreateDeoptInfo(deopt_table)); 137 DeoptInfo::Handle(builder->CreateDeoptInfo(deopt_table));
138 return deopt_info.raw(); 138 return deopt_info.raw();
139 } 139 }
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 // illegal class id was found, the target is a cache miss handler that can 1352 // illegal class id was found, the target is a cache miss handler that can
1353 // be invoked as a normal Dart function. 1353 // be invoked as a normal Dart function.
1354 __ add(IP, R2, ShifterOperand(R3, LSL, 2)); 1354 __ add(IP, R2, ShifterOperand(R3, LSL, 2));
1355 __ ldr(R0, FieldAddress(IP, base + kWordSize)); 1355 __ ldr(R0, FieldAddress(IP, base + kWordSize));
1356 __ ldr(R1, FieldAddress(R0, Function::code_offset())); 1356 __ ldr(R1, FieldAddress(R0, Function::code_offset()));
1357 if (FLAG_collect_code) { 1357 if (FLAG_collect_code) {
1358 // If we are collecting code, the code object may be null. 1358 // If we are collecting code, the code object may be null.
1359 Label is_compiled; 1359 Label is_compiled;
1360 __ CompareImmediate(R1, reinterpret_cast<intptr_t>(Object::null())); 1360 __ CompareImmediate(R1, reinterpret_cast<intptr_t>(Object::null()));
1361 __ b(&is_compiled, NE); 1361 __ b(&is_compiled, NE);
1362 __ BranchLink(&StubCode::CompileFunctionRuntimeCallLabel()); 1362 __ BranchLinkPatchable(&StubCode::CompileFunctionRuntimeCallLabel());
1363 AddCurrentDescriptor(PcDescriptors::kRuntimeCall,
1364 Isolate::kNoDeoptId,
1365 token_pos);
1366 RecordSafepoint(locs);
1363 // R0: target function. 1367 // R0: target function.
1364 __ ldr(R1, FieldAddress(R0, Function::code_offset())); 1368 __ ldr(R1, FieldAddress(R0, Function::code_offset()));
1365 __ Bind(&is_compiled); 1369 __ Bind(&is_compiled);
1366 } 1370 }
1367 __ ldr(R0, FieldAddress(R1, Code::instructions_offset())); 1371 __ ldr(R0, FieldAddress(R1, Code::instructions_offset()));
1368 __ LoadObject(R5, ic_data); 1372 __ LoadObject(R5, ic_data);
1369 __ LoadObject(R4, arguments_descriptor); 1373 __ LoadObject(R4, arguments_descriptor);
1370 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag); 1374 __ AddImmediate(R0, Instructions::HeaderSize() - kHeapObjectTag);
1371 __ blx(R0); 1375 __ blx(R0);
1372 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); 1376 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos);
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1876 DRegister dreg = EvenDRegisterOf(reg); 1880 DRegister dreg = EvenDRegisterOf(reg);
1877 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); 1881 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex));
1878 } 1882 }
1879 1883
1880 1884
1881 #undef __ 1885 #undef __
1882 1886
1883 } // namespace dart 1887 } // namespace dart
1884 1888
1885 #endif // defined TARGET_ARCH_ARM 1889 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698