OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 10340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10351 other_type_arguments = instantiated_other.arguments(); | 10351 other_type_arguments = instantiated_other.arguments(); |
10352 } else { | 10352 } else { |
10353 other_class = other.type_class(); | 10353 other_class = other.type_class(); |
10354 other_type_arguments = other.arguments(); | 10354 other_type_arguments = other.arguments(); |
10355 } | 10355 } |
10356 return cls.IsSubtypeOf(type_arguments, other_class, other_type_arguments, | 10356 return cls.IsSubtypeOf(type_arguments, other_class, other_type_arguments, |
10357 bound_error); | 10357 bound_error); |
10358 } | 10358 } |
10359 | 10359 |
10360 | 10360 |
10361 bool Instance::IsIdenticalTo(const Instance& other) const { | |
10362 if (raw() == other.raw()) return true; | |
10363 if (IsInteger() && other.IsInteger()) { | |
10364 return Equals(other); | |
10365 } | |
10366 if (IsDouble() && other.IsDouble()) { | |
10367 if (Equals(other)) return true; | |
10368 // Check for NaN. | |
10369 const Double& a_double = Double::Cast(*this); | |
10370 const Double& b_double = Double::Cast(other); | |
10371 if (isnan(a_double.value()) && isnan(b_double.value())) { | |
10372 return true; | |
10373 } | |
10374 } | |
10375 return false; | |
10376 } | |
10377 | |
10378 | |
10379 void Instance::SetNativeField(int index, intptr_t value) const { | 10361 void Instance::SetNativeField(int index, intptr_t value) const { |
10380 ASSERT(IsValidNativeIndex(index)); | 10362 ASSERT(IsValidNativeIndex(index)); |
10381 Object& native_fields = Object::Handle(*NativeFieldsAddr()); | 10363 Object& native_fields = Object::Handle(*NativeFieldsAddr()); |
10382 if (native_fields.IsNull()) { | 10364 if (native_fields.IsNull()) { |
10383 // Allocate backing storage for the native fields. | 10365 // Allocate backing storage for the native fields. |
10384 const Class& cls = Class::Handle(clazz()); | 10366 const Class& cls = Class::Handle(clazz()); |
10385 int num_native_fields = cls.num_native_fields(); | 10367 int num_native_fields = cls.num_native_fields(); |
10386 native_fields = TypedData::New(kIntPtrCid, num_native_fields); | 10368 native_fields = TypedData::New(kIntPtrCid, num_native_fields); |
10387 StorePointer(NativeFieldsAddr(), native_fields.raw()); | 10369 StorePointer(NativeFieldsAddr(), native_fields.raw()); |
10388 } | 10370 } |
(...skipping 4540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14929 return "_MirrorReference"; | 14911 return "_MirrorReference"; |
14930 } | 14912 } |
14931 | 14913 |
14932 | 14914 |
14933 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14915 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
14934 JSONObject jsobj(stream); | 14916 JSONObject jsobj(stream); |
14935 } | 14917 } |
14936 | 14918 |
14937 | 14919 |
14938 } // namespace dart | 14920 } // namespace dart |
OLD | NEW |