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

Side by Side Diff: runtime/vm/simulator_mips.h

Issue 12545024: Adds a few MIPS arithmetic instructions to the simulator, assembler, disassembler (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 // Declares a Simulator for MIPS instructions if we are not generating a native 5 // Declares a Simulator for MIPS instructions if we are not generating a native
6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation 6 // MIPS binary. This Simulator allows us to run and debug MIPS code generation
7 // on regular desktop machines. 7 // on regular desktop machines.
8 // Dart calls into generated code by "calling" the InvokeDartCode stub, 8 // Dart calls into generated code by "calling" the InvokeDartCode stub,
9 // which will start execution in the Simulator or forwards to the real entry 9 // which will start execution in the Simulator or forwards to the real entry
10 // on a MIPS HW platform. 10 // on a MIPS HW platform.
(...skipping 17 matching lines...) Expand all
28 ~Simulator(); 28 ~Simulator();
29 29
30 // The currently executing Simulator instance, which is associated to the 30 // The currently executing Simulator instance, which is associated to the
31 // current isolate 31 // current isolate
32 static Simulator* Current(); 32 static Simulator* Current();
33 33
34 // Accessors for register state. 34 // Accessors for register state.
35 void set_register(Register reg, int32_t value); 35 void set_register(Register reg, int32_t value);
36 int32_t get_register(Register reg) const; 36 int32_t get_register(Register reg) const;
37 37
38 // Accessors for hi, lo registers.
39 void set_hi_register(int32_t value) { hi_reg_ = value; }
40 void set_lo_register(int32_t value) { lo_reg_ = value; }
41 int32_t get_hi_register() const { return hi_reg_; }
42 int32_t get_lo_register() const { return lo_reg_; }
43
38 // Accessor to the internal simulator stack top. 44 // Accessor to the internal simulator stack top.
39 uword StackTop() const; 45 uword StackTop() const;
40 46
41 // Call on program start. 47 // Call on program start.
42 static void InitOnce(); 48 static void InitOnce();
43 49
44 // Dart generally calls into generated code with 5 parameters. This is a 50 // Dart generally calls into generated code with 5 parameters. This is a
45 // convenience function, which sets up the simulator state and grabs the 51 // convenience function, which sets up the simulator state and grabs the
46 // result on return. 52 // result on return.
47 int64_t Call(int32_t entry, 53 int64_t Call(int32_t entry,
48 int32_t parameter0, 54 int32_t parameter0,
49 int32_t parameter1, 55 int32_t parameter1,
50 int32_t parameter2, 56 int32_t parameter2,
51 int32_t parameter3); 57 int32_t parameter3);
52 58
53 private: 59 private:
54 // A pc value used to signal the simulator to stop execution. Generally 60 // A pc value used to signal the simulator to stop execution. Generally
55 // the ra is set to this value on transition from native C code to 61 // the ra is set to this value on transition from native C code to
56 // simulated execution, so that the simulator can "return" to the native 62 // simulated execution, so that the simulator can "return" to the native
57 // C code. 63 // C code.
58 static const uword kEndSimulatingPC = -1; 64 static const uword kEndSimulatingPC = -1;
59 65
66 // Special registers for the results of div, divu.
67 int32_t hi_reg_;
68 int32_t lo_reg_;
69
60 int32_t registers_[kNumberOfCpuRegisters]; 70 int32_t registers_[kNumberOfCpuRegisters];
61 uword pc_; 71 uword pc_;
62 72
63 // Simulator support. 73 // Simulator support.
64 char* stack_; 74 char* stack_;
65 int icount_; 75 int icount_;
66 bool delay_slot_; 76 bool delay_slot_;
67 77
78 bool OverflowFrom(int32_t alu_out,
79 int32_t left,
80 int32_t right,
81 bool addition);
82
68 void set_pc(uword value) { pc_ = value; } 83 void set_pc(uword value) { pc_ = value; }
69 84
70 void Format(Instr* instr, const char* format); 85 void Format(Instr* instr, const char* format);
71 86
72 void DecodeSpecial(Instr* instr); 87 void DecodeSpecial(Instr* instr);
88 void DecodeSpecial2(Instr* instr);
73 void InstructionDecode(Instr* instr); 89 void InstructionDecode(Instr* instr);
74 90
75 void Execute(); 91 void Execute();
76 void ExecuteDelaySlot(); 92 void ExecuteDelaySlot();
77 }; 93 };
78 94
79 } // namespace dart 95 } // namespace dart
80 96
81 #endif // VM_SIMULATOR_MIPS_H_ 97 #endif // VM_SIMULATOR_MIPS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698