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

Side by Side Diff: runtime/vm/flow_graph_compiler_ia32.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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 intptr_t slot_ix = 0; 57 intptr_t slot_ix = 0;
58 Environment* current = deopt_env_; 58 Environment* current = deopt_env_;
59 59
60 // Emit all kMaterializeObject instructions describing objects to be 60 // Emit all kMaterializeObject instructions describing objects to be
61 // materialized on the deoptimization as a prefix to the deoptimization info. 61 // materialized on the deoptimization as a prefix to the deoptimization info.
62 EmitMaterializations(deopt_env_, builder); 62 EmitMaterializations(deopt_env_, builder);
63 63
64 // The real frame starts here. 64 // The real frame starts here.
65 builder->MarkFrameStart(); 65 builder->MarkFrameStart();
66 66
67 // Callee's PC marker is not used anymore. Pass Function::null() to set to 0. 67 // Callee's PC marker is not used anymore. Pass Code::null() to set to 0.
68 builder->AddPcMarker(Function::Handle(), slot_ix++); 68 builder->AddPcMarker(Code::Handle(), slot_ix++);
69 69
70 // Current FP and PC. 70 // Current FP and PC.
71 builder->AddCallerFp(slot_ix++); 71 builder->AddCallerFp(slot_ix++);
72 builder->AddReturnAddress(current->function(), deopt_id(), slot_ix++); 72 builder->AddReturnAddress(current->code(), deopt_id(), slot_ix++);
73 73
74 // Emit all values that are needed for materialization as a part of the 74 // Emit all values that are needed for materialization as a part of the
75 // expression stack for the bottom-most frame. This guarantees that GC 75 // expression stack for the bottom-most frame. This guarantees that GC
76 // will be able to find them during materialization. 76 // will be able to find them during materialization.
77 slot_ix = builder->EmitMaterializationArguments(slot_ix); 77 slot_ix = builder->EmitMaterializationArguments(slot_ix);
78 78
79 // For the innermost environment, set outgoing arguments and the locals. 79 // For the innermost environment, set outgoing arguments and the locals.
80 for (intptr_t i = current->Length() - 1; 80 for (intptr_t i = current->Length() - 1;
81 i >= current->fixed_parameter_count(); 81 i >= current->fixed_parameter_count();
82 i--) { 82 i--) {
83 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++); 83 builder->AddCopy(current->ValueAt(i), current->LocationAt(i), slot_ix++);
84 } 84 }
85 85
86 // Current PC marker and caller FP. 86 // Current PC marker and caller FP.
87 builder->AddPcMarker(current->function(), slot_ix++); 87 builder->AddPcMarker(current->code(), slot_ix++);
88 builder->AddCallerFp(slot_ix++); 88 builder->AddCallerFp(slot_ix++);
89 89
90 Environment* previous = current; 90 Environment* previous = current;
91 current = current->outer(); 91 current = current->outer();
92 while (current != NULL) { 92 while (current != NULL) {
93 // For any outer environment the deopt id is that of the call instruction 93 // For any outer environment the deopt id is that of the call instruction
94 // which is recorded in the outer environment. 94 // which is recorded in the outer environment.
95 builder->AddReturnAddress(current->function(), 95 builder->AddReturnAddress(current->code(),
96 Isolate::ToDeoptAfter(current->deopt_id()), 96 Isolate::ToDeoptAfter(current->deopt_id()),
97 slot_ix++); 97 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.
108 for (intptr_t i = current->Length() - 1; 108 for (intptr_t i = current->Length() - 1;
109 i >= current->fixed_parameter_count(); 109 i >= current->fixed_parameter_count();
110 i--) { 110 i--) {
111 builder->AddCopy(current->ValueAt(i), 111 builder->AddCopy(current->ValueAt(i),
112 current->LocationAt(i), 112 current->LocationAt(i),
113 slot_ix++); 113 slot_ix++);
114 } 114 }
115 115
116 // PC marker and caller FP. 116 // PC marker and caller FP.
117 builder->AddPcMarker(current->function(), slot_ix++); 117 builder->AddPcMarker(current->code(), slot_ix++);
118 builder->AddCallerFp(slot_ix++); 118 builder->AddCallerFp(slot_ix++);
119 119
120 // Iterate on the outer environment. 120 // Iterate on the outer environment.
121 previous = current; 121 previous = current;
122 current = current->outer(); 122 current = current->outer();
123 } 123 }
124 // The previous pointer is now the outermost environment. 124 // The previous pointer is now the outermost environment.
125 ASSERT(previous != NULL); 125 ASSERT(previous != NULL);
126 126
127 // For the outermost environment, set caller PC. 127 // For the outermost environment, set caller PC.
(...skipping 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 __ movl(EAX, FieldAddress(EDI, ECX, TIMES_4, base + kWordSize)); 1396 __ movl(EAX, FieldAddress(EDI, ECX, TIMES_4, base + kWordSize));
1397 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); 1397 __ movl(EBX, FieldAddress(EAX, Function::code_offset()));
1398 if (FLAG_collect_code) { 1398 if (FLAG_collect_code) {
1399 // If we are collecting code, the code object may be null. 1399 // If we are collecting code, the code object may be null.
1400 Label is_compiled; 1400 Label is_compiled;
1401 const Immediate& raw_null = 1401 const Immediate& raw_null =
1402 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1402 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1403 __ cmpl(EBX, raw_null); 1403 __ cmpl(EBX, raw_null);
1404 __ j(NOT_EQUAL, &is_compiled, Assembler::kNearJump); 1404 __ j(NOT_EQUAL, &is_compiled, Assembler::kNearJump);
1405 __ call(&StubCode::CompileFunctionRuntimeCallLabel()); 1405 __ call(&StubCode::CompileFunctionRuntimeCallLabel());
1406 AddCurrentDescriptor(PcDescriptors::kRuntimeCall,
1407 Isolate::kNoDeoptId,
1408 token_pos);
1409 RecordSafepoint(locs);
1406 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); 1410 __ movl(EBX, FieldAddress(EAX, Function::code_offset()));
1407 __ Bind(&is_compiled); 1411 __ Bind(&is_compiled);
1408 } 1412 }
1409 __ movl(EAX, FieldAddress(EBX, Code::instructions_offset())); 1413 __ movl(EAX, FieldAddress(EBX, Code::instructions_offset()));
1410 __ LoadObject(ECX, ic_data); 1414 __ LoadObject(ECX, ic_data);
1411 __ LoadObject(EDX, arguments_descriptor); 1415 __ LoadObject(EDX, arguments_descriptor);
1412 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1416 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1413 __ call(EAX); 1417 __ call(EAX);
1414 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos); 1418 AddCurrentDescriptor(PcDescriptors::kOther, Isolate::kNoDeoptId, token_pos);
1415 RecordSafepoint(locs); 1419 RecordSafepoint(locs);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 __ movups(reg, Address(ESP, 0)); 1882 __ movups(reg, Address(ESP, 0));
1879 __ addl(ESP, Immediate(kFpuRegisterSize)); 1883 __ addl(ESP, Immediate(kFpuRegisterSize));
1880 } 1884 }
1881 1885
1882 1886
1883 #undef __ 1887 #undef __
1884 1888
1885 } // namespace dart 1889 } // namespace dart
1886 1890
1887 #endif // defined TARGET_ARCH_IA32 1891 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698