Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
object_arm64_test.cc
Go to the documentation of this 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
3// BSD-style license that can be found in the LICENSE file.
4
5#include "platform/assert.h"
6#include "vm/globals.h"
7#if defined(TARGET_ARCH_ARM64)
8
10#include "vm/object.h"
11#include "vm/unit_test.h"
12
13namespace dart {
14
15#define __ assembler->
16
17// Generate a simple dart code sequence.
18// This is used to test Code and Instruction object creation.
19void GenerateIncrement(compiler::Assembler* assembler) {
20 __ EnterFrame(1 * kWordSize);
21 __ movz(R0, compiler::Immediate(0), 0);
22 __ Push(R0);
23 __ add(R0, R0, compiler::Operand(1));
24 __ str(R0, compiler::Address(SP));
25 __ ldr(R1, compiler::Address(SP));
26 __ add(R1, R1, compiler::Operand(1));
27 __ Pop(R0);
28 __ mov(R0, R1);
29 __ LeaveFrame();
30 __ ret();
31}
32
33// Generate a dart code sequence that embeds a string object in it.
34// This is used to test Embedded String objects in the instructions.
35void GenerateEmbedStringInCode(compiler::Assembler* assembler,
36 const char* str) {
37 const String& string_object =
39 __ EnterStubFrame();
40 __ LoadObject(R0, string_object);
41 __ LeaveStubFrame();
42 __ ret();
43}
44
45// Generate a dart code sequence that embeds a smi object in it.
46// This is used to test Embedded Smi objects in the instructions.
47void GenerateEmbedSmiInCode(compiler::Assembler* assembler, intptr_t value) {
48 const Smi& smi_object = Smi::ZoneHandle(Smi::New(value));
49 const int64_t val = static_cast<int64_t>(smi_object.ptr());
50 __ LoadImmediate(R0, val);
51 __ ret();
52}
53
54} // namespace dart
55
56#endif // defined TARGET_ARCH_ARM64
#define __
@ kOld
Definition heap.h:39
static Object & ZoneHandle()
Definition object.h:419
static SmiPtr New(intptr_t value)
Definition object.h:9985
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition object.cc:23777
constexpr intptr_t kWordSize
Definition globals.h:509