| OLD | NEW |
| 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 "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/globals.h" | 6 #include "vm/globals.h" |
| 7 #if defined(TARGET_ARCH_MIPS) | 7 #if defined(TARGET_ARCH_MIPS) |
| 8 | 8 |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/unit_test.h" | 11 #include "vm/unit_test.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 #define __ assembler-> | 15 #define __ assembler-> |
| 16 | 16 |
| 17 | 17 |
| 18 // Generate a simple dart code sequence. | 18 // Generate a simple dart code sequence. |
| 19 // This is used to test Code and Instruction object creation. | 19 // This is used to test Code and Instruction object creation. |
| 20 void GenerateIncrement(Assembler* assembler) { | 20 void GenerateIncrement(Assembler* assembler) { |
| 21 __ Unimplemented("GenerateIncrement"); | 21 __ Push(ZR); |
| 22 __ lw(TMP1, Address(SP, 0)); |
| 23 __ addiu(TMP1, TMP1, Immediate(1)); |
| 24 __ sw(TMP1, Address(SP, 0)); |
| 25 __ lw(TMP1, Address(SP, 0)); |
| 26 __ addiu(TMP1, TMP1, Immediate(1)); |
| 27 __ Pop(V0); |
| 28 __ mov(V0, TMP1); |
| 29 __ Ret(); |
| 22 } | 30 } |
| 23 | 31 |
| 24 | 32 |
| 25 // Generate a dart code sequence that embeds a string object in it. | 33 // Generate a dart code sequence that embeds a string object in it. |
| 26 // This is used to test Embedded String objects in the instructions. | 34 // This is used to test Embedded String objects in the instructions. |
| 27 void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { | 35 void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { |
| 28 __ Unimplemented("GenerateEmbedStringInCode"); | 36 __ EnterDartFrame(0); // To setup pp. |
| 37 const String& string_object = |
| 38 String::ZoneHandle(String::New(str, Heap::kOld)); |
| 39 __ LoadObject(V0, string_object); |
| 40 __ LeaveDartFrame(); |
| 41 __ Ret(); |
| 29 } | 42 } |
| 30 | 43 |
| 31 | 44 |
| 32 // Generate a dart code sequence that embeds a smi object in it. | 45 // Generate a dart code sequence that embeds a smi object in it. |
| 33 // This is used to test Embedded Smi objects in the instructions. | 46 // This is used to test Embedded Smi objects in the instructions. |
| 34 void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { | 47 void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { |
| 35 __ Unimplemented("GenerateEmbedSmiInCode"); | 48 // No need to setup pp, since Smis are not stored in the object pool. |
| 49 const Smi& smi_object = Smi::ZoneHandle(Smi::New(value)); |
| 50 __ LoadObject(V0, smi_object); |
| 51 __ Ret(); |
| 36 } | 52 } |
| 37 | 53 |
| 38 } // namespace dart | 54 } // namespace dart |
| 39 | 55 |
| 40 #endif // defined TARGET_ARCH_MIPS | 56 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |