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 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 // Test calls to stub code which calls into the runtime. | 41 // Test calls to stub code which calls into the runtime. |
42 static void GenerateCallToCallRuntimeStub(Assembler* assembler, | 42 static void GenerateCallToCallRuntimeStub(Assembler* assembler, |
43 int value1, int value2) { | 43 int value1, int value2) { |
44 const int argc = 2; | 44 const int argc = 2; |
45 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); | 45 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); |
46 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); | 46 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); |
47 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld)); | 47 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld)); |
48 ASSERT(context.isolate() == Isolate::Current()); | |
49 __ EnterDartFrame(0); | 48 __ EnterDartFrame(0); |
50 __ LoadObject(CTX, context); | 49 __ LoadObject(CTX, context); |
51 __ PushObject(Object::null_object()); // Push Null object for return value. | 50 __ PushObject(Object::null_object()); // Push Null object for return value. |
52 __ PushObject(smi1); // Push argument 1 smi1. | 51 __ PushObject(smi1); // Push argument 1 smi1. |
53 __ PushObject(smi2); // Push argument 2 smi2. | 52 __ PushObject(smi2); // Push argument 2 smi2. |
54 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); | 53 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); |
55 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func. | 54 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func. |
56 __ addiu(SP, SP, Immediate(argc * kWordSize)); | 55 __ addiu(SP, SP, Immediate(argc * kWordSize)); |
57 __ Pop(V0); // Pop return value from return slot. | 56 __ Pop(V0); // Pop return value from return slot. |
58 __ LeaveDartFrameAndReturn(); | 57 __ LeaveDartFrameAndReturn(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); | 102 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); |
104 const Function& function = RegisterFakeFunction(kName, code); | 103 const Function& function = RegisterFakeFunction(kName, code); |
105 Smi& result = Smi::Handle(); | 104 Smi& result = Smi::Handle(); |
106 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); | 105 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); |
107 EXPECT_EQ((value1 + value2), result.Value()); | 106 EXPECT_EQ((value1 + value2), result.Value()); |
108 } | 107 } |
109 | 108 |
110 } // namespace dart | 109 } // namespace dart |
111 | 110 |
112 #endif // defined TARGET_ARCH_MIPS | 111 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |