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

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

Issue 16272004: Implements intrinsics for MIPS. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "vm/runtime_entry.h" 9 #include "vm/runtime_entry.h"
10 #include "vm/simulator.h" 10 #include "vm/simulator.h"
11 #include "vm/stub_code.h" 11 #include "vm/stub_code.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 #if defined(USING_SIMULATOR) 15 #if defined(USING_SIMULATOR)
16 DECLARE_FLAG(bool, trace_sim); 16 DECLARE_FLAG(bool, trace_sim);
17 #endif 17 #endif
18 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message."); 18 DEFINE_FLAG(bool, print_stop_message, false, "Print stop message.");
19 19 DECLARE_FLAG(bool, inline_alloc);
20 20
21 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) { 21 void Assembler::InitializeMemoryWithBreakpoints(uword data, int length) {
22 ASSERT(Utils::IsAligned(data, 4)); 22 ASSERT(Utils::IsAligned(data, 4));
23 ASSERT(Utils::IsAligned(length, 4)); 23 ASSERT(Utils::IsAligned(length, 4));
24 const uword end = data + length; 24 const uword end = data + length;
25 while (data < end) { 25 while (data < end) {
26 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction; 26 *reinterpret_cast<int32_t*>(data) = Instr::kBreakPointInstruction;
27 data += 4; 27 data += 4;
28 } 28 }
29 } 29 }
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } else { 390 } else {
391 mov(SP, FP); 391 mov(SP, FP);
392 lw(RA, Address(SP, 1 * kWordSize)); 392 lw(RA, Address(SP, 1 * kWordSize));
393 lw(FP, Address(SP, 0 * kWordSize)); 393 lw(FP, Address(SP, 0 * kWordSize));
394 jr(ra); 394 jr(ra);
395 delay_slot()->addiu(SP, SP, Immediate(3 * kWordSize)); 395 delay_slot()->addiu(SP, SP, Immediate(3 * kWordSize));
396 } 396 }
397 } 397 }
398 398
399 399
400 void Assembler::TryAllocate(const Class& cls,
401 Label* failure,
402 Register instance_reg) {
403 ASSERT(failure != NULL);
404 if (FLAG_inline_alloc) {
405 Heap* heap = Isolate::Current()->heap();
406 const intptr_t instance_size = cls.instance_size();
407 LoadImmediate(instance_reg, heap->TopAddress());
408 lw(instance_reg, Address(instance_reg, 0));
409 AddImmediate(instance_reg, instance_size);
410
411 // instance_reg: potential next object start.
412 LoadImmediate(TMP, heap->EndAddress());
413 lw(TMP, Address(TMP, 0));
414 // Fail if heap end unsigned less than or equal to instance_reg.
415 BranchUnsignedLessEqual(TMP, instance_reg, failure);
416
417 // Successfully allocated the object, now update top to point to
418 // next object start and store the class in the class field of object.
419 LoadImmediate(TMP, heap->TopAddress());
420 sw(instance_reg, Address(TMP, 0));
421
422 ASSERT(instance_size >= kHeapObjectTag);
423 AddImmediate(instance_reg, -instance_size + kHeapObjectTag);
424
425 uword tags = 0;
426 tags = RawObject::SizeTag::update(instance_size, tags);
427 ASSERT(cls.id() != kIllegalCid);
428 tags = RawObject::ClassIdTag::update(cls.id(), tags);
429 LoadImmediate(TMP, tags);
430 sw(TMP, FieldAddress(instance_reg, Object::tags_offset()));
431 } else {
432 b(failure);
433 }
434 }
435
436
400 void Assembler::CallRuntime(const RuntimeEntry& entry) { 437 void Assembler::CallRuntime(const RuntimeEntry& entry) {
401 entry.Call(this); 438 entry.Call(this);
402 } 439 }
403 440
404 441
405 void Assembler::EnterDartFrame(intptr_t frame_size) { 442 void Assembler::EnterDartFrame(intptr_t frame_size) {
406 const intptr_t offset = CodeSize(); 443 const intptr_t offset = CodeSize();
407 444
408 addiu(SP, SP, Immediate(-4 * kWordSize)); 445 addiu(SP, SP, Immediate(-4 * kWordSize));
409 sw(RA, Address(SP, 2 * kWordSize)); 446 sw(RA, Address(SP, 2 * kWordSize));
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 Bind(&msg); 624 Bind(&msg);
588 break_(Instr::kMsgMessageCode); 625 break_(Instr::kMsgMessageCode);
589 } 626 }
590 #endif 627 #endif
591 } 628 }
592 629
593 } // namespace dart 630 } // namespace dart
594 631
595 #endif // defined TARGET_ARCH_MIPS 632 #endif // defined TARGET_ARCH_MIPS
596 633
OLDNEW
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/assembler_mips_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698