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

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

Issue 798643003: Pass condition result explicitly. Do not imply the existence of a status (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 GenerateDartCall(deopt_id, 1382 GenerateDartCall(deopt_id,
1383 token_pos, 1383 token_pos,
1384 &stub_code->CallStaticFunctionLabel(), 1384 &stub_code->CallStaticFunctionLabel(),
1385 RawPcDescriptors::kOptStaticCall, 1385 RawPcDescriptors::kOptStaticCall,
1386 locs); 1386 locs);
1387 AddStaticCallTarget(function); 1387 AddStaticCallTarget(function);
1388 __ Drop(argument_count); 1388 __ Drop(argument_count);
1389 } 1389 }
1390 1390
1391 1391
1392 void FlowGraphCompiler::EmitEqualityRegConstCompare(Register reg, 1392 Condition FlowGraphCompiler::EmitEqualityRegConstCompare(
1393 const Object& obj, 1393 Register reg,
1394 bool needs_number_check, 1394 const Object& obj,
1395 intptr_t token_pos) { 1395 bool needs_number_check,
1396 intptr_t token_pos) {
1396 __ TraceSimMsg("EqualityRegConstCompare"); 1397 __ TraceSimMsg("EqualityRegConstCompare");
1397 if (needs_number_check) { 1398 if (needs_number_check) {
1398 StubCode* stub_code = isolate()->stub_code(); 1399 StubCode* stub_code = isolate()->stub_code();
1399 ASSERT(!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint()); 1400 ASSERT(!obj.IsMint() && !obj.IsDouble() && !obj.IsBigint());
1400 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 1401 __ addiu(SP, SP, Immediate(-2 * kWordSize));
1401 __ sw(reg, Address(SP, 1 * kWordSize)); 1402 __ sw(reg, Address(SP, 1 * kWordSize));
1402 __ LoadObject(TMP, obj); 1403 __ LoadObject(TMP, obj);
1403 __ sw(TMP, Address(SP, 0 * kWordSize)); 1404 __ sw(TMP, Address(SP, 0 * kWordSize));
1404 if (is_optimizing()) { 1405 if (is_optimizing()) {
1405 __ BranchLinkPatchable( 1406 __ BranchLinkPatchable(
1406 &stub_code->OptimizedIdenticalWithNumberCheckLabel()); 1407 &stub_code->OptimizedIdenticalWithNumberCheckLabel());
1407 } else { 1408 } else {
1408 __ BranchLinkPatchable( 1409 __ BranchLinkPatchable(
1409 &stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); 1410 &stub_code->UnoptimizedIdenticalWithNumberCheckLabel());
1410 } 1411 }
1411 if (token_pos != Scanner::kNoSourcePos) { 1412 if (token_pos != Scanner::kNoSourcePos) {
1412 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, 1413 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall,
1413 Isolate::kNoDeoptId, 1414 Isolate::kNoDeoptId,
1414 token_pos); 1415 token_pos);
1415 } 1416 }
1416 __ TraceSimMsg("EqualityRegConstCompare return"); 1417 __ TraceSimMsg("EqualityRegConstCompare return");
1418 // Stub returns result in CMPRES1 (if it is 0, then reg and obj are
1419 // equal) and always sets CMPRES2 to 0.
1417 __ lw(reg, Address(SP, 1 * kWordSize)); // Restore 'reg'. 1420 __ lw(reg, Address(SP, 1 * kWordSize)); // Restore 'reg'.
1418 __ addiu(SP, SP, Immediate(2 * kWordSize)); // Discard constant. 1421 __ addiu(SP, SP, Immediate(2 * kWordSize)); // Discard constant.
1419 return; 1422 } else {
1423 __ CompareObject(CMPRES1, CMPRES2, reg, obj);
1420 } 1424 }
1421 __ CompareObject(CMPRES1, CMPRES2, reg, obj); 1425 return EQ;
1422 } 1426 }
1423 1427
1424 1428
1425 void FlowGraphCompiler::EmitEqualityRegRegCompare(Register left, 1429 Condition FlowGraphCompiler::EmitEqualityRegRegCompare(Register left,
1426 Register right, 1430 Register right,
1427 bool needs_number_check, 1431 bool needs_number_check,
1428 intptr_t token_pos) { 1432 intptr_t token_pos) {
1429 __ TraceSimMsg("EqualityRegRegCompare"); 1433 __ TraceSimMsg("EqualityRegRegCompare");
1430 __ Comment("EqualityRegRegCompare"); 1434 __ Comment("EqualityRegRegCompare");
1431 if (needs_number_check) { 1435 if (needs_number_check) {
1432 StubCode* stub_code = isolate()->stub_code(); 1436 StubCode* stub_code = isolate()->stub_code();
1433 __ addiu(SP, SP, Immediate(-2 * kWordSize)); 1437 __ addiu(SP, SP, Immediate(-2 * kWordSize));
1434 __ sw(left, Address(SP, 1 * kWordSize)); 1438 __ sw(left, Address(SP, 1 * kWordSize));
1435 __ sw(right, Address(SP, 0 * kWordSize)); 1439 __ sw(right, Address(SP, 0 * kWordSize));
1436 if (is_optimizing()) { 1440 if (is_optimizing()) {
1437 __ BranchLinkPatchable( 1441 __ BranchLinkPatchable(
1438 &stub_code->OptimizedIdenticalWithNumberCheckLabel()); 1442 &stub_code->OptimizedIdenticalWithNumberCheckLabel());
1439 } else { 1443 } else {
1440 __ BranchLinkPatchable( 1444 __ BranchLinkPatchable(
1441 &stub_code->UnoptimizedIdenticalWithNumberCheckLabel()); 1445 &stub_code->UnoptimizedIdenticalWithNumberCheckLabel());
1442 } 1446 }
1443 if (token_pos != Scanner::kNoSourcePos) { 1447 if (token_pos != Scanner::kNoSourcePos) {
1444 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall, 1448 AddCurrentDescriptor(RawPcDescriptors::kRuntimeCall,
1445 Isolate::kNoDeoptId, 1449 Isolate::kNoDeoptId,
1446 token_pos); 1450 token_pos);
1447 } 1451 }
1448 #if defined(DEBUG) 1452 #if defined(DEBUG)
1449 if (!is_optimizing()) { 1453 if (!is_optimizing()) {
1450 // Do this *after* adding the pc descriptor! 1454 // Do this *after* adding the pc descriptor!
1451 __ LoadImmediate(S4, kInvalidObjectPointer); 1455 __ LoadImmediate(S4, kInvalidObjectPointer);
1452 __ LoadImmediate(S5, kInvalidObjectPointer); 1456 __ LoadImmediate(S5, kInvalidObjectPointer);
1453 } 1457 }
1454 #endif 1458 #endif
1455 __ TraceSimMsg("EqualityRegRegCompare return"); 1459 __ TraceSimMsg("EqualityRegRegCompare return");
1456 // Stub returns result in CMPRES1. If it is 0, then left and right are 1460 // Stub returns result in CMPRES1 (if it is 0, then left and right are
1457 // equal. 1461 // equal) and always sets CMPRES2 to 0.
1458 __ lw(right, Address(SP, 0 * kWordSize)); 1462 __ lw(right, Address(SP, 0 * kWordSize));
1459 __ lw(left, Address(SP, 1 * kWordSize)); 1463 __ lw(left, Address(SP, 1 * kWordSize));
1460 __ addiu(SP, SP, Immediate(2 * kWordSize)); 1464 __ addiu(SP, SP, Immediate(2 * kWordSize));
1461 } else { 1465 } else {
1462 __ slt(CMPRES1, left, right); 1466 __ slt(CMPRES1, left, right);
1463 __ slt(CMPRES2, right, left); 1467 __ slt(CMPRES2, right, left);
1464 } 1468 }
1469 return EQ;
1465 } 1470 }
1466 1471
1467 1472
1468 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and 1473 // This function must be in sync with FlowGraphCompiler::RecordSafepoint and
1469 // FlowGraphCompiler::SlowPathEnvironmentFor. 1474 // FlowGraphCompiler::SlowPathEnvironmentFor.
1470 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) { 1475 void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) {
1471 #if defined(DEBUG) 1476 #if defined(DEBUG)
1472 locs->CheckWritableInputs(); 1477 locs->CheckWritableInputs();
1473 ClobberDeadTempRegisters(locs); 1478 ClobberDeadTempRegisters(locs);
1474 #endif 1479 #endif
1475 1480
1476 __ TraceSimMsg("SaveLiveRegisters"); 1481 __ TraceSimMsg("SaveLiveRegisters");
1477 // TODO(vegorov): consider saving only caller save (volatile) registers. 1482 // TODO(vegorov): consider saving only caller save (volatile) registers.
1478 const intptr_t fpu_regs_count= locs->live_registers()->FpuRegisterCount(); 1483 const intptr_t fpu_regs_count = locs->live_registers()->FpuRegisterCount();
1479 if (fpu_regs_count > 0) { 1484 if (fpu_regs_count > 0) {
1480 __ AddImmediate(SP, -(fpu_regs_count * kFpuRegisterSize)); 1485 __ AddImmediate(SP, -(fpu_regs_count * kFpuRegisterSize));
1481 // Store fpu registers with the lowest register number at the lowest 1486 // Store fpu registers with the lowest register number at the lowest
1482 // address. 1487 // address.
1483 intptr_t offset = 0; 1488 intptr_t offset = 0;
1484 for (intptr_t reg_idx = 0; reg_idx < kNumberOfFpuRegisters; ++reg_idx) { 1489 for (intptr_t reg_idx = 0; reg_idx < kNumberOfFpuRegisters; ++reg_idx) {
1485 DRegister fpu_reg = static_cast<DRegister>(reg_idx); 1490 DRegister fpu_reg = static_cast<DRegister>(reg_idx);
1486 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) { 1491 if (locs->live_registers()->ContainsFpuRegister(fpu_reg)) {
1487 __ StoreDToOffset(fpu_reg, SP, offset); 1492 __ StoreDToOffset(fpu_reg, SP, offset);
1488 offset += kFpuRegisterSize; 1493 offset += kFpuRegisterSize;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 __ AddImmediate(SP, kDoubleSize); 1861 __ AddImmediate(SP, kDoubleSize);
1857 } 1862 }
1858 1863
1859 1864
1860 #undef __ 1865 #undef __
1861 1866
1862 1867
1863 } // namespace dart 1868 } // namespace dart
1864 1869
1865 #endif // defined TARGET_ARCH_MIPS 1870 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_ia32.cc ('k') | runtime/vm/flow_graph_compiler_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698