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

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

Issue 1264543002: Simplify constant pool usage in arm64 code generator (by removing extra argument (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address comments Created 5 years, 4 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
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | no next file » | 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 "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM64) 6 #if defined(TARGET_ARCH_ARM64)
7 7
8 #include "vm/isolate.h" 8 #include "vm/isolate.h"
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/native_entry.h" 10 #include "vm/native_entry.h"
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 40
41 // Test calls to stub code which calls into the runtime. 41 // Test calls to stub code which calls into the runtime.
42 static void GenerateCallToCallRuntimeStub(Assembler* assembler, 42 static void GenerateCallToCallRuntimeStub(Assembler* assembler,
43 int value1, int value2) { 43 int value1, int value2) {
44 const int argc = 2; 44 const int argc = 2;
45 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 45 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
46 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 46 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
47 __ EnterDartFrame(0); 47 __ EnterDartFrame(0);
48 __ PushObject(Object::null_object(), PP); // Push Null obj for return value. 48 __ PushObject(Object::null_object()); // Push Null obj for return value.
49 __ PushObject(smi1, PP); // Push argument 1 smi1. 49 __ PushObject(smi1); // Push argument 1 smi1.
50 __ PushObject(smi2, PP); // Push argument 2 smi2. 50 __ PushObject(smi2); // Push argument 2 smi2.
51 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); 51 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
52 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func. 52 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func.
53 __ add(SP, SP, Operand(argc * kWordSize)); 53 __ add(SP, SP, Operand(argc * kWordSize));
54 __ Pop(R0); // Pop return value from return slot. 54 __ Pop(R0); // Pop return value from return slot.
55 __ LeaveDartFrame(); 55 __ LeaveDartFrame();
56 __ ret(); 56 __ ret();
57 } 57 }
58 58
59 59
60 TEST_CASE(CallRuntimeStubCode) { 60 TEST_CASE(CallRuntimeStubCode) {
(...skipping 14 matching lines...) Expand all
75 75
76 76
77 // Test calls to stub code which calls into a leaf runtime entry. 77 // Test calls to stub code which calls into a leaf runtime entry.
78 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, 78 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler,
79 int value1, 79 int value1,
80 int value2) { 80 int value2) {
81 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 81 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
82 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 82 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
83 __ EnterDartFrame(0); 83 __ EnterDartFrame(0);
84 __ ReserveAlignedFrameSpace(0); 84 __ ReserveAlignedFrameSpace(0);
85 __ LoadObject(R0, smi1, PP); // Set up argument 1 smi1. 85 __ LoadObject(R0, smi1); // Set up argument 1 smi1.
86 __ LoadObject(R1, smi2, PP); // Set up argument 2 smi2. 86 __ LoadObject(R1, smi2); // Set up argument 2 smi2.
87 __ CallRuntime(kTestLeafSmiAddRuntimeEntry, 2); // Call SmiAdd runtime func. 87 __ CallRuntime(kTestLeafSmiAddRuntimeEntry, 2); // Call SmiAdd runtime func.
88 __ LeaveDartFrame(); 88 __ LeaveDartFrame();
89 __ ret(); // Return value is in R0. 89 __ ret(); // Return value is in R0.
90 } 90 }
91 91
92 92
93 TEST_CASE(CallLeafRuntimeStubCode) { 93 TEST_CASE(CallLeafRuntimeStubCode) {
94 extern const Function& RegisterFakeFunction(const char* name, 94 extern const Function& RegisterFakeFunction(const char* name,
95 const Code& code); 95 const Code& code);
96 const int value1 = 10; 96 const int value1 = 10;
97 const int value2 = 20; 97 const int value2 = 20;
98 const char* kName = "Test_CallLeafRuntimeStubCode"; 98 const char* kName = "Test_CallLeafRuntimeStubCode";
99 Assembler _assembler_; 99 Assembler _assembler_;
100 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); 100 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2);
101 const Code& code = Code::Handle(Code::FinalizeCode( 101 const Code& code = Code::Handle(Code::FinalizeCode(
102 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); 102 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
103 const Function& function = RegisterFakeFunction(kName, code); 103 const Function& function = RegisterFakeFunction(kName, code);
104 Smi& result = Smi::Handle(); 104 Smi& result = Smi::Handle();
105 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); 105 result ^= DartEntry::InvokeFunction(function, Object::empty_array());
106 EXPECT_EQ((value1 + value2), result.Value()); 106 EXPECT_EQ((value1 + value2), result.Value());
107 } 107 }
108 108
109 } // namespace dart 109 } // namespace dart
110 110
111 #endif // defined TARGET_ARCH_ARM64 111 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698