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

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

Issue 11785006: Support Null type in Class::TypeTest and simplify Instance::IsInstanceOf. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 6
7 #include "vm/exceptions.h" 7 #include "vm/exceptions.h"
8 #include "vm/native_entry.h" 8 #include "vm/native_entry.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/stack_frame.h" 10 #include "vm/stack_frame.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 } 55 }
56 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments); 56 Exceptions::ThrowByType(Exceptions::kNoSuchMethod, dart_arguments);
57 return Object::null(); 57 return Object::null();
58 } 58 }
59 59
60 60
61 DEFINE_NATIVE_ENTRY(Object_runtimeType, 1) { 61 DEFINE_NATIVE_ENTRY(Object_runtimeType, 1) {
62 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); 62 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
63 const Type& type = Type::Handle(instance.GetType()); 63 const Type& type = Type::Handle(instance.GetType());
64 // The static type of null is specified to be the bottom type, however, the
65 // runtime type of null is the Null type, which we correctly return here.
64 return type.Canonicalize(); 66 return type.Canonicalize();
65 } 67 }
66 68
67 69
68
69 DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) { 70 DEFINE_NATIVE_ENTRY(Object_instanceOf, 5) {
70 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); 71 const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0));
71 // Instantiator at position 1 is not used. It is passed along so that the call 72 // Instantiator at position 1 is not used. It is passed along so that the call
72 // can be easily converted to an optimized implementation. Instantiator is 73 // can be easily converted to an optimized implementation. Instantiator is
73 // used to populate the subtype cache. 74 // used to populate the subtype cache.
74 const AbstractTypeArguments& instantiator_type_arguments = 75 const AbstractTypeArguments& instantiator_type_arguments =
75 AbstractTypeArguments::CheckedHandle(arguments->NativeArgAt(2)); 76 AbstractTypeArguments::CheckedHandle(arguments->NativeArgAt(2));
76 const AbstractType& type = 77 const AbstractType& type =
77 AbstractType::CheckedHandle(arguments->NativeArgAt(3)); 78 AbstractType::CheckedHandle(arguments->NativeArgAt(3));
78 const Bool& negate = Bool::CheckedHandle(arguments->NativeArgAt(4)); 79 const Bool& negate = Bool::CheckedHandle(arguments->NativeArgAt(4));
(...skipping 19 matching lines...) Expand all
98 } 99 }
99 100
100 101
101 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) { 102 DEFINE_NATIVE_ENTRY(AbstractType_toString, 1) {
102 const AbstractType& type = 103 const AbstractType& type =
103 AbstractType::CheckedHandle(arguments->NativeArgAt(0)); 104 AbstractType::CheckedHandle(arguments->NativeArgAt(0));
104 return type.UserVisibleName(); 105 return type.UserVisibleName();
105 } 106 }
106 107
107 } // namespace dart 108 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698