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 5971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 intptr_t byte_offset = index * sizeof(intptr_t); |
| 5992 return *reinterpret_cast<intptr_t*>(native_fields->ptr()->data_ + | 5992 return *reinterpret_cast<intptr_t*>( |
| 5993 byte_offset); | 5993 reinterpret_cast<intptr_t>(native_fields->ptr()->data_) + byte_offset); |
|
siva
2013/08/06 22:53:43
Please add a comment here as to why the multiple r
Chris Bracken
2013/08/07 06:12:57
Rewrote with a simpler approach for indexing into
| |
| 5994 } | 5994 } |
| 5995 | 5995 |
| 5996 | 5996 |
| 5997 bool String::Equals(const String& str) const { | 5997 bool String::Equals(const String& str) const { |
| 5998 if (raw() == str.raw()) { | 5998 if (raw() == str.raw()) { |
| 5999 return true; // Both handles point to the same raw instance. | 5999 return true; // Both handles point to the same raw instance. |
| 6000 } | 6000 } |
| 6001 if (str.IsNull()) { | 6001 if (str.IsNull()) { |
| 6002 return false; | 6002 return false; |
| 6003 } | 6003 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6039 | 6039 |
| 6040 | 6040 |
| 6041 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6041 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6042 intptr_t index) { | 6042 intptr_t index) { |
| 6043 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6043 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6044 } | 6044 } |
| 6045 | 6045 |
| 6046 } // namespace dart | 6046 } // namespace dart |
| 6047 | 6047 |
| 6048 #endif // VM_OBJECT_H_ | 6048 #endif // VM_OBJECT_H_ |
| OLD | NEW |