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

Side by Side Diff: runtime/vm/simulator_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64) 9 #if defined(TARGET_ARCH_ARM64)
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_ARM64) 12 #if !defined(HOST_ARCH_ARM64)
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_arm64.h" 17 #include "vm/constants_arm64.h"
18 #include "vm/disassembler.h" 18 #include "vm/disassembler.h"
19 #include "vm/lockers.h" 19 #include "vm/lockers.h"
20 #include "vm/native_arguments.h" 20 #include "vm/native_arguments.h"
21 #include "vm/stack_frame.h" 21 #include "vm/stack_frame.h"
22 #include "vm/thread.h" 22 #include "vm/thread.h"
23 23
24 namespace dart { 24 namespace dart {
25 25
26 DEFINE_FLAG(bool, trace_sim, false, "Trace simulator execution."); 26 DEFINE_FLAG(int, trace_sim_after, -1,
27 DEFINE_FLAG(int, stop_sim_at, 0, 27 "Trace simulator execution after instruction count reached.");
28 DEFINE_FLAG(int, stop_sim_at, -1,
28 "Instruction address or instruction count to stop simulator at."); 29 "Instruction address or instruction count to stop simulator at.");
29 30
30 31
31 // This macro provides a platform independent use of sscanf. The reason for 32 // This macro provides a platform independent use of sscanf. The reason for
32 // SScanF not being implemented in a platform independent way through 33 // SScanF not being implemented in a platform independent way through
33 // OS in the same way as SNPrint is that the Windows C Run-Time 34 // OS in the same way as SNPrint is that the Windows C Run-Time
34 // Library does not provide vsscanf. 35 // Library does not provide vsscanf.
35 #define SScanF sscanf // NOLINT 36 #define SScanF sscanf // NOLINT
36 37
37 38
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 OS::Print("V flag: %d\n", sim_->v_flag_); 633 OS::Print("V flag: %d\n", sim_->v_flag_);
633 } else if (strcmp(cmd, "unstop") == 0) { 634 } else if (strcmp(cmd, "unstop") == 0) {
634 intptr_t stop_pc = sim_->get_pc() - Instr::kInstrSize; 635 intptr_t stop_pc = sim_->get_pc() - Instr::kInstrSize;
635 Instr* stop_instr = reinterpret_cast<Instr*>(stop_pc); 636 Instr* stop_instr = reinterpret_cast<Instr*>(stop_pc);
636 if (stop_instr->IsExceptionGenOp()) { 637 if (stop_instr->IsExceptionGenOp()) {
637 stop_instr->SetInstructionBits(Instr::kNopInstruction); 638 stop_instr->SetInstructionBits(Instr::kNopInstruction);
638 } else { 639 } else {
639 OS::Print("Not at debugger stop.\n"); 640 OS::Print("Not at debugger stop.\n");
640 } 641 }
641 } else if (strcmp(cmd, "trace") == 0) { 642 } else if (strcmp(cmd, "trace") == 0) {
642 FLAG_trace_sim = !FLAG_trace_sim; 643 if (FLAG_trace_sim_after == -1) {
643 OS::Print("execution tracing %s\n", FLAG_trace_sim ? "on" : "off"); 644 FLAG_trace_sim_after = sim_->get_icount();
645 OS::Print("execution tracing on\n");
646 } else {
647 FLAG_trace_sim_after = -1;
648 OS::Print("execution tracing off\n");
649 }
644 } else if (strcmp(cmd, "bt") == 0) { 650 } else if (strcmp(cmd, "bt") == 0) {
645 PrintBacktrace(); 651 PrintBacktrace();
646 } else { 652 } else {
647 OS::Print("Unknown command: %s\n", cmd); 653 OS::Print("Unknown command: %s\n", cmd);
648 } 654 }
649 } 655 }
650 delete[] line; 656 delete[] line;
651 } 657 }
652 658
653 // Add all the breakpoints back to stop execution and enter the debugger 659 // Add all the breakpoints back to stop execution and enter the debugger
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1550 typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments); 1556 typedef void (*SimulatorBootstrapNativeCall)(NativeArguments* arguments);
1551 typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target); 1557 typedef void (*SimulatorNativeCall)(NativeArguments* arguments, uword target);
1552 1558
1553 1559
1554 void Simulator::DoRedirectedCall(Instr* instr) { 1560 void Simulator::DoRedirectedCall(Instr* instr) {
1555 SimulatorSetjmpBuffer buffer(this); 1561 SimulatorSetjmpBuffer buffer(this);
1556 if (!setjmp(buffer.buffer_)) { 1562 if (!setjmp(buffer.buffer_)) {
1557 int64_t saved_lr = get_register(LR); 1563 int64_t saved_lr = get_register(LR);
1558 Redirection* redirection = Redirection::FromHltInstruction(instr); 1564 Redirection* redirection = Redirection::FromHltInstruction(instr);
1559 uword external = redirection->external_function(); 1565 uword external = redirection->external_function();
1560 if (FLAG_trace_sim) { 1566 if (static_cast<uintptr_t>(icount_) >
zra 2014/12/19 17:49:47 Same comment.
regis 2014/12/22 20:17:34 Done.
1567 static_cast<uintptr_t>(FLAG_trace_sim_after)) {
1561 OS::Print("Call to host function at 0x%" Pd "\n", external); 1568 OS::Print("Call to host function at 0x%" Pd "\n", external);
1562 } 1569 }
1563 1570
1564 if ((redirection->call_kind() == kRuntimeCall) || 1571 if ((redirection->call_kind() == kRuntimeCall) ||
1565 (redirection->call_kind() == kBootstrapNativeCall) || 1572 (redirection->call_kind() == kBootstrapNativeCall) ||
1566 (redirection->call_kind() == kNativeCall)) { 1573 (redirection->call_kind() == kNativeCall)) {
1567 // Set the top_exit_frame_info of this simulator to the native stack. 1574 // Set the top_exit_frame_info of this simulator to the native stack.
1568 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer)); 1575 set_top_exit_frame_info(reinterpret_cast<uword>(&buffer));
1569 } 1576 }
1570 if (redirection->call_kind() == kRuntimeCall) { 1577 if (redirection->call_kind() == kRuntimeCall) {
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 DecodeFP(instr); 3272 DecodeFP(instr);
3266 } else { 3273 } else {
3267 UnimplementedInstruction(instr); 3274 UnimplementedInstruction(instr);
3268 } 3275 }
3269 } 3276 }
3270 3277
3271 3278
3272 // Executes the current instruction. 3279 // Executes the current instruction.
3273 void Simulator::InstructionDecode(Instr* instr) { 3280 void Simulator::InstructionDecode(Instr* instr) {
3274 pc_modified_ = false; 3281 pc_modified_ = false;
3275 if (FLAG_trace_sim) { 3282 if (static_cast<uintptr_t>(icount_) >
3283 static_cast<uintptr_t>(FLAG_trace_sim_after)) {
3284 OS::Print("%"Pu64" ", icount_);
3276 const uword start = reinterpret_cast<uword>(instr); 3285 const uword start = reinterpret_cast<uword>(instr);
3277 const uword end = start + Instr::kInstrSize; 3286 const uword end = start + Instr::kInstrSize;
3278 Disassembler::Disassemble(start, end); 3287 Disassembler::Disassemble(start, end);
3279 } 3288 }
3280 3289
3281 if (instr->IsDPImmediateOp()) { 3290 if (instr->IsDPImmediateOp()) {
3282 DecodeDPImmediate(instr); 3291 DecodeDPImmediate(instr);
3283 } else if (instr->IsCompareBranchOp()) { 3292 } else if (instr->IsCompareBranchOp()) {
3284 DecodeCompareBranch(instr); 3293 DecodeCompareBranch(instr);
3285 } else if (instr->IsLoadStoreOp()) { 3294 } else if (instr->IsLoadStoreOp()) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); 3479 set_register(NULL, kExceptionObjectReg, bit_cast<int64_t>(raw_exception));
3471 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); 3480 set_register(NULL, kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace));
3472 buf->Longjmp(); 3481 buf->Longjmp();
3473 } 3482 }
3474 3483
3475 } // namespace dart 3484 } // namespace dart
3476 3485
3477 #endif // !defined(HOST_ARCH_ARM64) 3486 #endif // !defined(HOST_ARCH_ARM64)
3478 3487
3479 #endif // defined TARGET_ARCH_ARM64 3488 #endif // defined TARGET_ARCH_ARM64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698