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

Side by Side Diff: runtime/vm/assembler_mips.h

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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 #ifndef VM_ASSEMBLER_MIPS_H_ 5 #ifndef VM_ASSEMBLER_MIPS_H_
6 #define VM_ASSEMBLER_MIPS_H_ 6 #define VM_ASSEMBLER_MIPS_H_
7 7
8 #ifndef VM_ASSEMBLER_H_ 8 #ifndef VM_ASSEMBLER_H_
9 #error Do not include assembler_mips.h directly; use assembler.h instead. 9 #error Do not include assembler_mips.h directly; use assembler.h instead.
10 #endif 10 #endif
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 class Assembler : public ValueObject { 138 class Assembler : public ValueObject {
139 public: 139 public:
140 explicit Assembler(bool use_far_branches = false) 140 explicit Assembler(bool use_far_branches = false)
141 : buffer_(), 141 : buffer_(),
142 object_pool_(GrowableObjectArray::Handle()), 142 object_pool_(GrowableObjectArray::Handle()),
143 prologue_offset_(-1), 143 prologue_offset_(-1),
144 use_far_branches_(use_far_branches), 144 use_far_branches_(use_far_branches),
145 delay_slot_available_(false), 145 delay_slot_available_(false),
146 in_delay_slot_(false), 146 in_delay_slot_(false),
147 comments_() { } 147 comments_(),
148 allow_constant_pool_(true) { }
148 ~Assembler() { } 149 ~Assembler() { }
149 150
150 void PopRegister(Register r) { Pop(r); } 151 void PopRegister(Register r) { Pop(r); }
151 152
152 void Bind(Label* label); 153 void Bind(Label* label);
153 154
154 // Misc. functionality 155 // Misc. functionality
155 intptr_t CodeSize() const { return buffer_.Size(); } 156 intptr_t CodeSize() const { return buffer_.Size(); }
156 intptr_t prologue_offset() const { return prologue_offset_; } 157 intptr_t prologue_offset() const { return prologue_offset_; }
157 158
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 intptr_t cid, 1245 intptr_t cid,
1245 intptr_t index_scale, 1246 intptr_t index_scale,
1246 Register array, 1247 Register array,
1247 Register index); 1248 Register index);
1248 1249
1249 // On some other platforms, we draw a distinction between safe and unsafe 1250 // On some other platforms, we draw a distinction between safe and unsafe
1250 // smis. 1251 // smis.
1251 static bool IsSafe(const Object& object) { return true; } 1252 static bool IsSafe(const Object& object) { return true; }
1252 static bool IsSafeSmi(const Object& object) { return object.IsSmi(); } 1253 static bool IsSafeSmi(const Object& object) { return object.IsSmi(); }
1253 1254
1255 bool allow_constant_pool() const {
1256 return allow_constant_pool_;
1257 }
1258 void set_allow_constant_pool(bool b) {
1259 allow_constant_pool_ = b;
1260 }
1261
1254 private: 1262 private:
1255 AssemblerBuffer buffer_; 1263 AssemblerBuffer buffer_;
1256 GrowableObjectArray& object_pool_; // Objects and patchable jump targets. 1264 GrowableObjectArray& object_pool_; // Objects and patchable jump targets.
1257 intptr_t prologue_offset_; 1265 intptr_t prologue_offset_;
1258 1266
1259 bool use_far_branches_; 1267 bool use_far_branches_;
1260 bool delay_slot_available_; 1268 bool delay_slot_available_;
1261 bool in_delay_slot_; 1269 bool in_delay_slot_;
1262 1270
1263 int32_t AddObject(const Object& obj); 1271 int32_t AddObject(const Object& obj);
1264 int32_t AddExternalLabel(const ExternalLabel* label); 1272 int32_t AddExternalLabel(const ExternalLabel* label);
1265 1273
1266 class CodeComment : public ZoneAllocated { 1274 class CodeComment : public ZoneAllocated {
1267 public: 1275 public:
1268 CodeComment(intptr_t pc_offset, const String& comment) 1276 CodeComment(intptr_t pc_offset, const String& comment)
1269 : pc_offset_(pc_offset), comment_(comment) { } 1277 : pc_offset_(pc_offset), comment_(comment) { }
1270 1278
1271 intptr_t pc_offset() const { return pc_offset_; } 1279 intptr_t pc_offset() const { return pc_offset_; }
1272 const String& comment() const { return comment_; } 1280 const String& comment() const { return comment_; }
1273 1281
1274 private: 1282 private:
1275 intptr_t pc_offset_; 1283 intptr_t pc_offset_;
1276 const String& comment_; 1284 const String& comment_;
1277 1285
1278 DISALLOW_COPY_AND_ASSIGN(CodeComment); 1286 DISALLOW_COPY_AND_ASSIGN(CodeComment);
1279 }; 1287 };
1280 1288
1281 GrowableArray<CodeComment*> comments_; 1289 GrowableArray<CodeComment*> comments_;
1282 1290
1291 bool allow_constant_pool_;
1292
1283 void Emit(int32_t value) { 1293 void Emit(int32_t value) {
1284 // Emitting an instruction clears the delay slot state. 1294 // Emitting an instruction clears the delay slot state.
1285 in_delay_slot_ = false; 1295 in_delay_slot_ = false;
1286 delay_slot_available_ = false; 1296 delay_slot_available_ = false;
1287 AssemblerBuffer::EnsureCapacity ensured(&buffer_); 1297 AssemblerBuffer::EnsureCapacity ensured(&buffer_);
1288 buffer_.Emit<int32_t>(value); 1298 buffer_.Emit<int32_t>(value);
1289 } 1299 }
1290 1300
1291 // Encode CPU instructions according to the types specified in 1301 // Encode CPU instructions according to the types specified in
1292 // Figures 4-1, 4-2 and 4-3 in VolI-A. 1302 // Figures 4-1, 4-2 and 4-3 in VolI-A.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 Register value, 1389 Register value,
1380 Label* no_update); 1390 Label* no_update);
1381 1391
1382 DISALLOW_ALLOCATION(); 1392 DISALLOW_ALLOCATION();
1383 DISALLOW_COPY_AND_ASSIGN(Assembler); 1393 DISALLOW_COPY_AND_ASSIGN(Assembler);
1384 }; 1394 };
1385 1395
1386 } // namespace dart 1396 } // namespace dart
1387 1397
1388 #endif // VM_ASSEMBLER_MIPS_H_ 1398 #endif // VM_ASSEMBLER_MIPS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698