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

Side by Side Diff: src/objects.h

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: Remove API changes Created 3 years, 9 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
« no previous file with comments | « src/i18n.cc ('k') | src/objects.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 2348
2349 // Support functions for v8 api (needed for correct interceptor behavior). 2349 // Support functions for v8 api (needed for correct interceptor behavior).
2350 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty( 2350 MUST_USE_RESULT static Maybe<bool> HasRealNamedProperty(
2351 Handle<JSObject> object, Handle<Name> name); 2351 Handle<JSObject> object, Handle<Name> name);
2352 MUST_USE_RESULT static Maybe<bool> HasRealElementProperty( 2352 MUST_USE_RESULT static Maybe<bool> HasRealElementProperty(
2353 Handle<JSObject> object, uint32_t index); 2353 Handle<JSObject> object, uint32_t index);
2354 MUST_USE_RESULT static Maybe<bool> HasRealNamedCallbackProperty( 2354 MUST_USE_RESULT static Maybe<bool> HasRealNamedCallbackProperty(
2355 Handle<JSObject> object, Handle<Name> name); 2355 Handle<JSObject> object, Handle<Name> name);
2356 2356
2357 // Get the header size for a JSObject. Used to compute the index of 2357 // Get the header size for a JSObject. Used to compute the index of
2358 // internal fields as well as the number of internal fields. 2358 // embedder fields as well as the number of embedder fields.
2359 static inline int GetHeaderSize(InstanceType instance_type); 2359 static inline int GetHeaderSize(InstanceType instance_type);
2360 inline int GetHeaderSize(); 2360 inline int GetHeaderSize();
2361 2361
2362 static inline int GetInternalFieldCount(Map* map); 2362 static inline int GetEmbedderFieldCount(Map* map);
2363 inline int GetInternalFieldCount(); 2363 inline int GetEmbedderFieldCount();
2364 inline int GetInternalFieldOffset(int index); 2364 inline int GetEmbedderFieldOffset(int index);
2365 inline Object* GetInternalField(int index); 2365 inline Object* GetEmbedderField(int index);
2366 inline void SetInternalField(int index, Object* value); 2366 inline void SetEmbedderField(int index, Object* value);
2367 inline void SetInternalField(int index, Smi* value); 2367 inline void SetEmbedderField(int index, Smi* value);
2368 bool WasConstructedFromApiFunction(); 2368 bool WasConstructedFromApiFunction();
2369 2369
2370 // Returns a new map with all transitions dropped from the object's current 2370 // Returns a new map with all transitions dropped from the object's current
2371 // map and the ElementsKind set. 2371 // map and the ElementsKind set.
2372 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, 2372 static Handle<Map> GetElementsTransitionMap(Handle<JSObject> object,
2373 ElementsKind to_kind); 2373 ElementsKind to_kind);
2374 static void TransitionElementsKind(Handle<JSObject> object, 2374 static void TransitionElementsKind(Handle<JSObject> object,
2375 ElementsKind to_kind); 2375 ElementsKind to_kind);
2376 2376
2377 // Always use this to migrate an object to a new map. 2377 // Always use this to migrate an object to a new map.
(...skipping 5669 matching lines...) Expand 10 before | Expand all | Expand 10 after
8047 // by the garbage collector. 8047 // by the garbage collector.
8048 DECL_ACCESSORS(next_function_link, Object) 8048 DECL_ACCESSORS(next_function_link, Object)
8049 8049
8050 // Prints the name of the function using PrintF. 8050 // Prints the name of the function using PrintF.
8051 void PrintName(FILE* out = stdout); 8051 void PrintName(FILE* out = stdout);
8052 8052
8053 DECLARE_CAST(JSFunction) 8053 DECLARE_CAST(JSFunction)
8054 8054
8055 // Calculate the instance size and in-object properties count. 8055 // Calculate the instance size and in-object properties count.
8056 void CalculateInstanceSize(InstanceType instance_type, 8056 void CalculateInstanceSize(InstanceType instance_type,
8057 int requested_internal_fields, int* instance_size, 8057 int requested_embedder_fields, int* instance_size,
8058 int* in_object_properties); 8058 int* in_object_properties);
8059 void CalculateInstanceSizeForDerivedClass(InstanceType instance_type, 8059 void CalculateInstanceSizeForDerivedClass(InstanceType instance_type,
8060 int requested_internal_fields, 8060 int requested_embedder_fields,
8061 int* instance_size, 8061 int* instance_size,
8062 int* in_object_properties); 8062 int* in_object_properties);
8063 static void CalculateInstanceSizeHelper(InstanceType instance_type, 8063 static void CalculateInstanceSizeHelper(InstanceType instance_type,
8064 int requested_internal_fields, 8064 int requested_embedder_fields,
8065 int requested_in_object_properties, 8065 int requested_in_object_properties,
8066 int* instance_size, 8066 int* instance_size,
8067 int* in_object_properties); 8067 int* in_object_properties);
8068 // Visiting policy flags define whether the code entry or next function 8068 // Visiting policy flags define whether the code entry or next function
8069 // should be visited or not. 8069 // should be visited or not.
8070 enum BodyVisitingPolicy { 8070 enum BodyVisitingPolicy {
8071 kVisitCodeEntry = 1 << 0, 8071 kVisitCodeEntry = 1 << 0,
8072 kVisitNextFunction = 1 << 1, 8072 kVisitNextFunction = 1 << 1,
8073 8073
8074 kSkipCodeEntryAndNextFunction = 0, 8074 kSkipCodeEntryAndNextFunction = 0,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
8141 // It is null value if this object is not used by any context. 8141 // It is null value if this object is not used by any context.
8142 DECL_ACCESSORS(native_context, Object) 8142 DECL_ACCESSORS(native_context, Object)
8143 8143
8144 // [hash]: The hash code property (undefined if not initialized yet). 8144 // [hash]: The hash code property (undefined if not initialized yet).
8145 DECL_ACCESSORS(hash, Object) 8145 DECL_ACCESSORS(hash, Object)
8146 8146
8147 DECLARE_CAST(JSGlobalProxy) 8147 DECLARE_CAST(JSGlobalProxy)
8148 8148
8149 inline bool IsDetachedFrom(JSGlobalObject* global) const; 8149 inline bool IsDetachedFrom(JSGlobalObject* global) const;
8150 8150
8151 static int SizeWithInternalFields(int internal_field_count); 8151 static int SizeWithEmbedderFields(int embedder_field_count);
8152 8152
8153 // Dispatched behavior. 8153 // Dispatched behavior.
8154 DECLARE_PRINTER(JSGlobalProxy) 8154 DECLARE_PRINTER(JSGlobalProxy)
8155 DECLARE_VERIFIER(JSGlobalProxy) 8155 DECLARE_VERIFIER(JSGlobalProxy)
8156 8156
8157 // Layout description. 8157 // Layout description.
8158 static const int kNativeContextOffset = JSObject::kHeaderSize; 8158 static const int kNativeContextOffset = JSObject::kHeaderSize;
8159 static const int kHashOffset = kNativeContextOffset + kPointerSize; 8159 static const int kHashOffset = kNativeContextOffset + kPointerSize;
8160 static const int kSize = kHashOffset + kPointerSize; 8160 static const int kSize = kHashOffset + kPointerSize;
8161 8161
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
10431 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap); 10431 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
10432 }; 10432 };
10433 10433
10434 class JSArrayIterator : public JSObject { 10434 class JSArrayIterator : public JSObject {
10435 public: 10435 public:
10436 DECLARE_PRINTER(JSArrayIterator) 10436 DECLARE_PRINTER(JSArrayIterator)
10437 DECLARE_VERIFIER(JSArrayIterator) 10437 DECLARE_VERIFIER(JSArrayIterator)
10438 10438
10439 DECLARE_CAST(JSArrayIterator) 10439 DECLARE_CAST(JSArrayIterator)
10440 10440
10441 // [object]: the [[IteratedObject]] internal field. 10441 // [object]: the [[IteratedObject]] inobject property.
vogelheim 2017/03/15 09:43:51 Thanks for the comment fix! I hadn't noticed that
10442 DECL_ACCESSORS(object, Object) 10442 DECL_ACCESSORS(object, Object)
10443 10443
10444 // [index]: The [[ArrayIteratorNextIndex]] internal field. 10444 // [index]: The [[ArrayIteratorNextIndex]] inobject property.
10445 DECL_ACCESSORS(index, Object) 10445 DECL_ACCESSORS(index, Object)
10446 10446
10447 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is 10447 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is
10448 // allocated. 10448 // allocated.
10449 DECL_ACCESSORS(object_map, Object) 10449 DECL_ACCESSORS(object_map, Object)
10450 10450
10451 // Return the ElementsKind that a JSArrayIterator's [[IteratedObject]] is 10451 // Return the ElementsKind that a JSArrayIterator's [[IteratedObject]] is
10452 // expected to have, based on its instance type. 10452 // expected to have, based on its instance type.
10453 static ElementsKind ElementsKindForInstanceType(InstanceType instance_type); 10453 static ElementsKind ElementsKindForInstanceType(InstanceType instance_type);
10454 10454
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
10488 }; 10488 };
10489 10489
10490 class JSStringIterator : public JSObject { 10490 class JSStringIterator : public JSObject {
10491 public: 10491 public:
10492 // Dispatched behavior. 10492 // Dispatched behavior.
10493 DECLARE_PRINTER(JSStringIterator) 10493 DECLARE_PRINTER(JSStringIterator)
10494 DECLARE_VERIFIER(JSStringIterator) 10494 DECLARE_VERIFIER(JSStringIterator)
10495 10495
10496 DECLARE_CAST(JSStringIterator) 10496 DECLARE_CAST(JSStringIterator)
10497 10497
10498 // [string]: the [[IteratedString]] internal field. 10498 // [string]: the [[IteratedString]] inobject property.
10499 DECL_ACCESSORS(string, String) 10499 DECL_ACCESSORS(string, String)
10500 10500
10501 // [index]: The [[StringIteratorNextIndex]] internal field. 10501 // [index]: The [[StringIteratorNextIndex]] inobject property.
10502 inline int index() const; 10502 inline int index() const;
10503 inline void set_index(int value); 10503 inline void set_index(int value);
10504 10504
10505 static const int kStringOffset = JSObject::kHeaderSize; 10505 static const int kStringOffset = JSObject::kHeaderSize;
10506 static const int kNextIndexOffset = kStringOffset + kPointerSize; 10506 static const int kNextIndexOffset = kStringOffset + kPointerSize;
10507 static const int kSize = kNextIndexOffset + kPointerSize; 10507 static const int kSize = kNextIndexOffset + kPointerSize;
10508 10508
10509 private: 10509 private:
10510 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator); 10510 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator);
10511 }; 10511 };
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
10739 static const int kByteLengthOffset = JSObject::kHeaderSize; 10739 static const int kByteLengthOffset = JSObject::kHeaderSize;
10740 static const int kBackingStoreOffset = kByteLengthOffset + kPointerSize; 10740 static const int kBackingStoreOffset = kByteLengthOffset + kPointerSize;
10741 static const int kBitFieldSlot = kBackingStoreOffset + kPointerSize; 10741 static const int kBitFieldSlot = kBackingStoreOffset + kPointerSize;
10742 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT 10742 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT
10743 static const int kBitFieldOffset = kBitFieldSlot; 10743 static const int kBitFieldOffset = kBitFieldSlot;
10744 #else 10744 #else
10745 static const int kBitFieldOffset = kBitFieldSlot + kIntSize; 10745 static const int kBitFieldOffset = kBitFieldSlot + kIntSize;
10746 #endif 10746 #endif
10747 static const int kSize = kBitFieldSlot + kPointerSize; 10747 static const int kSize = kBitFieldSlot + kPointerSize;
10748 10748
10749 static const int kSizeWithInternalFields = 10749 static const int kSizeWithEmbedderFields =
10750 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 10750 kSize + v8::ArrayBuffer::kEmbedderFieldCount * kPointerSize;
10751 10751
10752 // Iterates all fields in the object including internal ones except 10752 // Iterates all fields in the object including internal ones except
10753 // kBackingStoreOffset and kBitFieldSlot. 10753 // kBackingStoreOffset and kBitFieldSlot.
10754 class BodyDescriptor; 10754 class BodyDescriptor;
10755 10755
10756 class IsExternal : public BitField<bool, 1, 1> {}; 10756 class IsExternal : public BitField<bool, 1, 1> {};
10757 class IsNeuterable : public BitField<bool, 2, 1> {}; 10757 class IsNeuterable : public BitField<bool, 2, 1> {};
10758 class WasNeutered : public BitField<bool, 3, 1> {}; 10758 class WasNeutered : public BitField<bool, 3, 1> {};
10759 class IsShared : public BitField<bool, 4, 1> {}; 10759 class IsShared : public BitField<bool, 4, 1> {};
10760 class HasGuardRegion : public BitField<bool, 5, 1> {}; 10760 class HasGuardRegion : public BitField<bool, 5, 1> {};
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
10818 Handle<Object> receiver, 10818 Handle<Object> receiver,
10819 const char* method_name); 10819 const char* method_name);
10820 10820
10821 // Dispatched behavior. 10821 // Dispatched behavior.
10822 DECLARE_PRINTER(JSTypedArray) 10822 DECLARE_PRINTER(JSTypedArray)
10823 DECLARE_VERIFIER(JSTypedArray) 10823 DECLARE_VERIFIER(JSTypedArray)
10824 10824
10825 static const int kLengthOffset = kViewSize + kPointerSize; 10825 static const int kLengthOffset = kViewSize + kPointerSize;
10826 static const int kSize = kLengthOffset + kPointerSize; 10826 static const int kSize = kLengthOffset + kPointerSize;
10827 10827
10828 static const int kSizeWithInternalFields = 10828 static const int kSizeWithEmbedderFields =
10829 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10829 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize;
10830 10830
10831 private: 10831 private:
10832 static Handle<JSArrayBuffer> MaterializeArrayBuffer( 10832 static Handle<JSArrayBuffer> MaterializeArrayBuffer(
10833 Handle<JSTypedArray> typed_array); 10833 Handle<JSTypedArray> typed_array);
10834 #ifdef VERIFY_HEAP 10834 #ifdef VERIFY_HEAP
10835 DECL_ACCESSORS(raw_length, Object) 10835 DECL_ACCESSORS(raw_length, Object)
10836 #endif 10836 #endif
10837 10837
10838 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 10838 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
10839 }; 10839 };
10840 10840
10841 10841
10842 class JSDataView: public JSArrayBufferView { 10842 class JSDataView: public JSArrayBufferView {
10843 public: 10843 public:
10844 DECLARE_CAST(JSDataView) 10844 DECLARE_CAST(JSDataView)
10845 10845
10846 // Dispatched behavior. 10846 // Dispatched behavior.
10847 DECLARE_PRINTER(JSDataView) 10847 DECLARE_PRINTER(JSDataView)
10848 DECLARE_VERIFIER(JSDataView) 10848 DECLARE_VERIFIER(JSDataView)
10849 10849
10850 static const int kSize = kViewSize; 10850 static const int kSize = kViewSize;
10851 10851
10852 static const int kSizeWithInternalFields = 10852 static const int kSizeWithEmbedderFields =
10853 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10853 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize;
10854 10854
10855 private: 10855 private:
10856 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); 10856 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
10857 }; 10857 };
10858 10858
10859 10859
10860 // Foreign describes objects pointing from JavaScript to C structures. 10860 // Foreign describes objects pointing from JavaScript to C structures.
10861 class Foreign: public HeapObject { 10861 class Foreign: public HeapObject {
10862 public: 10862 public:
10863 // [address]: field containing the address. 10863 // [address]: field containing the address.
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
11332 static const int kAcceptAnyReceiver = 6; 11332 static const int kAcceptAnyReceiver = 6;
11333 11333
11334 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); 11334 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
11335 }; 11335 };
11336 11336
11337 11337
11338 class ObjectTemplateInfo: public TemplateInfo { 11338 class ObjectTemplateInfo: public TemplateInfo {
11339 public: 11339 public:
11340 DECL_ACCESSORS(constructor, Object) 11340 DECL_ACCESSORS(constructor, Object)
11341 DECL_ACCESSORS(data, Object) 11341 DECL_ACCESSORS(data, Object)
11342 DECL_INT_ACCESSORS(internal_field_count) 11342 DECL_INT_ACCESSORS(embedder_field_count)
11343 DECL_BOOLEAN_ACCESSORS(immutable_proto) 11343 DECL_BOOLEAN_ACCESSORS(immutable_proto)
11344 11344
11345 DECLARE_CAST(ObjectTemplateInfo) 11345 DECLARE_CAST(ObjectTemplateInfo)
11346 11346
11347 // Dispatched behavior. 11347 // Dispatched behavior.
11348 DECLARE_PRINTER(ObjectTemplateInfo) 11348 DECLARE_PRINTER(ObjectTemplateInfo)
11349 DECLARE_VERIFIER(ObjectTemplateInfo) 11349 DECLARE_VERIFIER(ObjectTemplateInfo)
11350 11350
11351 static const int kConstructorOffset = TemplateInfo::kHeaderSize; 11351 static const int kConstructorOffset = TemplateInfo::kHeaderSize;
11352 // LSB is for immutable_proto, higher bits for internal_field_count 11352 // LSB is for immutable_proto, higher bits for embedder_field_count
11353 static const int kDataOffset = kConstructorOffset + kPointerSize; 11353 static const int kDataOffset = kConstructorOffset + kPointerSize;
11354 static const int kSize = kDataOffset + kPointerSize; 11354 static const int kSize = kDataOffset + kPointerSize;
11355 11355
11356 // Starting from given object template's constructor walk up the inheritance 11356 // Starting from given object template's constructor walk up the inheritance
11357 // chain till a function template that has an instance template is found. 11357 // chain till a function template that has an instance template is found.
11358 inline ObjectTemplateInfo* GetParent(Isolate* isolate); 11358 inline ObjectTemplateInfo* GetParent(Isolate* isolate);
11359 11359
11360 private: 11360 private:
11361 class IsImmutablePrototype : public BitField<bool, 0, 1> {}; 11361 class IsImmutablePrototype : public BitField<bool, 0, 1> {};
11362 class InternalFieldCount 11362 class EmbedderFieldCount
11363 : public BitField<int, IsImmutablePrototype::kNext, 29> {}; 11363 : public BitField<int, IsImmutablePrototype::kNext, 29> {};
11364 }; 11364 };
11365 11365
11366 11366
11367 // The DebugInfo class holds additional information for a function being 11367 // The DebugInfo class holds additional information for a function being
11368 // debugged. 11368 // debugged.
11369 class DebugInfo: public Struct { 11369 class DebugInfo: public Struct {
11370 public: 11370 public:
11371 // The shared function info for the source being debugged. 11371 // The shared function info for the source being debugged.
11372 DECL_ACCESSORS(shared, SharedFunctionInfo) 11372 DECL_ACCESSORS(shared, SharedFunctionInfo)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
11581 } 11581 }
11582 }; 11582 };
11583 11583
11584 11584
11585 } // NOLINT, false-positive due to second-order macros. 11585 } // NOLINT, false-positive due to second-order macros.
11586 } // NOLINT, false-positive due to second-order macros. 11586 } // NOLINT, false-positive due to second-order macros.
11587 11587
11588 #include "src/objects/object-macros-undef.h" 11588 #include "src/objects/object-macros-undef.h"
11589 11589
11590 #endif // V8_OBJECTS_H_ 11590 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/i18n.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698