| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 11 matching lines...) Expand all Loading... |
| 98 extern const Function& RegisterFakeFunction(const char* name, | 97 extern const Function& RegisterFakeFunction(const char* name, |
| 99 const Code& code); | 98 const Code& code); |
| 100 const int value1 = 10; | 99 const int value1 = 10; |
| 101 const int value2 = 20; | 100 const int value2 = 20; |
| 102 const char* kName = "Test_CallLeafRuntimeStubCode"; | 101 const char* kName = "Test_CallLeafRuntimeStubCode"; |
| 103 Assembler _assembler_; | 102 Assembler _assembler_; |
| 104 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); | 103 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); |
| 105 const Code& code = Code::Handle(Code::FinalizeCode( | 104 const Code& code = Code::Handle(Code::FinalizeCode( |
| 106 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); | 105 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); |
| 107 const Function& function = RegisterFakeFunction(kName, code); | 106 const Function& function = RegisterFakeFunction(kName, code); |
| 108 GrowableArray<const Object*> arguments; | 107 const Array& args = Array::Handle(Object::empty_array()); |
| 109 const Array& kNoArgumentNames = Array::Handle(); | |
| 110 Smi& result = Smi::Handle(); | 108 Smi& result = Smi::Handle(); |
| 111 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames); | 109 result ^= DartEntry::InvokeStatic(function, args); |
| 112 EXPECT_EQ((value1 + value2), result.Value()); | 110 EXPECT_EQ((value1 + value2), result.Value()); |
| 113 } | 111 } |
| 114 | 112 |
| 115 } // namespace dart | 113 } // namespace dart |
| 116 | 114 |
| 117 #endif // defined TARGET_ARCH_X64 | 115 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |