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

Unified Diff: runtime/vm/object.h

Issue 174393004: Add Dart_GetNativeFieldsOfArgument to get all the native fields of a dart (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months 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
« runtime/include/dart_api.h ('K') | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | 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 32872)
+++ runtime/vm/object.h (working copy)
@@ -3987,7 +3987,14 @@
return ((index >= 0) && (index < clazz()->ptr()->num_native_fields_));
}
- inline intptr_t GetNativeField(Isolate* isolate, int index) const;
+ inline intptr_t GetNativeField(int index) const;
+ inline void GetNativeFields(uint16_t num_fields,
+ intptr_t* field_values) const;
+
+ uint16_t NumNativeFields() const {
+ return clazz()->ptr()->num_native_fields_;
+ }
+
void SetNativeField(int index, intptr_t value) const;
// Returns true if the instance is a closure object.
@@ -6573,7 +6580,7 @@
}
-intptr_t Instance::GetNativeField(Isolate* isolate, int index) const {
+intptr_t Instance::GetNativeField(int index) const {
ASSERT(IsValidNativeIndex(index));
NoGCScope no_gc;
RawTypedData* native_fields =
@@ -6585,6 +6592,25 @@
}
+void Instance::GetNativeFields(uint16_t num_fields,
+ intptr_t* field_values) const {
+ NoGCScope no_gc;
+ ASSERT(num_fields == NumNativeFields());
+ ASSERT(field_values != NULL);
+ RawTypedData* native_fields =
+ reinterpret_cast<RawTypedData*>(*NativeFieldsAddr());
+ if (native_fields == TypedData::null()) {
+ for (intptr_t i = 0; i < num_fields; i++) {
+ field_values[i] = 0;
+ }
+ }
+ intptr_t* fields = reinterpret_cast<intptr_t*>(native_fields->ptr()->data_);
+ for (intptr_t i = 0; i < num_fields; i++) {
+ field_values[i] = fields[i];
+ }
+}
+
+
bool String::Equals(const String& str) const {
if (raw() == str.raw()) {
return true; // Both handles point to the same raw instance.
« runtime/include/dart_api.h ('K') | « runtime/vm/dart_api_impl_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698