Chromium Code Reviews| 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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 5970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5981 | 5981 |
| 5982 | 5982 |
| 5983 intptr_t Instance::GetNativeField(Isolate* isolate, int index) const { | 5983 intptr_t Instance::GetNativeField(Isolate* isolate, int index) const { |
| 5984 ASSERT(IsValidNativeIndex(index)); | 5984 ASSERT(IsValidNativeIndex(index)); |
| 5985 NoGCScope no_gc; | 5985 NoGCScope no_gc; |
| 5986 RawTypedData* native_fields = | 5986 RawTypedData* native_fields = |
| 5987 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); | 5987 reinterpret_cast<RawTypedData*>(*NativeFieldsAddr()); |
| 5988 if (native_fields == TypedData::null()) { | 5988 if (native_fields == TypedData::null()) { |
| 5989 return 0; | 5989 return 0; |
| 5990 } | 5990 } |
| 5991 intptr_t byte_offset = index * sizeof(intptr_t); | 5991 return *(reinterpret_cast<intptr_t*>(native_fields->ptr()->data_) + index); |
|
srdjan
2013/08/07 18:36:43
From Slava:
nit: you can use array syntax for thi
| |
| 5992 return *reinterpret_cast<intptr_t*>(native_fields->ptr()->data_ + | |
| 5993 byte_offset); | |
| 5994 } | 5992 } |
| 5995 | 5993 |
| 5996 | 5994 |
| 5997 bool String::Equals(const String& str) const { | 5995 bool String::Equals(const String& str) const { |
| 5998 if (raw() == str.raw()) { | 5996 if (raw() == str.raw()) { |
| 5999 return true; // Both handles point to the same raw instance. | 5997 return true; // Both handles point to the same raw instance. |
| 6000 } | 5998 } |
| 6001 if (str.IsNull()) { | 5999 if (str.IsNull()) { |
| 6002 return false; | 6000 return false; |
| 6003 } | 6001 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6039 | 6037 |
| 6040 | 6038 |
| 6041 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6039 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6042 intptr_t index) { | 6040 intptr_t index) { |
| 6043 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6041 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6044 } | 6042 } |
| 6045 | 6043 |
| 6046 } // namespace dart | 6044 } // namespace dart |
| 6047 | 6045 |
| 6048 #endif // VM_OBJECT_H_ | 6046 #endif // VM_OBJECT_H_ |
| OLD | NEW |