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

Side by Side Diff: runtime/lib/identical.cc

Issue 11613003: Implement a native identical function in the VM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cleanup for review Created 8 years 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
OLDNEW
(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 namespace dart {
8
9 DEFINE_NATIVE_ENTRY(Identical_comparison, 2) {
10 GET_NON_NULL_NATIVE_ARGUMENT(
11 Instance, a, arguments->NativeArgAt(0));
srdjan 2012/12/17 22:10:19 Null can be an argument: identical(null, 2). Pleas
Max Heinritz (Google) 2012/12/17 23:27:57 Done.
12 GET_NON_NULL_NATIVE_ARGUMENT(
13 Instance, b, arguments->NativeArgAt(1));
14 // If objects are both numbers of the same type, compare values.
srdjan 2012/12/17 22:10:19 Suggestion: if (a.raw() == b.raw()) return Bool::
Max Heinritz (Google) 2012/12/17 23:27:57 Done.
15 if ((a.IsSmi() && b.IsSmi()) ||
16 (a.IsMint() && b.IsMint()) ||
17 (a.IsDouble() && b.IsDouble()) ||
18 (a.IsBigint() && b.IsBigint())) {
19 return Bool::Get(a.Equals(b));
20 }
21 // If the objects are not numbers, compare references.
22 return Bool::Get(a.raw() == b.raw());
23 }
24
25
26 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/lib/identical_patch.dart » ('j') | tests/language/identical_closure_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698