Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: runtime/vm/stub_code_x64_test.cc

Issue 678763004: Make CTX allocatable by the register allocator. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: incorporated latest comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 26 matching lines...) Expand all
37 return &function; 37 return &function;
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));
48 __ EnterStubFrame(true); 47 __ EnterStubFrame(true);
49 __ LoadObject(CTX, context, PP);
50 __ PushObject(Object::null_object(), PP); // Push Null obj for return value. 48 __ PushObject(Object::null_object(), PP); // Push Null obj for return value.
51 __ PushObject(smi1, PP); // Push argument 1 smi1. 49 __ PushObject(smi1, PP); // Push argument 1 smi1.
52 __ PushObject(smi2, PP); // Push argument 2 smi2. 50 __ PushObject(smi2, PP); // Push argument 2 smi2.
53 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); 51 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
54 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func. 52 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func.
55 __ AddImmediate(RSP, Immediate(argc * kWordSize), PP); 53 __ AddImmediate(RSP, Immediate(argc * kWordSize), PP);
56 __ popq(RAX); // Pop return value from return slot. 54 __ popq(RAX); // Pop return value from return slot.
57 __ LeaveStubFrame(); 55 __ LeaveStubFrame();
58 __ ret(); 56 __ ret();
59 } 57 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); 102 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
105 const Function& function = RegisterFakeFunction(kName, code); 103 const Function& function = RegisterFakeFunction(kName, code);
106 Smi& result = Smi::Handle(); 104 Smi& result = Smi::Handle();
107 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); 105 result ^= DartEntry::InvokeFunction(function, Object::empty_array());
108 EXPECT_EQ((value1 + value2), result.Value()); 106 EXPECT_EQ((value1 + value2), result.Value());
109 } 107 }
110 108
111 } // namespace dart 109 } // namespace dart
112 110
113 #endif // defined TARGET_ARCH_X64 111 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698