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

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

Issue 63093003: Fix for issue 14790 - Crash when using dartium devtools (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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
« no previous file with comments | « runtime/vm/stub_code_x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
38 38
39 // Test calls to stub code which calls into the runtime. 39 // Test calls to stub code which calls into the runtime.
40 static void GenerateCallToCallRuntimeStub(Assembler* assembler, 40 static void GenerateCallToCallRuntimeStub(Assembler* assembler,
41 int value1, int value2) { 41 int value1, int value2) {
42 const int argc = 2; 42 const int argc = 2;
43 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 43 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
44 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 44 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
45 const Object& result = Object::ZoneHandle(); 45 const Object& result = Object::ZoneHandle();
46 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld)); 46 const Context& context = Context::ZoneHandle(Context::New(0, Heap::kOld));
47 ASSERT(context.isolate() == Isolate::Current()); 47 ASSERT(context.isolate() == Isolate::Current());
48 __ EnterStubFrameWithPP(); 48 __ EnterStubFrame(true);
49 __ LoadObject(CTX, context, PP); 49 __ LoadObject(CTX, context, PP);
50 __ PushObject(result, PP); // Push Null object for return value. 50 __ PushObject(result, PP); // Push Null object for return value.
51 __ PushObject(smi1, PP); // Push argument 1 smi1. 51 __ PushObject(smi1, PP); // Push argument 1 smi1.
52 __ PushObject(smi2, PP); // Push argument 2 smi2. 52 __ PushObject(smi2, PP); // Push argument 2 smi2.
53 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc); 53 ASSERT(kTestSmiSubRuntimeEntry.argument_count() == argc);
54 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func. 54 __ CallRuntime(kTestSmiSubRuntimeEntry, argc); // Call SmiSub runtime func.
55 __ AddImmediate(RSP, Immediate(argc * kWordSize), PP); 55 __ AddImmediate(RSP, Immediate(argc * kWordSize), PP);
56 __ popq(RAX); // Pop return value from return slot. 56 __ popq(RAX); // Pop return value from return slot.
57 __ LeaveFrameWithPP(); 57 __ LeaveStubFrame();
58 __ ret(); 58 __ ret();
59 } 59 }
60 60
61 61
62 TEST_CASE(CallRuntimeStubCode) { 62 TEST_CASE(CallRuntimeStubCode) {
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";
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); 104 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
105 const Function& function = RegisterFakeFunction(kName, code); 105 const Function& function = RegisterFakeFunction(kName, code);
106 Smi& result = Smi::Handle(); 106 Smi& result = Smi::Handle();
107 result ^= DartEntry::InvokeFunction(function, Object::empty_array()); 107 result ^= DartEntry::InvokeFunction(function, Object::empty_array());
108 EXPECT_EQ((value1 + value2), result.Value()); 108 EXPECT_EQ((value1 + value2), result.Value());
109 } 109 }
110 110
111 } // namespace dart 111 } // namespace dart
112 112
113 #endif // defined TARGET_ARCH_X64 113 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698