Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Unified Diff: runtime/vm/object.h

Issue 11312183: - Do not mix scalar values and object fields in RawInstance to (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 14777)
+++ runtime/vm/object.h (working copy)
@@ -3074,14 +3074,9 @@
return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_));
}
- intptr_t GetNativeField(int index) const {
- return *NativeFieldAddr(index);
- }
+ inline intptr_t GetNativeField(Isolate* isolate, int index) const;
+ void SetNativeField(int index, intptr_t value) const;
- void SetNativeField(int index, intptr_t value) const {
- *NativeFieldAddr(index) = value;
- }
-
// Returns true if the instance is a closure object.
bool IsClosure() const;
@@ -3099,11 +3094,8 @@
RawObject** FieldAddr(const Field& field) const {
return FieldAddrAtOffset(field.Offset());
}
- intptr_t* NativeFieldAddr(int index) const {
- ASSERT(IsValidNativeIndex(index));
- return reinterpret_cast<intptr_t*>((raw_value() - kHeapObjectTag)
- + (index * kWordSize)
- + sizeof(RawObject));
+ RawObject** NativeFieldsAddr() const {
+ return FieldAddrAtOffset(sizeof(RawObject));
}
void SetFieldAtOffset(intptr_t offset, const Object& value) const {
StorePointer(FieldAddrAtOffset(offset), value.raw());
@@ -5849,6 +5841,18 @@
}
+intptr_t Instance::GetNativeField(Isolate* isolate, int index) const {
+ ASSERT(IsValidNativeIndex(index));
+ NoGCScope no_gc;
+ RawIntPtrArray* native_fields =
+ reinterpret_cast<RawIntPtrArray*>(*NativeFieldsAddr());
+ if (native_fields == IntPtrArray::null()) {
+ return 0;
+ }
+ return native_fields->ptr()->data_[index];
+}
+
+
bool String::Equals(const String& str) const {
if (raw() == str.raw()) {
return true; // Both handles point to the same raw instance.
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698