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

Side by Side Diff: include/v8.h

Issue 177343002: Allow Object::InternalFieldCount and Object::GetAlignedPointerFromInternalField to be called from P… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 569
570 private: 570 private:
571 friend class Isolate; 571 friend class Isolate;
572 friend class Utils; 572 friend class Utils;
573 template<class F> friend class Handle; 573 template<class F> friend class Handle;
574 template<class F> friend class Local; 574 template<class F> friend class Local;
575 template<class F1, class F2> friend class Persistent; 575 template<class F1, class F2> friend class Persistent;
576 template<class F> friend class UniquePersistent; 576 template<class F> friend class UniquePersistent;
577 template<class F> friend class PersistentBase; 577 template<class F> friend class PersistentBase;
578 template<class F> friend class ReturnValue; 578 template<class F> friend class ReturnValue;
579 friend class Object;
579 580
580 explicit V8_INLINE PersistentBase(T* val) : val_(val) {} 581 explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
581 PersistentBase(PersistentBase& other); // NOLINT 582 PersistentBase(PersistentBase& other); // NOLINT
582 void operator=(PersistentBase&); 583 void operator=(PersistentBase&);
583 V8_INLINE static T* New(Isolate* isolate, T* that); 584 V8_INLINE static T* New(Isolate* isolate, T* that);
584 585
585 T* val_; 586 T* val_;
586 }; 587 };
587 588
588 589
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after
2178 Local<Value> GetConstructor(); 2179 Local<Value> GetConstructor();
2179 2180
2180 /** 2181 /**
2181 * Returns the name of the function invoked as a constructor for this object. 2182 * Returns the name of the function invoked as a constructor for this object.
2182 */ 2183 */
2183 Local<String> GetConstructorName(); 2184 Local<String> GetConstructorName();
2184 2185
2185 /** Gets the number of internal fields for this Object. */ 2186 /** Gets the number of internal fields for this Object. */
2186 int InternalFieldCount(); 2187 int InternalFieldCount();
2187 2188
2189 /** Same as above, but works for Persistents */
2190 V8_INLINE static int InternalFieldCount(
2191 const PersistentBase<Object>& object) {
2192 return object.val_->InternalFieldCount();
2193 }
2194
2188 /** Gets the value from an internal field. */ 2195 /** Gets the value from an internal field. */
2189 V8_INLINE Local<Value> GetInternalField(int index); 2196 V8_INLINE Local<Value> GetInternalField(int index);
2190 2197
2191 /** Sets the value in an internal field. */ 2198 /** Sets the value in an internal field. */
2192 void SetInternalField(int index, Handle<Value> value); 2199 void SetInternalField(int index, Handle<Value> value);
2193 2200
2194 /** 2201 /**
2195 * Gets a 2-byte-aligned native pointer from an internal field. This field 2202 * Gets a 2-byte-aligned native pointer from an internal field. This field
2196 * must have been set by SetAlignedPointerInInternalField, everything else 2203 * must have been set by SetAlignedPointerInInternalField, everything else
2197 * leads to undefined behavior. 2204 * leads to undefined behavior.
2198 */ 2205 */
2199 V8_INLINE void* GetAlignedPointerFromInternalField(int index); 2206 V8_INLINE void* GetAlignedPointerFromInternalField(int index);
2200 2207
2208 /** Same as above, but works for Persistents */
2209 V8_INLINE static void* GetAlignedPointerFromInternalField(
2210 const PersistentBase<Object>& object, int index) {
2211 return object.val_->GetAlignedPointerFromInternalField(index);
2212 }
2213
2201 /** 2214 /**
2202 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such 2215 * Sets a 2-byte-aligned native pointer in an internal field. To retrieve such
2203 * a field, GetAlignedPointerFromInternalField must be used, everything else 2216 * a field, GetAlignedPointerFromInternalField must be used, everything else
2204 * leads to undefined behavior. 2217 * leads to undefined behavior.
2205 */ 2218 */
2206 void SetAlignedPointerInInternalField(int index, void* value); 2219 void SetAlignedPointerInInternalField(int index, void* value);
2207 2220
2208 // Testers for local properties. 2221 // Testers for local properties.
2209 bool HasOwnProperty(Handle<String> key); 2222 bool HasOwnProperty(Handle<String> key);
2210 bool HasRealNamedProperty(Handle<String> key); 2223 bool HasRealNamedProperty(Handle<String> key);
(...skipping 4244 matching lines...) Expand 10 before | Expand all | Expand 10 after
6455 */ 6468 */
6456 6469
6457 6470
6458 } // namespace v8 6471 } // namespace v8
6459 6472
6460 6473
6461 #undef TYPE_CHECK 6474 #undef TYPE_CHECK
6462 6475
6463 6476
6464 #endif // V8_H_ 6477 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698