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

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

Issue 817593002: Improve generated MIPS code for conditional expressions and branches by delaying (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
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 <setjmp.h> 5 #include <setjmp.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #if defined(TARGET_ARCH_ARM) 9 #if defined(TARGET_ARCH_ARM)
10 10
11 // Only build the simulator if not compiling for real ARM hardware. 11 // Only build the simulator if not compiling for real ARM hardware.
12 #if !defined(HOST_ARCH_ARM) 12 #if !defined(HOST_ARCH_ARM)
13 13
14 #include "vm/simulator.h" 14 #include "vm/simulator.h"
15 15
16 #include "vm/assembler.h" 16 #include "vm/assembler.h"
17 #include "vm/constants_arm.h" 17 #include "vm/constants_arm.h"
18 #include "vm/cpu.h" 18 #include "vm/cpu.h"
19 #include "vm/disassembler.h" 19 #include "vm/disassembler.h"
20 #include "vm/lockers.h" 20 #include "vm/lockers.h"
21 #include "vm/native_arguments.h" 21 #include "vm/native_arguments.h"
22 #include "vm/stack_frame.h" 22 #include "vm/stack_frame.h"
23 #include "vm/thread.h" 23 #include "vm/thread.h"
24 24
25 namespace dart { 25 namespace dart {
26 26
27 DEFINE_FLAG(bool, trace_sim, false, "Trace simulator execution."); 27 DEFINE_FLAG(int, trace_sim_after, -1,
28 DEFINE_FLAG(int, stop_sim_at, 0, 28 "Trace simulator execution after instruction count reached.");
29 DEFINE_FLAG(int, stop_sim_at, -1,
29 "Instruction address or instruction count to stop simulator at."); 30 "Instruction address or instruction count to stop simulator at.");
30 31
31 32
32 // This macro provides a platform independent use of sscanf. The reason for 33 // This macro provides a platform independent use of sscanf. The reason for
33 // SScanF not being implemented in a platform independent way through 34 // SScanF not being implemented in a platform independent way through
34 // OS in the same way as SNPrint is that the Windows C Run-Time 35 // OS in the same way as SNPrint is that the Windows C Run-Time
35 // Library does not provide vsscanf. 36 // Library does not provide vsscanf.
36 #define SScanF sscanf // NOLINT 37 #define SScanF sscanf // NOLINT
37 38
38 39
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 OS::Print("V flag: %d\n", sim_->fp_v_flag_); 587 OS::Print("V flag: %d\n", sim_->fp_v_flag_);
587 } else if (strcmp(cmd, "unstop") == 0) { 588 } else if (strcmp(cmd, "unstop") == 0) {
588 intptr_t stop_pc = sim_->get_pc() - Instr::kInstrSize; 589 intptr_t stop_pc = sim_->get_pc() - Instr::kInstrSize;
589 Instr* stop_instr = reinterpret_cast<Instr*>(stop_pc); 590 Instr* stop_instr = reinterpret_cast<Instr*>(stop_pc);
590 if (stop_instr->IsSvc() || stop_instr->IsBkpt()) { 591 if (stop_instr->IsSvc() || stop_instr->IsBkpt()) {
591 stop_instr->SetInstructionBits(Instr::kNopInstruction); 592 stop_instr->SetInstructionBits(Instr::kNopInstruction);
592 } else { 593 } else {
593 OS::Print("Not at debugger stop.\n"); 594 OS::Print("Not at debugger stop.\n");
594 } 595 }
595 } else if (strcmp(cmd, "trace") == 0) { 596 } else if (strcmp(cmd, "trace") == 0) {
596 FLAG_trace_sim = !FLAG_trace_sim; 597 if (FLAG_trace_sim_after == -1) {
597 OS::Print("execution tracing %s\n", FLAG_trace_sim ? "on" : "off"); 598 FLAG_trace_sim_after = sim_->get_icount();
599 OS::Print("execution tracing on\n");
600 } else {
601 FLAG_trace_sim_after = -1;
602 OS::Print("execution tracing off\n");
603 }
598 } else if (strcmp(cmd, "bt") == 0) { 604 } else if (strcmp(cmd, "bt") == 0) {
599 PrintBacktrace(); 605 PrintBacktrace();
600 } else { 606 } else {
601 OS::Print("Unknown command: %s\n", cmd); 607 OS::Print("Unknown command: %s\n", cmd);
602 } 608 }
603 } 609 }
604 delete[] line; 610 delete[] line;
605 } 611 }
606 612
607 // Add all the breakpoints back to stop execution and enter the debugger 613 // Add all the breakpoints back to stop execution and enter the debugger
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1489 void Simulator::SupervisorCall(Instr* instr) { 1495 void Simulator::SupervisorCall(Instr* instr) {
1490 int svc = instr->SvcField(); 1496 int svc = instr->SvcField();
1491 switch (svc) { 1497 switch (svc) {
1492 case kRedirectionSvcCode: { 1498 case kRedirectionSvcCode: {
1493 SimulatorSetjmpBuffer buffer(this); 1499 SimulatorSetjmpBuffer buffer(this);
1494 1500
1495 if (!setjmp(buffer.buffer_)) { 1501 if (!setjmp(buffer.buffer_)) {
1496 int32_t saved_lr = get_register(LR); 1502 int32_t saved_lr = get_register(LR);
1497 Redirection* redirection = Redirection::FromSvcInstruction(instr); 1503 Redirection* redirection = Redirection::FromSvcInstruction(instr);
1498 uword external = redirection->external_function(); 1504 uword external = redirection->external_function();
1499 if (FLAG_trace_sim) { 1505 if (static_cast<uintptr_t>(icount_) >
zra 2014/12/19 17:49:47 Maybe move this condition to a function with a com
regis 2014/12/22 20:17:34 Done.
1506 static_cast<uintptr_t>(FLAG_trace_sim_after)) {
1500 OS::Print("Call to host function at 0x%" Pd "\n", external); 1507 OS::Print("Call to host function at 0x%" Pd "\n", external);
1501 } 1508 }
1502 1509
1503 if ((redirection->call_kind() == kRuntimeCall) || 1510 if ((redirection->call_kind() == kRuntimeCall) ||
1504 (redirection->call_kind() == kBootstrapNativeCall) || 1511 (redirection->call_kind() == kBootstrapNativeCall) ||
1505 (redirection->call_kind() == kNativeCall)) { 1512 (redirection->call_kind() == kNativeCall)) {
1506 // Set the top_exit_frame_info of this simulator to the native stack. 1513 // Set the top_exit_frame_info of this simulator to the native stack.
1507 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer)); 1514 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer));
1508 } 1515 }
1509 if (redirection->call_kind() == kRuntimeCall) { 1516 if (redirection->call_kind() == kRuntimeCall) {
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after
3559 } else { 3566 } else {
3560 UnimplementedInstruction(instr); 3567 UnimplementedInstruction(instr);
3561 } 3568 }
3562 } 3569 }
3563 } 3570 }
3564 3571
3565 3572
3566 // Executes the current instruction. 3573 // Executes the current instruction.
3567 void Simulator::InstructionDecode(Instr* instr) { 3574 void Simulator::InstructionDecode(Instr* instr) {
3568 pc_modified_ = false; 3575 pc_modified_ = false;
3569 if (FLAG_trace_sim) { 3576 if (static_cast<uintptr_t>(icount_) >
3577 static_cast<uintptr_t>(FLAG_trace_sim_after)) {
3578 OS::Print("%u ", icount_);
3570 const uword start = reinterpret_cast<uword>(instr); 3579 const uword start = reinterpret_cast<uword>(instr);
3571 const uword end = start + Instr::kInstrSize; 3580 const uword end = start + Instr::kInstrSize;
3572 Disassembler::Disassemble(start, end); 3581 Disassembler::Disassemble(start, end);
3573 } 3582 }
3574 if (instr->ConditionField() == kSpecialCondition) { 3583 if (instr->ConditionField() == kSpecialCondition) {
3575 if (instr->InstructionBits() == static_cast<int32_t>(0xf57ff01f)) { 3584 if (instr->InstructionBits() == static_cast<int32_t>(0xf57ff01f)) {
3576 // Format(instr, "clrex"); 3585 // Format(instr, "clrex");
3577 ClearExclusive(); 3586 ClearExclusive();
3578 } else { 3587 } else {
3579 if (instr->IsSIMDDataProcessing()) { 3588 if (instr->IsSIMDDataProcessing()) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
3857 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3866 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3858 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3867 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3859 buf->Longjmp(); 3868 buf->Longjmp();
3860 } 3869 }
3861 3870
3862 } // namespace dart 3871 } // namespace dart
3863 3872
3864 #endif // !defined(HOST_ARCH_ARM) 3873 #endif // !defined(HOST_ARCH_ARM)
3865 3874
3866 #endif // defined TARGET_ARCH_ARM 3875 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698