| 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 11933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11944 } | 11944 } |
| 11945 return false; | 11945 return false; |
| 11946 } | 11946 } |
| 11947 | 11947 |
| 11948 | 11948 |
| 11949 void Instance::SetNativeField(int index, intptr_t value) const { | 11949 void Instance::SetNativeField(int index, intptr_t value) const { |
| 11950 ASSERT(IsValidNativeIndex(index)); | 11950 ASSERT(IsValidNativeIndex(index)); |
| 11951 Object& native_fields = Object::Handle(*NativeFieldsAddr()); | 11951 Object& native_fields = Object::Handle(*NativeFieldsAddr()); |
| 11952 if (native_fields.IsNull()) { | 11952 if (native_fields.IsNull()) { |
| 11953 // Allocate backing storage for the native fields. | 11953 // Allocate backing storage for the native fields. |
| 11954 const Class& cls = Class::Handle(clazz()); | 11954 native_fields = TypedData::New(kIntPtrCid, NumNativeFields()); |
| 11955 int num_native_fields = cls.num_native_fields(); | |
| 11956 native_fields = TypedData::New(kIntPtrCid, num_native_fields); | |
| 11957 StorePointer(NativeFieldsAddr(), native_fields.raw()); | 11955 StorePointer(NativeFieldsAddr(), native_fields.raw()); |
| 11958 } | 11956 } |
| 11959 intptr_t byte_offset = index * sizeof(intptr_t); | 11957 intptr_t byte_offset = index * sizeof(intptr_t); |
| 11960 TypedData::Cast(native_fields).SetIntPtr(byte_offset, value); | 11958 TypedData::Cast(native_fields).SetIntPtr(byte_offset, value); |
| 11961 } | 11959 } |
| 11962 | 11960 |
| 11963 | 11961 |
| 11964 bool Instance::IsClosure() const { | 11962 bool Instance::IsClosure() const { |
| 11965 const Class& cls = Class::Handle(clazz()); | 11963 const Class& cls = Class::Handle(clazz()); |
| 11966 return cls.IsSignatureClass(); | 11964 return cls.IsSignatureClass(); |
| (...skipping 5489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17456 return "_MirrorReference"; | 17454 return "_MirrorReference"; |
| 17457 } | 17455 } |
| 17458 | 17456 |
| 17459 | 17457 |
| 17460 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 17458 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 17461 Instance::PrintToJSONStream(stream, ref); | 17459 Instance::PrintToJSONStream(stream, ref); |
| 17462 } | 17460 } |
| 17463 | 17461 |
| 17464 | 17462 |
| 17465 } // namespace dart | 17463 } // namespace dart |
| OLD | NEW |