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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/stub_code_arm_test.cc ('k') | runtime/vm/vm_sources.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_mips_test.cc
===================================================================
--- runtime/vm/stub_code_mips_test.cc (revision 0)
+++ runtime/vm/stub_code_mips_test.cc (revision 0)
@@ -0,0 +1,89 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#include "vm/globals.h"
+#if defined(TARGET_ARCH_MIPS)
+
+#include "vm/isolate.h"
+#include "vm/dart_entry.h"
+#include "vm/native_entry.h"
+#include "vm/native_entry_test.h"
+#include "vm/object.h"
+#include "vm/runtime_entry.h"
+#include "vm/stub_code.h"
+#include "vm/symbols.h"
+#include "vm/unit_test.h"
+
+#define __ assembler->
+
+namespace dart {
+
+DECLARE_RUNTIME_ENTRY(TestSmiSub);
+DECLARE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, RawObject*, RawObject*);
+
+
+static Function* CreateFunction(const char* name) {
+ const String& class_name = String::Handle(Symbols::New("ownerClass"));
+ const Script& script = Script::Handle();
+ const Class& owner_class =
+ Class::Handle(Class::New(class_name, script, Scanner::kDummyTokenIndex));
+ const String& function_name = String::ZoneHandle(Symbols::New(name));
+ Function& function = Function::ZoneHandle(
+ Function::New(function_name, RawFunction::kRegularFunction,
+ true, false, false, false, owner_class, 0));
+ return &function;
+}
+
+
+// Test calls to stub code which calls into the runtime.
+static void GenerateCallToCallRuntimeStub(Assembler* assembler,
+ int value1, int value2) {
+ UNIMPLEMENTED();
+}
+
+
+TEST_CASE(CallRuntimeStubCode) {
+ extern const Function& RegisterFakeFunction(const char* name,
+ const Code& code);
+ const int value1 = 10;
+ const int value2 = 20;
+ const char* kName = "Test_CallRuntimeStubCode";
+ Assembler _assembler_;
+ GenerateCallToCallRuntimeStub(&_assembler_, value1, value2);
+ const Code& code = Code::Handle(Code::FinalizeCode(
+ *CreateFunction("Test_CallRuntimeStubCode"), &_assembler_));
+ const Function& function = RegisterFakeFunction(kName, code);
+ Smi& result = Smi::Handle();
+ result |= DartEntry::InvokeStatic(function, Object::empty_array());
+ EXPECT_EQ((value1 - value2), result.Value());
+}
+
+
+// Test calls to stub code which calls into a leaf runtime entry.
+static void GenerateCallToCallLeafRuntimeStub(Assembler* assembler,
+ int value1,
+ int value2) {
+ UNIMPLEMENTED();
+}
+
+
+TEST_CASE(CallLeafRuntimeStubCode) {
+ extern const Function& RegisterFakeFunction(const char* name,
+ const Code& code);
+ const int value1 = 10;
+ const int value2 = 20;
+ const char* kName = "Test_CallLeafRuntimeStubCode";
+ Assembler _assembler_;
+ GenerateCallToCallLeafRuntimeStub(&_assembler_, value1, value2);
+ const Code& code = Code::Handle(Code::FinalizeCode(
+ *CreateFunction("Test_CallLeafRuntimeStubCode"), &_assembler_));
+ const Function& function = RegisterFakeFunction(kName, code);
+ Smi& result = Smi::Handle();
+ result |= DartEntry::InvokeStatic(function, Object::empty_array());
+ EXPECT_EQ((value1 + value2), result.Value());
+}
+
+} // namespace dart
+
+#endif // defined TARGET_ARCH_MIPS
« 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