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

Side by Side Diff: runtime/vm/assembler_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" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 9
10 namespace dart { 10 namespace dart {
11 11
12 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); 12 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message.");
13 13
14 14
15 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { 15 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) {
16 ASSERT(Utils::IsAligned(data, 4)); 16 ASSERT(Utils::IsAligned(data, 4));
17 ASSERT(Utils::IsAligned(length, 4)); 17 ASSERT(Utils::IsAligned(length, 4));
18 const uword end = data + length; 18 const uword end = data + length;
19 while (data < end) { 19 while (data < end) {
20 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction; 20 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction;
21 data += 4; 21 data += 4;
22 } 22 }
(...skipping 26 matching lines...) Expand all
49 offset &= kBranchOffsetMask; 49 offset &= kBranchOffsetMask;
50 return (instr & ~kBranchOffsetMask) | offset; 50 return (instr & ~kBranchOffsetMask) | offset;
51 } 51 }
52 52
53 53
54 int Assembler::DecodeBranchOffset(int32_t instr) { 54 int Assembler::DecodeBranchOffset(int32_t instr) {
55 // Sign-extend, left-shift by 2. 55 // Sign-extend, left-shift by 2.
56 return (((instr & kBranchOffsetMask) << 16) >> 14); 56 return (((instr & kBranchOffsetMask) << 16) >> 14);
57 } 57 }
58 58
59
60 void Assembler::LoadWordFromPoolOffset(Register rd, int32_t offset) {
61 ASSERT(rd != PP);
62 if (Address::CanHoldOffset(offset)) {
63 lw(rd, Address(PP, offset));
64 } else {
65 LoadImmediate(rd, offset);
66 addu(rd, rd, PP);
67 lw(rd, Address(rd));
regis 2013/03/26 00:49:06 I think you can do slightly better here, by using
zra 2013/03/26 17:29:07 Done.
68 }
69 }
70
71
72 int32_t Assembler::AddObject(const Object& obj) {
73 ASSERT(obj.IsNotTemporaryScopedHandle());
74 ASSERT(obj.IsOld());
75 if (object_pool_.IsNull()) {
76 // The object pool cannot be used in the vm isolate.
77 ASSERT(Isolate::Current() != Dart::vm_isolate());
78 object_pool_ = GrowableObjectArray::New(Heap::kOld);
79 }
80 for (int i = 0; i < object_pool_.Length(); i++) {
81 if (object_pool_.At(i) == obj.raw()) {
82 return i;
83 }
84 }
85 object_pool_.Add(obj, Heap::kOld);
86 return object_pool_.Length() - 1;
87 }
88
89
90 int32_t Assembler::AddExternalLabel(const ExternalLabel* label) {
91 if (object_pool_.IsNull()) {
92 // The object pool cannot be used in the vm isolate.
93 ASSERT(Isolate::Current() != Dart::vm_isolate());
94 object_pool_ = GrowableObjectArray::New(Heap::kOld);
95 }
96 const word address = label->address();
97 ASSERT(Utils::IsAligned(address, 4));
98 // The address is stored in the object array as a RawSmi.
99 const Smi& smi = Smi::Handle(Smi::New(address >> kSmiTagShift));
100 // Do not reuse an existing entry, since each reference may be patched
101 // independently.
102 object_pool_.Add(smi, Heap::kOld);
103 return object_pool_.Length() - 1;
104 }
105
106
107 void Assembler::Stop(const char* message) {
108 if (FLAG_print_stop_message) {
109 UNIMPLEMENTED();
110 }
111 Label stop;
112 b(&stop);
113 Emit(reinterpret_cast<int32_t>(message));
114 Bind(&stop);
115 break_(Instr::kStopMessageCode);
116 }
117
59 } // namespace dart 118 } // namespace dart
60 119
61 #endif // defined TARGET_ARCH_MIPS 120 #endif // defined TARGET_ARCH_MIPS
62 121
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698