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

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

Issue 11929037: Add test skeletons for arm and mips. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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_arm_test.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_MIPS)
7
8 #include "vm/isolate.h"
9 #include "vm/dart_entry.h"
10 #include "vm/native_entry.h"
11 #include "vm/native_entry_test.h"
12 #include "vm/object.h"
13 #include "vm/runtime_entry.h"
14 #include "vm/stub_code.h"
15 #include "vm/symbols.h"
16 #include "vm/unit_test.h"
17
18 #define __ assembler->
19
20 namespace dart {
21
22 DECLARE_RUNTIME_ENTRY(TestSmiSub);
23 DECLARE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, RawObject*, RawObject*);
24
25
26 static Function* CreateFunction(const char* name) {
27 const String& class_name = String::Handle(Symbols::New("ownerClass"));
28 const Script& script = Script::Handle();
29 const Class& owner_class =
30 Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
31 const String& function_name = String::ZoneHandle(Symbols::New(name));
32 Function& function = Function::ZoneHandle(
33 Function::New(function_name, RawFunction::kRegularFunction,
34 true, false, false, false, owner_class, 0));
35 return &function;
36 }
37
38
39 // Test calls to stub code which calls into the runtime.
40 static void GenerateCallToCallRuntimeStub(Assembler* assembler,
41 int value1, int value2) {
42 UNIMPLEMENTED();
43 }
44
45
46 TEST_CASE(CallRuntimeStubCode) {
47 extern const Function& RegisterFakeFunction(const char* name,
48 const Code& code);
49 const int value1 = 10;
50 const int value2 = 20;
51 const char* kName = "Test_CallRuntimeStubCode";
52 Assembler _assembler_;
53 GenerateCallToCallRuntimeStub(&_assembler_, value1, value2);
54 const Code& code = Code::Handle(Code::FinalizeCode(
55 *CreateFunction("Test_CallRuntimeStubCode"), &_assembler_));
56 const Function& function = RegisterFakeFunction(kName, code);
57 Smi& result = Smi::Handle();
58 result |= DartEntry::InvokeStatic(function, Object::empty_array());
59 EXPECT_EQ((value1 - value2), result.Value());
60 }
61
62
63 // Test calls to stub code which calls into a leaf runtime entry.
64 static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler,
65 int value1,
66 int value2) {
67 UNIMPLEMENTED();
68 }
69
70
71 TEST_CASE(CallLeafRuntimeStubCode) {
72 extern const Function& RegisterFakeFunction(const char* name,
73 const Code& code);
74 const int value1 = 10;
75 const int value2 = 20;
76 const char* kName = "Test_CallLeafRuntimeStubCode";
77 Assembler _assembler_;
78 GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2);
79 const Code& code = Code::Handle(Code::FinalizeCode(
80 *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
81 const Function& function = RegisterFakeFunction(kName, code);
82 Smi& result = Smi::Handle();
83 result |= DartEntry::InvokeStatic(function, Object::empty_array());
84 EXPECT_EQ((value1 + value2), result.Value());
85 }
86
87 } // namespace dart
88
89 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm_test.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698