OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 extern const Function& RegisterFakeFunction(const char* name, | 63 extern const Function& RegisterFakeFunction(const char* name, |
64 const Code& code); | 64 const Code& code); |
65 const int value1 = 10; | 65 const int value1 = 10; |
66 const int value2 = 20; | 66 const int value2 = 20; |
67 const char* kName = "Test_CallRuntimeStubCode"; | 67 const char* kName = "Test_CallRuntimeStubCode"; |
68 Assembler _assembler_; | 68 Assembler _assembler_; |
69 GenerateCallToCallRuntimeStub(&_assembler_, value1, value2); | 69 GenerateCallToCallRuntimeStub(&_assembler_, value1, value2); |
70 const Code& code = Code::Handle(Code::FinalizeCode( | 70 const Code& code = Code::Handle(Code::FinalizeCode( |
71 *CreateFunction("Test_CallRuntimeStubCode"), &_assembler_)); | 71 *CreateFunction("Test_CallRuntimeStubCode"), &_assembler_)); |
72 const Function& function = RegisterFakeFunction(kName, code); | 72 const Function& function = RegisterFakeFunction(kName, code); |
73 GrowableArray<const Object*> arguments; | 73 const Array& args = Array::Handle(Object::empty_array()); |
74 const Array& kNoArgumentNames = Array::Handle(); | |
75 Smi& result = Smi::Handle(); | 74 Smi& result = Smi::Handle(); |
76 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames); | 75 result ^= DartEntry::InvokeStatic(function, args); |
77 EXPECT_EQ((value1 - value2), result.Value()); | 76 EXPECT_EQ((value1 - value2), result.Value()); |
78 } | 77 } |
79 | 78 |
80 | 79 |
81 // Test calls to stub code which calls into a leaf runtime entry. | 80 // Test calls to stub code which calls into a leaf runtime entry. |
82 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, | 81 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, |
83 int value1, | 82 int value1, |
84 int value2) { | 83 int value2) { |
85 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); | 84 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); |
86 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); | 85 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); |
(...skipping 13 matching lines...) Expand all Loading... |
100 extern const Function& RegisterFakeFunction(const char* name, | 99 extern const Function& RegisterFakeFunction(const char* name, |
101 const Code& code); | 100 const Code& code); |
102 const int value1 = 10; | 101 const int value1 = 10; |
103 const int value2 = 20; | 102 const int value2 = 20; |
104 const char* kName = "Test_CallLeafRuntimeStubCode"; | 103 const char* kName = "Test_CallLeafRuntimeStubCode"; |
105 Assembler _assembler_; | 104 Assembler _assembler_; |
106 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); | 105 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); |
107 const Code& code = Code::Handle(Code::FinalizeCode( | 106 const Code& code = Code::Handle(Code::FinalizeCode( |
108 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); | 107 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); |
109 const Function& function = RegisterFakeFunction(kName, code); | 108 const Function& function = RegisterFakeFunction(kName, code); |
110 GrowableArray<const Object*> arguments; | 109 const Array& args = Array::Handle(Object::empty_array()); |
111 const Array& kNoArgumentNames = Array::Handle(); | |
112 Smi& result = Smi::Handle(); | 110 Smi& result = Smi::Handle(); |
113 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames); | 111 result ^= DartEntry::InvokeStatic(function, args); |
114 EXPECT_EQ((value1 + value2), result.Value()); | 112 EXPECT_EQ((value1 + value2), result.Value()); |
115 } | 113 } |
116 | 114 |
117 } // namespace dart | 115 } // namespace dart |
118 | 116 |
119 #endif // defined TARGET_ARCH_IA32 | 117 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |