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

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

Issue 12315087: Hook up simulator (if needed) when calling Dart code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months 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_ia32.cc ('k') | runtime/vm/stub_code_mips_test.cc » ('j') | 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_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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 Smi& result = Smi::Handle(); 73 Smi& result = Smi::Handle();
74 result ^= DartEntry::InvokeStatic(function, Object::empty_array()); 74 result ^= DartEntry::InvokeFunction(function, Object::empty_array());
75 EXPECT_EQ((value1 - value2), result.Value()); 75 EXPECT_EQ((value1 - value2), result.Value());
76 } 76 }
77 77
78 78
79 // Test calls to stub code which calls into a leaf runtime entry. 79 // Test calls to stub code which calls into a leaf runtime entry.
80 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler, 80 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler,
81 int value1, 81 int value1,
82 int value2) { 82 int value2) {
83 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1)); 83 const Smi& smi1 = Smi::ZoneHandle(Smi::New(value1));
84 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2)); 84 const Smi& smi2 = Smi::ZoneHandle(Smi::New(value2));
(...skipping 14 matching lines...) Expand all
99 const Code& code); 99 const Code& code);
100 const int value1 = 10; 100 const int value1 = 10;
101 const int value2 = 20; 101 const int value2 = 20;
102 const char* kName = "Test_CallLeafRuntimeStubCode"; 102 const char* kName = "Test_CallLeafRuntimeStubCode";
103 Assembler _assembler_; 103 Assembler _assembler_;
104 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2); 104 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2);
105 const Code& code = Code::Handle(Code::FinalizeCode( 105 const Code& code = Code::Handle(Code::FinalizeCode(
106 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_)); 106 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
107 const Function& function = RegisterFakeFunction(kName, code); 107 const Function& function = RegisterFakeFunction(kName, code);
108 Smi& result = Smi::Handle(); 108 Smi& result = Smi::Handle();
109 result ^= DartEntry::InvokeStatic(function, Object::empty_array()); 109 result ^= DartEntry::InvokeFunction(function, Object::empty_array());
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
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | runtime/vm/stub_code_mips_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698