Flutter Engine
The Flutter Engine
object_ia32_test.cc
Go to the documentation of this file.
1// Copyright (c) 2012, 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_IA32)
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 __ movl(EAX, compiler::Immediate(0));
21 __ pushl(EAX);
22 __ incl(compiler::Address(ESP, 0));
23 __ movl(ECX, compiler::Address(ESP, 0));
24 __ incl(ECX);
25 __ popl(EAX);
26 __ movl(EAX, ECX);
27 __ ret();
28}
29
30// Generate a dart code sequence that embeds a string object in it.
31// This is used to test Embedded String objects in the instructions.
32void GenerateEmbedStringInCode(compiler::Assembler* assembler,
33 const char* str) {
34 const String& string_object =
36 __ LoadObject(EAX, string_object);
37 __ ret();
38}
39
40// Generate a dart code sequence that embeds a smi object in it.
41// This is used to test Embedded Smi objects in the instructions.
42void GenerateEmbedSmiInCode(compiler::Assembler* assembler, intptr_t value) {
43 const Smi& smi_object = Smi::ZoneHandle(Smi::New(value));
44 __ LoadObject(EAX, smi_object);
45 __ ret();
46}
47
48} // namespace dart
49
50#endif // defined TARGET_ARCH_IA32
#define __
@ kOld
Definition: heap.h:39
static Object & ZoneHandle()
Definition: object.h:419
static SmiPtr New(intptr_t value)
Definition: object.h:10006
static StringPtr New(const char *cstr, Heap::Space space=Heap::kNew)
Definition: object.cc:23698
uint8_t value
Definition: dart_vm.cc:33