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

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 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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));
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();
regis 2013/03/25 23:03:40 You should sync. You will notice that we allocate
zra 2013/03/25 23:39:17 Done.
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);
regis 2013/03/25 23:03:40 ditto
zra 2013/03/25 23:39:17 Done.
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();
regis 2013/03/25 23:03:40 ditto
zra 2013/03/25 23:39:17 Done.
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);
regis 2013/03/25 23:03:40 ditto
zra 2013/03/25 23:39:17 Done.
103 return object_pool_.Length() - 1;
104 }
105
59 } // namespace dart 106 } // namespace dart
60 107
61 #endif // defined TARGET_ARCH_MIPS 108 #endif // defined TARGET_ARCH_MIPS
62 109
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698