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 12603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12614 const Double& a_double = Double::Cast(*this); | 12614 const Double& a_double = Double::Cast(*this); |
12615 const Double& b_double = Double::Cast(other); | 12615 const Double& b_double = Double::Cast(other); |
12616 if (isnan(a_double.value()) && isnan(b_double.value())) { | 12616 if (isnan(a_double.value()) && isnan(b_double.value())) { |
12617 return true; | 12617 return true; |
12618 } | 12618 } |
12619 } | 12619 } |
12620 return false; | 12620 return false; |
12621 } | 12621 } |
12622 | 12622 |
12623 | 12623 |
| 12624 intptr_t* Instance::NativeFieldsDataAddr() const { |
| 12625 NoGCScope no_gc; |
| 12626 RawTypedData* native_fields = |
| 12627 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); |
| 12628 if (native_fields == TypedData::null()) { |
| 12629 return NULL; |
| 12630 } |
| 12631 return reinterpret_cast<intptr_t*>(native_fields->ptr()->data_); |
| 12632 } |
| 12633 |
| 12634 |
12624 void Instance::SetNativeField(int index, intptr_t value) const { | 12635 void Instance::SetNativeField(int index, intptr_t value) const { |
12625 ASSERT(IsValidNativeIndex(index)); | 12636 ASSERT(IsValidNativeIndex(index)); |
12626 Object& native_fields = Object::Handle(*NativeFieldsAddr()); | 12637 Object& native_fields = Object::Handle(*NativeFieldsAddr()); |
12627 if (native_fields.IsNull()) { | 12638 if (native_fields.IsNull()) { |
12628 // Allocate backing storage for the native fields. | 12639 // Allocate backing storage for the native fields. |
12629 native_fields = TypedData::New(kIntPtrCid, NumNativeFields()); | 12640 native_fields = TypedData::New(kIntPtrCid, NumNativeFields()); |
12630 StorePointer(NativeFieldsAddr(), native_fields.raw()); | 12641 StorePointer(NativeFieldsAddr(), native_fields.raw()); |
12631 } | 12642 } |
12632 intptr_t byte_offset = index * sizeof(intptr_t); | 12643 intptr_t byte_offset = index * sizeof(intptr_t); |
12633 TypedData::Cast(native_fields).SetIntPtr(byte_offset, value); | 12644 TypedData::Cast(native_fields).SetIntPtr(byte_offset, value); |
(...skipping 5626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18260 return "_MirrorReference"; | 18271 return "_MirrorReference"; |
18261 } | 18272 } |
18262 | 18273 |
18263 | 18274 |
18264 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 18275 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
18265 Instance::PrintToJSONStream(stream, ref); | 18276 Instance::PrintToJSONStream(stream, ref); |
18266 } | 18277 } |
18267 | 18278 |
18268 | 18279 |
18269 } // namespace dart | 18280 } // namespace dart |
OLD | NEW |