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

Unified Diff: runtime/vm/assembler_mips.h

Issue 12703028: Adds Stop to MIPS. Starts on MIPS call patcher. (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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/assembler_mips.h
===================================================================
--- runtime/vm/assembler_mips.h (revision 20488)
+++ runtime/vm/assembler_mips.h (working copy)
@@ -58,6 +58,10 @@
return (base_ << kRsShift) | imm_value;
}
+ static bool CanHoldOffset(int32_t offset) {
+ return Utils::IsInt(16, offset);
+ }
+
private:
Register base_;
int32_t offset_;
@@ -143,9 +147,7 @@
comments_() { }
~Assembler() { }
- void PopRegister(Register r) {
- UNIMPLEMENTED();
- }
+ void PopRegister(Register r) { Pop(r); }
void Bind(Label* label);
@@ -190,7 +192,7 @@
}
// Debugging and bringup support.
- void Stop(const char* message) { UNIMPLEMENTED(); }
+ void Stop(const char* message);
void Unimplemented(const char* message);
void Untested(const char* message);
void Unreachable(const char* message);
@@ -503,15 +505,86 @@
}
// Macros in alphabetical order.
+
+ void Branch(const ExternalLabel* label) {
+ // Doesn't need to be patchable, so use the delay slot.
+ if (Utils::IsInt(16, label->address())) {
+ jr(TMP);
+ delay_slot()->addiu(TMP, ZR, Immediate(label->address()));
+ } else {
+ uint16_t low = Utils::Low16Bits(label->address());
+ uint16_t high = Utils::High16Bits(label->address());
regis 2013/03/26 00:49:06 You could add const.
zra 2013/03/26 17:29:07 Done.
+ lui(TMP, Immediate(high));
+ jr(TMP);
+ delay_slot()->ori(TMP, TMP, Immediate(low));
+ }
+ }
+
+ void BranchLink(const ExternalLabel* label) {
+ // Doesn't need to be patchable, so use the delay slot.
+ if (Utils::IsInt(16, label->address())) {
+ jalr(TMP);
+ delay_slot()->addiu(TMP, ZR, Immediate(label->address()));
+ } else {
+ uint16_t low = Utils::Low16Bits(label->address());
+ uint16_t high = Utils::High16Bits(label->address());
+ lui(TMP, Immediate(high));
+ jalr(TMP);
+ delay_slot()->ori(TMP, TMP, Immediate(low));
+ }
+ }
+
+ void BranchLinkPatchable(const ExternalLabel* label) {
+ const int32_t offset =
+ Array::data_offset() + 4*AddExternalLabel(label) - kHeapObjectTag;
+ LoadWordFromPoolOffset(TMP, offset);
+ jalr(TMP);
+ }
+
+ void BranchPatchable(const ExternalLabel* label) {
+ LoadImmediate(TMP, label->address());
+ jr(TMP);
+ }
+
+ void Drop(intptr_t stack_elements) {
+ ASSERT(stack_elements >= 0);
+ if (stack_elements > 0) {
+ addiu(SP, SP, Immediate(stack_elements * kWordSize));
+ }
+ }
+
void LoadImmediate(Register rd, int32_t value) {
if (Utils::IsInt(16, value)) {
addiu(rd, ZR, Immediate(value));
} else {
- lui(rd, Immediate((value >> 16) & 0xffff));
- ori(rd, rd, Immediate(value & 0xffff));
+ uint16_t low = Utils::Low16Bits(value);
+ uint16_t high = Utils::High16Bits(value);
regis 2013/03/26 00:49:06 const, or just inline below.
zra 2013/03/26 17:29:07 Done.
+ lui(rd, Immediate(high));
+ ori(rd, rd, Immediate(low));
}
}
+ void Push(Register rt) {
+ addiu(SP, SP, Immediate(-kWordSize));
+ sw(rt, Address(SP));
+ }
+
+ void Pop(Register rt) {
+ lw(rt, Address(SP));
+ addiu(SP, SP, Immediate(kWordSize));
+ }
+
+ void Ret() {
+ jr(RA);
+ }
+
+ void LoadWordFromPoolOffset(Register rd, int32_t offset);
+ void LoadObject(Register rd, const Object& object);
+ void PushObject(const Object& object);
+
+ // Subtracts rn from location of object and places result in rd.
regis 2013/03/26 00:49:06 I do not understand what you mean by 'location'. H
zra 2013/03/26 17:29:07 Done.
+ void CompareObject(Register rd, Register rn, const Object& object);
+
private:
AssemblerBuffer buffer_;
GrowableObjectArray& object_pool_; // Objects and patchable jump targets.
@@ -520,6 +593,9 @@
bool delay_slot_available_;
bool in_delay_slot_;
+ int32_t AddObject(const Object& obj);
+ int32_t AddExternalLabel(const ExternalLabel* label);
+
class CodeComment : public ZoneAllocated {
public:
CodeComment(intptr_t pc_offset, const String& comment)

Powered by Google App Engine
This is Rietveld 408576698