OLD | NEW |
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 const Code& code); | 48 const Code& code); |
49 const int value1 = 10; | 49 const int value1 = 10; |
50 const int value2 = 20; | 50 const int value2 = 20; |
51 const char* kName = "Test_CallRuntimeStubCode"; | 51 const char* kName = "Test_CallRuntimeStubCode"; |
52 Assembler _assembler_; | 52 Assembler _assembler_; |
53 GenerateCallToCallRuntimeStub(&_assembler_, value1, value2); | 53 GenerateCallToCallRuntimeStub(&_assembler_, value1, value2); |
54 const Code& code = Code::Handle(Code::FinalizeCode( | 54 const Code& code = Code::Handle(Code::FinalizeCode( |
55 *CreateFunction("Test_CallRuntimeStubCode"), &_assembler_)); | 55 *CreateFunction("Test_CallRuntimeStubCode"), &_assembler_)); |
56 const Function& function = RegisterFakeFunction(kName, code); | 56 const Function& function = RegisterFakeFunction(kName, code); |
57 Smi& result = Smi::Handle(); | 57 Smi& result = Smi::Handle(); |
58 result ^= DartEntry::InvokeStatic(function, Object::empty_array()); | 58 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); |
59 EXPECT_EQ((value1 - value2), result.Value()); | 59 EXPECT_EQ((value1 - value2), result.Value()); |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 // Test calls to stub code which calls into a leaf runtime entry. | 63 // Test calls to stub code which calls into a leaf runtime entry. |
64 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, | 64 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, |
65 int value1, | 65 int value1, |
66 int value2) { | 66 int value2) { |
67 UNIMPLEMENTED(); | 67 UNIMPLEMENTED(); |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 TEST_CASE(CallLeafRuntimeStubCode) { | 71 TEST_CASE(CallLeafRuntimeStubCode) { |
72 extern const Function& RegisterFakeFunction(const char* name, | 72 extern const Function& RegisterFakeFunction(const char* name, |
73 const Code& code); | 73 const Code& code); |
74 const int value1 = 10; | 74 const int value1 = 10; |
75 const int value2 = 20; | 75 const int value2 = 20; |
76 const char* kName = "Test_CallLeafRuntimeStubCode"; | 76 const char* kName = "Test_CallLeafRuntimeStubCode"; |
77 Assembler _assembler_; | 77 Assembler _assembler_; |
78 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); | 78 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); |
79 const Code& code = Code::Handle(Code::FinalizeCode( | 79 const Code& code = Code::Handle(Code::FinalizeCode( |
80 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); | 80 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); |
81 const Function& function = RegisterFakeFunction(kName, code); | 81 const Function& function = RegisterFakeFunction(kName, code); |
82 Smi& result = Smi::Handle(); | 82 Smi& result = Smi::Handle(); |
83 result ^= DartEntry::InvokeStatic(function, Object::empty_array()); | 83 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); |
84 EXPECT_EQ((value1 + value2), result.Value()); | 84 EXPECT_EQ((value1 + value2), result.Value()); |
85 } | 85 } |
86 | 86 |
87 } // namespace dart | 87 } // namespace dart |
88 | 88 |
89 #endif // defined TARGET_ARCH_MIPS | 89 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |