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

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

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, 8 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 #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/constants_mips.h" 8 #include "vm/constants_mips.h"
9 #include "vm/instructions.h" 9 #include "vm/instructions.h"
10 #include "vm/object.h" 10 #include "vm/object.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 CallPattern::CallPattern(uword pc, const Code& code) 14 CallPattern::CallPattern(uword pc, const Code& code)
15 : end_(reinterpret_cast<uword*>(pc)), 15 : end_(reinterpret_cast<uword*>(pc)),
16 pool_index_(DecodePoolIndex()), 16 target_address_pool_index_(-1),
17 object_pool_(Array::Handle(code.ObjectPool())) { } 17 args_desc_load_end_(-1),
18 args_desc_pool_index_(-1),
19 ic_data_load_end_(-1),
20 ic_data_pool_index_(-1),
21 object_pool_(Array::Handle(code.ObjectPool())) {
22 ASSERT(code.ContainsInstructionAt(pc));
23 ASSERT(Back(2) == 0x0020f809); // Last instruction: jalr RA, TMP(=R1)
24 Register reg;
25 // First end is 0 so that we begin from the delay slot of the jalr.
26 args_desc_load_end_ =
27 DecodeLoadWordFromPool(2, &reg, &target_address_pool_index_);
28 ASSERT(reg == TMP);
29 }
18 30
19 31
20 uword CallPattern::Back(int n) const { 32 uword CallPattern::Back(int n) const {
21 ASSERT(n > 0); 33 ASSERT(n > 0);
22 return *(end_ - n); 34 return *(end_ - n);
23 } 35 }
24 36
25 37
26 int CallPattern::DecodePoolIndex() { 38 int CallPattern::DecodeLoadWordFromPool(int end, Register* reg, int* index) {
39 ASSERT(end > 0);
40 uword i = Back(++end);
41 Instr* instr = Instr::At(reinterpret_cast<uword>(&i));
42 int offset = 0;
43 if ((instr->OpcodeField() == LW) && (instr->RsField() == PP)) {
44 offset = instr->SImmField();
45 *reg = instr->RtField();
46 } else {
47 ASSERT(instr->OpcodeField() == LW);
48 offset = instr->SImmField();
49 i = Back(++end);
50 instr = Instr::At(reinterpret_cast<uword>(&i));
51 ASSERT((instr->OpcodeField() == SPECIAL) &&
52 (instr->FunctionField() == ADDU));
53 *reg = instr->RdField();
54 i = Back(++end);
55 instr = Instr::At(reinterpret_cast<uword>(&i));
56 if (instr->OpcodeField() == ADDIU) {
57 ASSERT((instr->RsField() == R0) && (instr->RtField() == *reg));
58 offset = instr->SImmField();
regis 2013/03/26 00:49:06 Shouldn't it be offset |= ?
zra 2013/03/26 17:29:07 Fixed-up to match LoadWordFromPoolOffset
59 } else {
60 ASSERT((instr->OpcodeField() == ORI) && (instr->RtField() == *reg) &&
61 (instr->RsField() == *reg));
62 offset |= instr->UImmField();
63 i = Back(++end);
64 instr = Instr::At(reinterpret_cast<uword>(&i));
65 ASSERT((instr->OpcodeField() == LUI) && (instr->RtField() == *reg));
66 offset |= (instr->UImmField() << 16);
67 }
68 }
69 offset += kHeapObjectTag;
70 ASSERT(Utils::IsAligned(offset, 4));
71 *index = (offset - Array::data_offset())/4;
72 return end;
73 }
74
75
76 RawICData* CallPattern::IcData() {
27 UNIMPLEMENTED(); 77 UNIMPLEMENTED();
28 return 0; 78 return NULL;
79 }
80
81
82 RawArray* CallPattern::ArgumentsDescriptor() {
83 UNIMPLEMENTED();
84 return NULL;
29 } 85 }
30 86
31 87
32 uword CallPattern::TargetAddress() const { 88 uword CallPattern::TargetAddress() const {
33 UNIMPLEMENTED(); 89 ASSERT(target_address_pool_index_ >= 0);
34 return 0; 90 const Object& target_address =
91 Object::Handle(object_pool_.At(target_address_pool_index_));
92 ASSERT(target_address.IsSmi());
93 // The address is stored in the object array as a RawSmi.
94 return reinterpret_cast<uword>(target_address.raw());
35 } 95 }
36 96
37 97
38 void CallPattern::SetTargetAddress(uword target_address) const { 98 void CallPattern::SetTargetAddress(uword target_address) const {
39 UNIMPLEMENTED(); 99 UNIMPLEMENTED();
40 } 100 }
41 101
42 102
43 JumpPattern::JumpPattern(uword pc) : pc_(pc) { } 103 JumpPattern::JumpPattern(uword pc) : pc_(pc) { }
44 104
(...skipping 11 matching lines...) Expand all
56 116
57 117
58 void JumpPattern::SetTargetAddress(uword target_address) const { 118 void JumpPattern::SetTargetAddress(uword target_address) const {
59 UNIMPLEMENTED(); 119 UNIMPLEMENTED();
60 } 120 }
61 121
62 } // namespace dart 122 } // namespace dart
63 123
64 #endif // defined TARGET_ARCH_MIPS 124 #endif // defined TARGET_ARCH_MIPS
65 125
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698