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

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

Issue 1390153004: Move deopt_id and related helpers/definitions from Isolate to Thread (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 current = current->outer(); 122 current = current->outer();
123 while (current != NULL) { 123 while (current != NULL) {
124 builder->AddPp(current->function(), slot_ix++); 124 builder->AddPp(current->function(), slot_ix++);
125 builder->AddPcMarker(previous->function(), slot_ix++); 125 builder->AddPcMarker(previous->function(), slot_ix++);
126 builder->AddCallerFp(slot_ix++); 126 builder->AddCallerFp(slot_ix++);
127 127
128 // For any outer environment the deopt id is that of the call instruction 128 // For any outer environment the deopt id is that of the call instruction
129 // which is recorded in the outer environment. 129 // which is recorded in the outer environment.
130 builder->AddReturnAddress( 130 builder->AddReturnAddress(
131 current->function(), 131 current->function(),
132 Isolate::ToDeoptAfter(current->deopt_id()), 132 Thread::ToDeoptAfter(current->deopt_id()),
133 slot_ix++); 133 slot_ix++);
134 134
135 // The values of outgoing arguments can be changed from the inlined call so 135 // The values of outgoing arguments can be changed from the inlined call so
136 // we must read them from the previous environment. 136 // we must read them from the previous environment.
137 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) { 137 for (intptr_t i = previous->fixed_parameter_count() - 1; i >= 0; i--) {
138 builder->AddCopy(previous->ValueAt(i), 138 builder->AddCopy(previous->ValueAt(i),
139 previous->LocationAt(i), 139 previous->LocationAt(i),
140 slot_ix++); 140 slot_ix++);
141 } 141 }
142 142
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 __ Jmp(*StubCode::DeoptimizeLazy_entry(), PP); 1144 __ Jmp(*StubCode::DeoptimizeLazy_entry(), PP);
1145 } 1145 }
1146 } 1146 }
1147 1147
1148 1148
1149 void FlowGraphCompiler::GenerateCall(intptr_t token_pos, 1149 void FlowGraphCompiler::GenerateCall(intptr_t token_pos,
1150 const StubEntry& stub_entry, 1150 const StubEntry& stub_entry,
1151 RawPcDescriptors::Kind kind, 1151 RawPcDescriptors::Kind kind,
1152 LocationSummary* locs) { 1152 LocationSummary* locs) {
1153 __ Call(stub_entry); 1153 __ Call(stub_entry);
1154 AddCurrentDescriptor(kind, Isolate::kNoDeoptId, token_pos); 1154 AddCurrentDescriptor(kind, Thread::kNoDeoptId, token_pos);
1155 RecordSafepoint(locs); 1155 RecordSafepoint(locs);
1156 } 1156 }
1157 1157
1158 1158
1159 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id, 1159 void FlowGraphCompiler::GenerateDartCall(intptr_t deopt_id,
1160 intptr_t token_pos, 1160 intptr_t token_pos,
1161 const StubEntry& stub_entry, 1161 const StubEntry& stub_entry,
1162 RawPcDescriptors::Kind kind, 1162 RawPcDescriptors::Kind kind,
1163 LocationSummary* locs) { 1163 LocationSummary* locs) {
1164 __ CallPatchable(stub_entry); 1164 __ CallPatchable(stub_entry);
1165 AddCurrentDescriptor(kind, deopt_id, token_pos); 1165 AddCurrentDescriptor(kind, deopt_id, token_pos);
1166 RecordSafepoint(locs); 1166 RecordSafepoint(locs);
1167 // Marks either the continuation point in unoptimized code or the 1167 // Marks either the continuation point in unoptimized code or the
1168 // deoptimization point in optimized code, after call. 1168 // deoptimization point in optimized code, after call.
1169 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); 1169 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1170 if (is_optimizing()) { 1170 if (is_optimizing()) {
1171 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1171 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1172 } else { 1172 } else {
1173 // Add deoptimization continuation point after the call and before the 1173 // Add deoptimization continuation point after the call and before the
1174 // arguments are removed. 1174 // arguments are removed.
1175 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); 1175 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
1176 } 1176 }
1177 } 1177 }
1178 1178
1179 1179
1180 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos, 1180 void FlowGraphCompiler::GenerateRuntimeCall(intptr_t token_pos,
1181 intptr_t deopt_id, 1181 intptr_t deopt_id,
1182 const RuntimeEntry& entry, 1182 const RuntimeEntry& entry,
1183 intptr_t argument_count, 1183 intptr_t argument_count,
1184 LocationSummary* locs) { 1184 LocationSummary* locs) {
1185 __ CallRuntime(entry, argument_count); 1185 __ CallRuntime(entry, argument_count);
1186 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos); 1186 AddCurrentDescriptor(RawPcDescriptors::kOther, deopt_id, token_pos);
1187 RecordSafepoint(locs); 1187 RecordSafepoint(locs);
1188 if (deopt_id != Isolate::kNoDeoptId) { 1188 if (deopt_id != Thread::kNoDeoptId) {
1189 // Marks either the continuation point in unoptimized code or the 1189 // Marks either the continuation point in unoptimized code or the
1190 // deoptimization point in optimized code, after call. 1190 // deoptimization point in optimized code, after call.
1191 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); 1191 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1192 if (is_optimizing()) { 1192 if (is_optimizing()) {
1193 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1193 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1194 } else { 1194 } else {
1195 // Add deoptimization continuation point after the call and before the 1195 // Add deoptimization continuation point after the call and before the
1196 // arguments are removed. 1196 // arguments are removed.
1197 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); 1197 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
1198 } 1198 }
1199 } 1199 }
1200 } 1200 }
1201 1201
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 1294
1295 if (FLAG_use_megamorphic_stub) { 1295 if (FLAG_use_megamorphic_stub) {
1296 __ Call(*StubCode::MegamorphicLookup_entry()); 1296 __ Call(*StubCode::MegamorphicLookup_entry());
1297 } else { 1297 } else {
1298 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR); 1298 StubCode::EmitMegamorphicLookup(assembler(), receiverR, cacheR, targetR);
1299 } 1299 }
1300 __ LoadObject(RBX, ic_data); 1300 __ LoadObject(RBX, ic_data);
1301 __ LoadObject(R10, arguments_descriptor); 1301 __ LoadObject(R10, arguments_descriptor);
1302 __ call(targetR); 1302 __ call(targetR);
1303 AddCurrentDescriptor(RawPcDescriptors::kOther, 1303 AddCurrentDescriptor(RawPcDescriptors::kOther,
1304 Isolate::kNoDeoptId, token_pos); 1304 Thread::kNoDeoptId, token_pos);
1305 RecordSafepoint(locs); 1305 RecordSafepoint(locs);
1306 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); 1306 const intptr_t deopt_id_after = Thread::ToDeoptAfter(deopt_id);
1307 if (is_optimizing()) { 1307 if (is_optimizing()) {
1308 AddDeoptIndexAtCall(deopt_id_after, token_pos); 1308 AddDeoptIndexAtCall(deopt_id_after, token_pos);
1309 } else { 1309 } else {
1310 // Add deoptimization continuation point after the call and before the 1310 // Add deoptimization continuation point after the call and before the
1311 // arguments are removed. 1311 // arguments are removed.
1312 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos); 1312 AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, token_pos);
1313 } 1313 }
1314 __ Drop(argument_count, RCX); 1314 __ Drop(argument_count, RCX);
1315 } 1315 }
1316 1316
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 if (needs_number_check) { 1352 if (needs_number_check) {
1353 __ pushq(reg); 1353 __ pushq(reg);
1354 __ PushObject(obj); 1354 __ PushObject(obj);
1355 if (is_optimizing()) { 1355 if (is_optimizing()) {
1356 __ CallPatchable(*StubCode::OptimizedIdenticalWithNumberCheck_entry()); 1356 __ CallPatchable(*StubCode::OptimizedIdenticalWithNumberCheck_entry());
1357 } else { 1357 } else {
1358 __ CallPatchable(*StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); 1358 __ CallPatchable(*StubCode::UnoptimizedIdenticalWithNumberCheck_entry());
1359 } 1359 }
1360 if (token_pos != Scanner::kNoSourcePos) { 1360 if (token_pos != Scanner::kNoSourcePos) {
1361 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, 1361 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall,
1362 Isolate::kNoDeoptId, 1362 Thread::kNoDeoptId,
1363 token_pos); 1363 token_pos);
1364 } 1364 }
1365 // Stub returns result in flags (result of a cmpq, we need ZF computed). 1365 // Stub returns result in flags (result of a cmpq, we need ZF computed).
1366 __ popq(reg); // Discard constant. 1366 __ popq(reg); // Discard constant.
1367 __ popq(reg); // Restore 'reg'. 1367 __ popq(reg); // Restore 'reg'.
1368 } else { 1368 } else {
1369 __ CompareObject(reg, obj); 1369 __ CompareObject(reg, obj);
1370 } 1370 }
1371 return EQUAL; 1371 return EQUAL;
1372 } 1372 }
1373 1373
1374 1374
1375 Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, 1375 Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left,
1376 Register right, 1376 Register right,
1377 bool needs_number_check, 1377 bool needs_number_check,
1378 intptr_t token_pos) { 1378 intptr_t token_pos) {
1379 if (needs_number_check) { 1379 if (needs_number_check) {
1380 __ pushq(left); 1380 __ pushq(left);
1381 __ pushq(right); 1381 __ pushq(right);
1382 if (is_optimizing()) { 1382 if (is_optimizing()) {
1383 __ CallPatchable(*StubCode::OptimizedIdenticalWithNumberCheck_entry()); 1383 __ CallPatchable(*StubCode::OptimizedIdenticalWithNumberCheck_entry());
1384 } else { 1384 } else {
1385 __ CallPatchable(*StubCode::UnoptimizedIdenticalWithNumberCheck_entry()); 1385 __ CallPatchable(*StubCode::UnoptimizedIdenticalWithNumberCheck_entry());
1386 } 1386 }
1387 if (token_pos != Scanner::kNoSourcePos) { 1387 if (token_pos != Scanner::kNoSourcePos) {
1388 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, 1388 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall,
1389 Isolate::kNoDeoptId, 1389 Thread::kNoDeoptId,
1390 token_pos); 1390 token_pos);
1391 } 1391 }
1392 // Stub returns result in flags (result of a cmpq, we need ZF computed). 1392 // Stub returns result in flags (result of a cmpq, we need ZF computed).
1393 __ popq(right); 1393 __ popq(right);
1394 __ popq(left); 1394 __ popq(left);
1395 } else { 1395 } else {
1396 __ cmpl(left, right); 1396 __ cmpl(left, right);
1397 } 1397 }
1398 return EQUAL; 1398 return EQUAL;
1399 } 1399 }
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 __ movups(reg, Address(RSP, 0)); 1758 __ movups(reg, Address(RSP, 0));
1759 __ AddImmediate(RSP, Immediate(kFpuRegisterSize)); 1759 __ AddImmediate(RSP, Immediate(kFpuRegisterSize));
1760 } 1760 }
1761 1761
1762 1762
1763 #undef __ 1763 #undef __
1764 1764
1765 } // namespace dart 1765 } // namespace dart
1766 1766
1767 #endif // defined TARGET_ARCH_X64 1767 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698