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

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

Issue 14854010: On MIPS, keeps Object::null() in a register. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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/stub_code_mips.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 ASSERT(context.isolate() == Isolate::Current()); 47 ASSERT(context.isolate() == Isolate::Current());
48 __ EnterDartFrame(0); 48 __ EnterDartFrame(0);
49 __ LoadObject(CTX, context); 49 __ LoadObject(CTX, context);
50 __ PushObject(result); // Push Null object for return value. 50 __ PushObject(result); // Push Null object for return value.
51 __ PushObject(smi1); // Push argument 1 smi1. 51 __ PushObject(smi1); // Push argument 1 smi1.
52 __ PushObject(smi2); // Push argument 2 smi2. 52 __ PushObject(smi2); // Push argument 2 smi2.
53 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); 53 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
54 __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func. 54 __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func.
55 __ addiu(SP, SP, Immediate(argc * kWordSize)); 55 __ addiu(SP, SP, Immediate(argc * kWordSize));
56 __ Pop(V0); // Pop return value from return slot. 56 __ Pop(V0); // Pop return value from return slot.
57 __ LeaveDartFrame(); 57 __ LeaveDartFrameAndReturn();
58 __ Ret();
59 } 58 }
60 59
61 60
62 TEST_CASE(CallRuntimeStubCode) { 61 TEST_CASE(CallRuntimeStubCode) {
63 extern const Function& RegisterFakeFunction(const char* name, 62 extern const Function& RegisterFakeFunction(const char* name,
64 const Code& code); 63 const Code& code);
65 const int value1 = 10; 64 const int value1 = 10;
66 const int value2 = 20; 65 const int value2 = 20;
67 const char* kName = "Test_CallRuntimeStubCode"; 66 const char* kName = "Test_CallRuntimeStubCode";
68 Assembler _assembler_; 67 Assembler _assembler_;
(...skipping 11 matching lines...) Expand all
80 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, 79 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler,
81 int value1, 80 int value1,
82 int value2) { 81 int value2) {
83 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 82 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
84 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 83 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
85 __ EnterDartFrame(0); 84 __ EnterDartFrame(0);
86 __ ReserveAlignedFrameSpace(0); 85 __ ReserveAlignedFrameSpace(0);
87 __ LoadObject(A0, smi1); // Set up argument 1 smi1. 86 __ LoadObject(A0, smi1); // Set up argument 1 smi1.
88 __ LoadObject(A1, smi2); // Set up argument 2 smi2. 87 __ LoadObject(A1, smi2); // Set up argument 2 smi2.
89 __ CallRuntime(kTestLeafSmiAddRuntimeEntry); // Call SmiAdd runtime func. 88 __ CallRuntime(kTestLeafSmiAddRuntimeEntry); // Call SmiAdd runtime func.
90 __ LeaveDartFrame(); 89 __ LeaveDartFrameAndReturn(); // Return value is in V0.
91 __ Ret(); // Return value is in R0.
92 } 90 }
93 91
94 92
95 TEST_CASE(CallLeafRuntimeStubCode) { 93 TEST_CASE(CallLeafRuntimeStubCode) {
96 extern const Function& RegisterFakeFunction(const char* name, 94 extern const Function& RegisterFakeFunction(const char* name,
97 const Code& code); 95 const Code& code);
98 const int value1 = 10; 96 const int value1 = 10;
99 const int value2 = 20; 97 const int value2 = 20;
100 const char* kName = "Test_CallLeafRuntimeStubCode"; 98 const char* kName = "Test_CallLeafRuntimeStubCode";
101 Assembler _assembler_; 99 Assembler _assembler_;
102 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); 100 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2);
103 const Code& code = Code::Handle(Code::FinalizeCode( 101 const Code& code = Code::Handle(Code::FinalizeCode(
104 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); 102 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
105 const Function& function = RegisterFakeFunction(kName, code); 103 const Function& function = RegisterFakeFunction(kName, code);
106 Smi& result = Smi::Handle(); 104 Smi& result = Smi::Handle();
107 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); 105 result ^= DartEntry::InvokeFunction(function, Object::empty_array());
108 EXPECT_EQ((value1 + value2), result.Value()); 106 EXPECT_EQ((value1 + value2), result.Value());
109 } 107 }
110 108
111 } // namespace dart 109 } // namespace dart
112 110
113 #endif // defined TARGET_ARCH_MIPS 111 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_mips.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698