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

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, 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 #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) {
regis 2013/03/25 23:03:40 You are missing parenthesis pairs here and below.
zra 2013/03/25 23:39:17 Done.
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 && instr->FunctionField() == ADDU);
52 *reg = instr->RdField();
53 i = Back(++end);
54 instr = Instr::At(reinterpret_cast<uword>(&i));
55 if (instr->OpcodeField() == ADDIU) {
56 ASSERT(instr->RsField() == R0 && instr->RtField() == *reg);
57 offset = instr->SImmField();
58 } else {
59 ASSERT(instr->OpcodeField() == ORI && instr->RtField() == *reg &&
60 instr->RsField() == *reg);
61 offset |= instr->UImmField();
62 i = Back(++end);
63 instr = Instr::At(reinterpret_cast<uword>(&i));
64 ASSERT(instr->OpcodeField() == LUI && instr->RtField() == *reg);
65 offset |= (instr->UImmField() << 16);
66 }
67 }
68 offset += kHeapObjectTag;
69 ASSERT(Utils::IsAligned(offset, 4));
70 *index = (offset - Array::data_offset())/4;
71 return end;
72 }
73
74
75 RawICData* CallPattern::IcData() {
27 UNIMPLEMENTED(); 76 UNIMPLEMENTED();
28 return 0; 77 return NULL;
78 }
79
80
81 RawArray* CallPattern::ArgumentsDescriptor() {
82 UNIMPLEMENTED();
83 return NULL;
29 } 84 }
30 85
31 86
32 uword CallPattern::TargetAddress() const { 87 uword CallPattern::TargetAddress() const {
33 UNIMPLEMENTED(); 88 ASSERT(target_address_pool_index_ >= 0);
34 return 0; 89 const Object& target_address =
90 Object::Handle(object_pool_.At(target_address_pool_index_));
91 ASSERT(target_address.IsSmi());
92 // The address is stored in the object array as a RawSmi.
93 return reinterpret_cast<uword>(target_address.raw());
35 } 94 }
36 95
37 96
38 void CallPattern::SetTargetAddress(uword target_address) const { 97 void CallPattern::SetTargetAddress(uword target_address) const {
39 UNIMPLEMENTED(); 98 UNIMPLEMENTED();
40 } 99 }
41 100
42 101
43 JumpPattern::JumpPattern(uword pc) : pc_(pc) { } 102 JumpPattern::JumpPattern(uword pc) : pc_(pc) { }
44 103
(...skipping 11 matching lines...) Expand all
56 115
57 116
58 void JumpPattern::SetTargetAddress(uword target_address) const { 117 void JumpPattern::SetTargetAddress(uword target_address) const {
59 UNIMPLEMENTED(); 118 UNIMPLEMENTED();
60 } 119 }
61 120
62 } // namespace dart 121 } // namespace dart
63 122
64 #endif // defined TARGET_ARCH_MIPS 123 #endif // defined TARGET_ARCH_MIPS
65 124
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698