Files
sdk/runtime/vm/runtime_entry_test.cc
T
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00

26 lines
830 B
C++

// Copyright (c) 2011, 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/runtime_entry.h"
#include "vm/object.h"
#include "vm/verifier.h"
namespace dart {
// A runtime call for test purposes.
// Arg0: a smi.
// Arg1: a smi.
// Result: a smi representing arg0 - arg1.
DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) {
ASSERT(arguments.Count() == kTestSmiSubRuntimeEntry.argument_count());
const Smi& left = Smi::CheckedHandle(arguments.At(0));
const Smi& right = Smi::CheckedHandle(arguments.At(1));
// Ignoring overflow in the calculation below.
intptr_t result = left.Value() - right.Value();
arguments.SetReturn(Smi::Handle(Smi::New(result)));
}
} // namespace dart