Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, 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/bootstrap_natives.h" | |
| 6 | |
| 7 #include "vm/object.h" | |
| 8 | |
| 9 namespace dart { | |
| 10 | |
| 11 DEFINE_NATIVE_ENTRY(Identical_comparison, 2) { | |
| 12 GET_NATIVE_ARGUMENT( | |
| 13 Instance, a, arguments->NativeArgAt(0)); | |
|
srdjan
2012/12/17 23:30:20
Can this fit in one line (80 chars).
| |
| 14 GET_NATIVE_ARGUMENT( | |
| 15 Instance, b, arguments->NativeArgAt(1)); | |
|
srdjan
2012/12/17 23:30:20
Ditto.
| |
| 16 if (a.raw() == b.raw()) return Bool::True(); | |
| 17 if (a.IsInteger() && b.IsInteger()) { | |
| 18 return Bool::Get(a.Equals(b)); | |
| 19 } | |
| 20 if (a.IsDouble() && b.IsDouble()) { | |
| 21 if (a.Equals(b)) return Bool::True(); | |
| 22 // Check for NaN | |
|
srdjan
2012/12/17 23:30:20
Terminate comment with a period.
| |
| 23 const Double& a_double = Double::Cast(a); | |
| 24 const Double& b_double = Double::Cast(b); | |
| 25 if (isnan(a_double.value()) && isnan(b_double.value())) { | |
| 26 return Bool::True(); | |
| 27 } | |
| 28 } | |
| 29 return Bool::False(); | |
| 30 } | |
| 31 | |
| 32 | |
| 33 } // namespace dart | |
| OLD | NEW |