Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/assert.h" | 9 #include "vm/assert.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 __ movq(RAX, Immediate(0)); |
| 22 __ pushq(RAX); | |
| 23 __ incq(Address(RSP, 0)); | |
| 24 __ movq(RCX, Address(RSP, 0)); | |
| 25 __ incq(RCX); | |
| 26 __ popq(RAX); | |
| 27 __ movq(RAX, RCX); | |
| 28 __ ret(); | |
| 22 } | 29 } |
| 23 | 30 |
| 24 | 31 |
| 25 // Generate a dart code sequence that embeds a string object in it. | 32 // Generate a dart code sequence that embeds a string object in it. |
| 26 // This is used to test Embedded String objects in the instructions. | 33 // This is used to test Embedded String objects in the instructions. |
| 27 void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { | 34 void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { |
| 28 __ Unimplemented("GenerateEmbedStringInCode"); | 35 const String& string_object = String::ZoneHandle(String::New(str)); |
| 36 __ LoadObject(RAX, string_object); | |
| 37 __ ret(); | |
| 29 } | 38 } |
| 30 | 39 |
| 31 | 40 |
| 32 // Generate a dart code sequence that embeds a smi object in it. | 41 // Generate a dart code sequence that embeds a smi object in it. |
| 33 // This is used to test Embedded Smi objects in the instructions. | 42 // This is used to test Embedded Smi objects in the instructions. |
| 34 void GenerateEmbedSmiInCode(Assembler* assembler, int value) { | 43 void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { |
| 35 __ Unimplemented("GenerateEmbedSmiInCode"); | 44 const Smi& smi = Smi::Handle(Smi::New(value)); |
| 36 } | 45 Object& smi_object = Object::ZoneHandle(smi.raw()); |
| 37 | 46 __ LoadObject(RAX, smi_object); |
|
srdjan
2011/12/01 01:26:07
Why can't you "LoadObject(RAX, smi)"?
regis
2011/12/01 01:42:04
Changed here and in object_ia32_test.cc, from wher
| |
| 38 | 47 __ ret(); |
| 39 // Generate code for a simple static dart function that returns 42. | |
| 40 // This is used to test invocation of dart functions from C++. | |
| 41 void GenerateReturn42(Assembler* assembler) { | |
| 42 __ Unimplemented("GenerateReturn42"); | |
| 43 } | 48 } |
| 44 | 49 |
| 45 } // namespace dart | 50 } // namespace dart |
| 46 | 51 |
| 47 #endif // defined TARGET_ARCH_X64 | 52 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |