| 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 18 matching lines...) Expand all Loading... |
| 29 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); | 29 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); |
| 30 const Object& result = Object::ZoneHandle(); | 30 const Object& result = Object::ZoneHandle(); |
| 31 const Context& context = Context::ZoneHandle(Context::New(0)); | 31 const Context& context = Context::ZoneHandle(Context::New(0)); |
| 32 ASSERT(context.isolate() == Isolate::Current()); | 32 ASSERT(context.isolate() == Isolate::Current()); |
| 33 __ enter(Immediate(0)); | 33 __ enter(Immediate(0)); |
| 34 __ LoadObject(CTX, context); | 34 __ LoadObject(CTX, context); |
| 35 __ PushObject(result); // Push Null object for return value. | 35 __ PushObject(result); // Push Null object for return value. |
| 36 __ PushObject(smi1); // Push argument 1 smi1. | 36 __ PushObject(smi1); // Push argument 1 smi1. |
| 37 __ PushObject(smi2); // Push argument 2 smi2. | 37 __ PushObject(smi2); // Push argument 2 smi2. |
| 38 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); | 38 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); |
| 39 __ CallRuntimeFromStub(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func. | 39 __ CallRuntime(kTestSmiSubRuntimeEntry); // Call SmiSub runtime func. |
| 40 __ AddImmediate(ESP, Immediate(argc * kWordSize)); | 40 __ AddImmediate(ESP, Immediate(argc * kWordSize)); |
| 41 __ popl(EAX); // Pop return value from return slot. | 41 __ popl(EAX); // Pop return value from return slot. |
| 42 __ leave(); | 42 __ leave(); |
| 43 __ ret(); | 43 __ ret(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 | 46 |
| 47 TEST_CASE(CallRuntimeStubCode) { | 47 TEST_CASE(CallRuntimeStubCode) { |
| 48 extern const Function& RegisterFakeFunction(const char* name, | 48 extern const Function& RegisterFakeFunction(const char* name, |
| 49 const Code& code); | 49 const Code& code); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 GrowableArray<const Object*> arguments; | 106 GrowableArray<const Object*> arguments; |
| 107 const Array& kNoArgumentNames = Array::Handle(); | 107 const Array& kNoArgumentNames = Array::Handle(); |
| 108 Smi& result = Smi::Handle(); | 108 Smi& result = Smi::Handle(); |
| 109 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames); | 109 result ^= DartEntry::InvokeStatic(function, arguments, kNoArgumentNames); |
| 110 EXPECT_EQ((value1 - value2), result.Value()); | 110 EXPECT_EQ((value1 - value2), result.Value()); |
| 111 } | 111 } |
| 112 | 112 |
| 113 } // namespace dart | 113 } // namespace dart |
| 114 | 114 |
| 115 #endif // defined TARGET_ARCH_IA32 | 115 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |