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

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

Issue 311903004: Fixes to run "Hello, world!" on arm64 hardware. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 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/isolate.h ('k') | runtime/vm/runtime_entry_arm64.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64) 7 #if defined(TARGET_ARCH_ARM64)
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 // Generate a simple dart code sequence. 17 // Generate a simple dart code sequence.
18 // This is used to test Code and Instruction object creation. 18 // This is used to test Code and Instruction object creation.
19 void GenerateIncrement(Assembler* assembler) { 19 void GenerateIncrement(Assembler* assembler) {
20 __ mov(SP, CSP);
20 __ movz(R0, 0, 0); 21 __ movz(R0, 0, 0);
21 __ Push(R0); 22 __ Push(R0);
22 __ add(R0, R0, Operand(1)); 23 __ add(R0, R0, Operand(1));
23 __ str(R0, Address(SP)); 24 __ str(R0, Address(SP));
24 __ ldr(R1, Address(SP)); 25 __ ldr(R1, Address(SP));
25 __ add(R1, R1, Operand(1)); 26 __ add(R1, R1, Operand(1));
26 __ Pop(R0); 27 __ Pop(R0);
27 __ mov(R0, R1); 28 __ mov(R0, R1);
28 __ ret(); 29 __ ret();
29 } 30 }
30 31
31 32
32 // 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.
33 // This is used to test Embedded String objects in the instructions. 34 // This is used to test Embedded String objects in the instructions.
34 void GenerateEmbedStringInCode(Assembler* assembler, const char* str) { 35 void GenerateEmbedStringInCode(Assembler* assembler, const char* str) {
35 const String& string_object = 36 const String& string_object =
36 String::ZoneHandle(String::New(str, Heap::kOld)); 37 String::ZoneHandle(String::New(str, Heap::kOld));
38 __ mov(SP, CSP);
37 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here. 39 __ TagAndPushPP(); // Save caller's pool pointer and load a new one here.
38 __ LoadPoolPointer(PP); 40 __ LoadPoolPointer(PP);
39 __ LoadObject(R0, string_object, PP); 41 __ LoadObject(R0, string_object, PP);
40 __ PopAndUntagPP(); // Restore caller's pool pointer. 42 __ PopAndUntagPP(); // Restore caller's pool pointer.
41 __ ret(); 43 __ ret();
42 } 44 }
43 45
44 46
45 // Generate a dart code sequence that embeds a smi object in it. 47 // Generate a dart code sequence that embeds a smi object in it.
46 // This is used to test Embedded Smi objects in the instructions. 48 // This is used to test Embedded Smi objects in the instructions.
47 void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) { 49 void GenerateEmbedSmiInCode(Assembler* assembler, intptr_t value) {
48 const Smi& smi_object = Smi::ZoneHandle(Smi::New(value)); 50 const Smi& smi_object = Smi::ZoneHandle(Smi::New(value));
49 const int64_t val = reinterpret_cast<int64_t>(smi_object.raw()); 51 const int64_t val = reinterpret_cast<int64_t>(smi_object.raw());
50 __ LoadImmediate(R0, val, kNoRegister); 52 __ LoadImmediate(R0, val, kNoRegister);
51 __ ret(); 53 __ ret();
52 } 54 }
53 55
54 } // namespace dart 56 } // namespace dart
55 57
56 #endif // defined TARGET_ARCH_ARM64 58 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/runtime_entry_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698