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

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

Issue 829133006: VM: Small generated code size improvements on x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
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 | 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 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 StubCode* stub_code = isolate()->stub_code(); 1242 StubCode* stub_code = isolate()->stub_code();
1243 const uword label_address = 1243 const uword label_address =
1244 stub_code->UnoptimizedStaticCallEntryPoint(ic_data.NumArgsTested()); 1244 stub_code->UnoptimizedStaticCallEntryPoint(ic_data.NumArgsTested());
1245 ExternalLabel target_label(label_address); 1245 ExternalLabel target_label(label_address);
1246 __ LoadObject(RBX, ic_data, PP); 1246 __ LoadObject(RBX, ic_data, PP);
1247 GenerateDartCall(deopt_id, 1247 GenerateDartCall(deopt_id,
1248 token_pos, 1248 token_pos,
1249 &target_label, 1249 &target_label,
1250 RawPcDescriptors::kUnoptStaticCall, 1250 RawPcDescriptors::kUnoptStaticCall,
1251 locs); 1251 locs);
1252 __ Drop(argument_count); 1252 __ Drop(argument_count, RCX);
zra 2015/01/08 15:50:09 A comment here (and below for other situations) ab
Florian Schneider 2015/01/08 16:15:30 No bug fix, but TMP requires a REX prefix. Using R
1253 #if defined(DEBUG) 1253 #if defined(DEBUG)
1254 __ movq(RBX, Immediate(kInvalidObjectPointer)); 1254 __ movq(RBX, Immediate(kInvalidObjectPointer));
1255 __ movq(R10, Immediate(kInvalidObjectPointer)); 1255 __ movq(R10, Immediate(kInvalidObjectPointer));
1256 #endif 1256 #endif
1257 } 1257 }
1258 1258
1259 1259
1260 void FlowGraphCompiler::EmitEdgeCounter() { 1260 void FlowGraphCompiler::EmitEdgeCounter() {
1261 // We do not check for overflow when incrementing the edge counter. The 1261 // We do not check for overflow when incrementing the edge counter. The
1262 // function should normally be optimized long before the counter can 1262 // function should normally be optimized long before the counter can
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 // top-level function (parsed_function().function()) which could be 1304 // top-level function (parsed_function().function()) which could be
1305 // reoptimized and which counter needs to be incremented. 1305 // reoptimized and which counter needs to be incremented.
1306 // Pass the function explicitly, it is used in IC stub. 1306 // Pass the function explicitly, it is used in IC stub.
1307 __ LoadObject(RDI, parsed_function().function(), PP); 1307 __ LoadObject(RDI, parsed_function().function(), PP);
1308 __ LoadObject(RBX, ic_data, PP); 1308 __ LoadObject(RBX, ic_data, PP);
1309 GenerateDartCall(deopt_id, 1309 GenerateDartCall(deopt_id,
1310 token_pos, 1310 token_pos,
1311 target_label, 1311 target_label,
1312 RawPcDescriptors::kIcCall, 1312 RawPcDescriptors::kIcCall,
1313 locs); 1313 locs);
1314 __ Drop(argument_count); 1314 __ Drop(argument_count, RCX);
1315 } 1315 }
1316 1316
1317 1317
1318 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label, 1318 void FlowGraphCompiler::EmitInstanceCall(ExternalLabel* target_label,
1319 const ICData& ic_data, 1319 const ICData& ic_data,
1320 intptr_t argument_count, 1320 intptr_t argument_count,
1321 intptr_t deopt_id, 1321 intptr_t deopt_id,
1322 intptr_t token_pos, 1322 intptr_t token_pos,
1323 LocationSummary* locs) { 1323 LocationSummary* locs) {
1324 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0); 1324 ASSERT(Array::Handle(ic_data.arguments_descriptor()).Length() > 0);
1325 __ LoadObject(RBX, ic_data, PP); 1325 __ LoadObject(RBX, ic_data, PP);
1326 GenerateDartCall(deopt_id, 1326 GenerateDartCall(deopt_id,
1327 token_pos, 1327 token_pos,
1328 target_label, 1328 target_label,
1329 RawPcDescriptors::kIcCall, 1329 RawPcDescriptors::kIcCall,
1330 locs); 1330 locs);
1331 __ Drop(argument_count); 1331 __ Drop(argument_count, RCX);
1332 #if defined(DEBUG) 1332 #if defined(DEBUG)
1333 __ movq(R10, Immediate(kInvalidObjectPointer)); 1333 __ movq(R10, Immediate(kInvalidObjectPointer));
1334 #endif 1334 #endif
1335 } 1335 }
1336 1336
1337 1337
1338 void FlowGraphCompiler::EmitMegamorphicInstanceCall( 1338 void FlowGraphCompiler::EmitMegamorphicInstanceCall(
1339 const ICData& ic_data, 1339 const ICData& ic_data,
1340 intptr_t argument_count, 1340 intptr_t argument_count,
1341 intptr_t deopt_id, 1341 intptr_t deopt_id,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 __ movq(RCX, FieldAddress(RAX, Function::instructions_offset())); 1385 __ movq(RCX, FieldAddress(RAX, Function::instructions_offset()));
1386 __ LoadObject(RBX, ic_data, PP); 1386 __ LoadObject(RBX, ic_data, PP);
1387 __ LoadObject(R10, arguments_descriptor, PP); 1387 __ LoadObject(R10, arguments_descriptor, PP);
1388 __ AddImmediate( 1388 __ AddImmediate(
1389 RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP); 1389 RCX, Immediate(Instructions::HeaderSize() - kHeapObjectTag), PP);
1390 __ call(RCX); 1390 __ call(RCX);
1391 AddCurrentDescriptor(RawPcDescriptors::kOther, 1391 AddCurrentDescriptor(RawPcDescriptors::kOther,
1392 Isolate::kNoDeoptId, token_pos); 1392 Isolate::kNoDeoptId, token_pos);
1393 RecordSafepoint(locs); 1393 RecordSafepoint(locs);
1394 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos); 1394 AddDeoptIndexAtCall(Isolate::ToDeoptAfter(deopt_id), token_pos);
1395 __ Drop(argument_count); 1395 __ Drop(argument_count, RCX);
1396 } 1396 }
1397 1397
1398 1398
1399 void FlowGraphCompiler::EmitOptimizedStaticCall( 1399 void FlowGraphCompiler::EmitOptimizedStaticCall(
1400 const Function& function, 1400 const Function& function,
1401 const Array& arguments_descriptor, 1401 const Array& arguments_descriptor,
1402 intptr_t argument_count, 1402 intptr_t argument_count,
1403 intptr_t deopt_id, 1403 intptr_t deopt_id,
1404 intptr_t token_pos, 1404 intptr_t token_pos,
1405 LocationSummary* locs) { 1405 LocationSummary* locs) {
1406 StubCode* stub_code = isolate()->stub_code(); 1406 StubCode* stub_code = isolate()->stub_code();
1407 __ LoadObject(R10, arguments_descriptor, PP); 1407 __ LoadObject(R10, arguments_descriptor, PP);
1408 // Do not use the code from the function, but let the code be patched so that 1408 // Do not use the code from the function, but let the code be patched so that
1409 // we can record the outgoing edges to other code. 1409 // we can record the outgoing edges to other code.
1410 GenerateDartCall(deopt_id, 1410 GenerateDartCall(deopt_id,
1411 token_pos, 1411 token_pos,
1412 &stub_code->CallStaticFunctionLabel(), 1412 &stub_code->CallStaticFunctionLabel(),
1413 RawPcDescriptors::kOptStaticCall, 1413 RawPcDescriptors::kOptStaticCall,
1414 locs); 1414 locs);
1415 AddStaticCallTarget(function); 1415 AddStaticCallTarget(function);
1416 __ Drop(argument_count); 1416 __ Drop(argument_count, RCX);
1417 } 1417 }
1418 1418
1419 1419
1420 Condition FlowGraphCompiler::EmitEqualityRegConstCompare( 1420 Condition FlowGraphCompiler::EmitEqualityRegConstCompare(
1421 Register reg, 1421 Register reg,
1422 const Object& obj, 1422 const Object& obj,
1423 bool needs_number_check, 1423 bool needs_number_check,
1424 intptr_t token_pos) { 1424 intptr_t token_pos) {
1425 ASSERT(!needs_number_check || 1425 ASSERT(!needs_number_check ||
1426 (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint())); 1426 (!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint()));
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 } 1558 }
1559 // Do not use the code from the function, but let the code be patched so 1559 // Do not use the code from the function, but let the code be patched so
1560 // that we can record the outgoing edges to other code. 1560 // that we can record the outgoing edges to other code.
1561 GenerateDartCall(deopt_id, 1561 GenerateDartCall(deopt_id,
1562 token_index, 1562 token_index,
1563 &stub_code->CallStaticFunctionLabel(), 1563 &stub_code->CallStaticFunctionLabel(),
1564 RawPcDescriptors::kOptStaticCall, 1564 RawPcDescriptors::kOptStaticCall,
1565 locs); 1565 locs);
1566 const Function& function = *sorted[i].target; 1566 const Function& function = *sorted[i].target;
1567 AddStaticCallTarget(function); 1567 AddStaticCallTarget(function);
1568 __ Drop(argument_count); 1568 __ Drop(argument_count, RCX);
1569 if (!is_last_check) { 1569 if (!is_last_check) {
1570 __ jmp(&match_found); 1570 __ jmp(&match_found);
1571 } 1571 }
1572 __ Bind(&next_test); 1572 __ Bind(&next_test);
1573 } 1573 }
1574 __ Bind(&match_found); 1574 __ Bind(&match_found);
1575 } 1575 }
1576 1576
1577 1577
1578 #undef __ 1578 #undef __
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 __ movups(reg, Address(RSP, 0)); 1806 __ movups(reg, Address(RSP, 0));
1807 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); 1807 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP);
1808 } 1808 }
1809 1809
1810 1810
1811 #undef __ 1811 #undef __
1812 1812
1813 } // namespace dart 1813 } // namespace dart
1814 1814
1815 #endif // defined TARGET_ARCH_X64 1815 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698