| 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 10465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10476 other_type_arguments = instantiated_other.arguments(); | 10476 other_type_arguments = instantiated_other.arguments(); |
| 10477 } else { | 10477 } else { |
| 10478 other_class = other.type_class(); | 10478 other_class = other.type_class(); |
| 10479 other_type_arguments = other.arguments(); | 10479 other_type_arguments = other.arguments(); |
| 10480 } | 10480 } |
| 10481 return cls.IsSubtypeOf(type_arguments, other_class, other_type_arguments, | 10481 return cls.IsSubtypeOf(type_arguments, other_class, other_type_arguments, |
| 10482 bound_error); | 10482 bound_error); |
| 10483 } | 10483 } |
| 10484 | 10484 |
| 10485 | 10485 |
| 10486 bool Instance::IsIdenticalTo(const Instance& other) const { |
| 10487 if (raw() == other.raw()) return true; |
| 10488 if (IsInteger() && other.IsInteger()) { |
| 10489 return Equals(other); |
| 10490 } |
| 10491 if (IsDouble() && other.IsDouble()) { |
| 10492 if (Equals(other)) return true; |
| 10493 // Check for NaN. |
| 10494 const Double& a_double = Double::Cast(*this); |
| 10495 const Double& b_double = Double::Cast(other); |
| 10496 if (isnan(a_double.value()) && isnan(b_double.value())) { |
| 10497 return true; |
| 10498 } |
| 10499 } |
| 10500 return false; |
| 10501 } |
| 10502 |
| 10503 |
| 10486 void Instance::SetNativeField(int index, intptr_t value) const { | 10504 void Instance::SetNativeField(int index, intptr_t value) const { |
| 10487 ASSERT(IsValidNativeIndex(index)); | 10505 ASSERT(IsValidNativeIndex(index)); |
| 10488 Object& native_fields = Object::Handle(*NativeFieldsAddr()); | 10506 Object& native_fields = Object::Handle(*NativeFieldsAddr()); |
| 10489 if (native_fields.IsNull()) { | 10507 if (native_fields.IsNull()) { |
| 10490 // Allocate backing storage for the native fields. | 10508 // Allocate backing storage for the native fields. |
| 10491 const Class& cls = Class::Handle(clazz()); | 10509 const Class& cls = Class::Handle(clazz()); |
| 10492 int num_native_fields = cls.num_native_fields(); | 10510 int num_native_fields = cls.num_native_fields(); |
| 10493 native_fields = TypedData::New(kIntPtrCid, num_native_fields); | 10511 native_fields = TypedData::New(kIntPtrCid, num_native_fields); |
| 10494 StorePointer(NativeFieldsAddr(), native_fields.raw()); | 10512 StorePointer(NativeFieldsAddr(), native_fields.raw()); |
| 10495 } | 10513 } |
| (...skipping 4540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15036 return "_MirrorReference"; | 15054 return "_MirrorReference"; |
| 15037 } | 15055 } |
| 15038 | 15056 |
| 15039 | 15057 |
| 15040 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15058 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 15041 JSONObject jsobj(stream); | 15059 JSONObject jsobj(stream); |
| 15042 } | 15060 } |
| 15043 | 15061 |
| 15044 | 15062 |
| 15045 } // namespace dart | 15063 } // namespace dart |
| OLD | NEW |