Chromium Code Reviews| Index: runtime/lib/identical.cc |
| diff --git a/runtime/lib/identical.cc b/runtime/lib/identical.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..85829560701de049e953b3931a2c3f46608e0010 |
| --- /dev/null |
| +++ b/runtime/lib/identical.cc |
| @@ -0,0 +1,23 @@ |
| +// Copyright (c) 2012, 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/bootstrap_natives.h" |
| + |
| +namespace dart { |
| + |
| +DEFINE_NATIVE_ENTRY(Identical_comparison, 2) { |
| + GET_NON_NULL_NATIVE_ARGUMENT( |
| + Instance, a, arguments->NativeArgAt(0)); |
| + GET_NON_NULL_NATIVE_ARGUMENT( |
| + Instance, b, arguments->NativeArgAt(1)); |
| + // If the objects are both smi's, compare their values. |
| + if (a.IsSmi() && b.IsSmi()) { |
| + return Bool::Get(a.Equals(b)); |
|
srdjan
2012/12/17 19:42:47
YOu need to do the same for Doubles, Mints and Big
Max Heinritz (Google)
2012/12/17 21:15:23
Done.
|
| + } |
| + // If the objects are not smi's, then compare their references. |
| + return Bool::Get(a.raw() == b.raw()); |
| +} |
| + |
| + |
| +} // namespace dart |