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

Side by Side Diff: src/objects.h

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: [rename] Rename internal field to embedder field. 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 5672 matching lines...) Expand 10 before | Expand all | Expand 10 after
8050 // by the garbage collector. 8050 // by the garbage collector.
8051 DECL_ACCESSORS(next_function_link, Object) 8051 DECL_ACCESSORS(next_function_link, Object)
8052 8052
8053 // Prints the name of the function using PrintF. 8053 // Prints the name of the function using PrintF.
8054 void PrintName(FILE* out = stdout); 8054 void PrintName(FILE* out = stdout);
8055 8055
8056 DECLARE_CAST(JSFunction) 8056 DECLARE_CAST(JSFunction)
8057 8057
8058 // Calculate the instance size and in-object properties count. 8058 // Calculate the instance size and in-object properties count.
8059 void CalculateInstanceSize(InstanceType instance_type, 8059 void CalculateInstanceSize(InstanceType instance_type,
8060 int requested_internal_fields, int* instance_size, 8060 int requested_embedder_fields, int* instance_size,
8061 int* in_object_properties); 8061 int* in_object_properties);
8062 void CalculateInstanceSizeForDerivedClass(InstanceType instance_type, 8062 void CalculateInstanceSizeForDerivedClass(InstanceType instance_type,
8063 int requested_internal_fields, 8063 int requested_embedder_fields,
8064 int* instance_size, 8064 int* instance_size,
8065 int* in_object_properties); 8065 int* in_object_properties);
8066 static void CalculateInstanceSizeHelper(InstanceType instance_type, 8066 static void CalculateInstanceSizeHelper(InstanceType instance_type,
8067 int requested_internal_fields, 8067 int requested_embedder_fields,
8068 int requested_in_object_properties, 8068 int requested_in_object_properties,
8069 int* instance_size, 8069 int* instance_size,
8070 int* in_object_properties); 8070 int* in_object_properties);
8071 // Visiting policy flags define whether the code entry or next function 8071 // Visiting policy flags define whether the code entry or next function
8072 // should be visited or not. 8072 // should be visited or not.
8073 enum BodyVisitingPolicy { 8073 enum BodyVisitingPolicy {
8074 kVisitCodeEntry = 1 << 0, 8074 kVisitCodeEntry = 1 << 0,
8075 kVisitNextFunction = 1 << 1, 8075 kVisitNextFunction = 1 << 1,
8076 8076
8077 kSkipCodeEntryAndNextFunction = 0, 8077 kSkipCodeEntryAndNextFunction = 0,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
8144 // It is null value if this object is not used by any context. 8144 // It is null value if this object is not used by any context.
8145 DECL_ACCESSORS(native_context, Object) 8145 DECL_ACCESSORS(native_context, Object)
8146 8146
8147 // [hash]: The hash code property (undefined if not initialized yet). 8147 // [hash]: The hash code property (undefined if not initialized yet).
8148 DECL_ACCESSORS(hash, Object) 8148 DECL_ACCESSORS(hash, Object)
8149 8149
8150 DECLARE_CAST(JSGlobalProxy) 8150 DECLARE_CAST(JSGlobalProxy)
8151 8151
8152 inline bool IsDetachedFrom(JSGlobalObject* global) const; 8152 inline bool IsDetachedFrom(JSGlobalObject* global) const;
8153 8153
8154 static int SizeWithInternalFields(int internal_field_count); 8154 static int SizeWithEmbedderFields(int embedder_field_count);
8155 8155
8156 // Dispatched behavior. 8156 // Dispatched behavior.
8157 DECLARE_PRINTER(JSGlobalProxy) 8157 DECLARE_PRINTER(JSGlobalProxy)
8158 DECLARE_VERIFIER(JSGlobalProxy) 8158 DECLARE_VERIFIER(JSGlobalProxy)
8159 8159
8160 // Layout description. 8160 // Layout description.
8161 static const int kNativeContextOffset = JSObject::kHeaderSize; 8161 static const int kNativeContextOffset = JSObject::kHeaderSize;
8162 static const int kHashOffset = kNativeContextOffset + kPointerSize; 8162 static const int kHashOffset = kNativeContextOffset + kPointerSize;
8163 static const int kSize = kHashOffset + kPointerSize; 8163 static const int kSize = kHashOffset + kPointerSize;
8164 8164
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
10424 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap); 10424 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
10425 }; 10425 };
10426 10426
10427 class JSArrayIterator : public JSObject { 10427 class JSArrayIterator : public JSObject {
10428 public: 10428 public:
10429 DECLARE_PRINTER(JSArrayIterator) 10429 DECLARE_PRINTER(JSArrayIterator)
10430 DECLARE_VERIFIER(JSArrayIterator) 10430 DECLARE_VERIFIER(JSArrayIterator)
10431 10431
10432 DECLARE_CAST(JSArrayIterator) 10432 DECLARE_CAST(JSArrayIterator)
10433 10433
10434 // [object]: the [[IteratedObject]] internal field. 10434 // [object]: the [[IteratedObject]] inobject property.
10435 DECL_ACCESSORS(object, Object) 10435 DECL_ACCESSORS(object, Object)
10436 10436
10437 // [index]: The [[ArrayIteratorNextIndex]] internal field. 10437 // [index]: The [[ArrayIteratorNextIndex]] inobject property.
10438 DECL_ACCESSORS(index, Object) 10438 DECL_ACCESSORS(index, Object)
10439 10439
10440 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is 10440 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is
10441 // allocated. 10441 // allocated.
10442 DECL_ACCESSORS(object_map, Object) 10442 DECL_ACCESSORS(object_map, Object)
10443 10443
10444 // Return the ElementsKind that a JSArrayIterator's [[IteratedObject]] is 10444 // Return the ElementsKind that a JSArrayIterator's [[IteratedObject]] is
10445 // expected to have, based on its instance type. 10445 // expected to have, based on its instance type.
10446 static ElementsKind ElementsKindForInstanceType(InstanceType instance_type); 10446 static ElementsKind ElementsKindForInstanceType(InstanceType instance_type);
10447 10447
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
10481 }; 10481 };
10482 10482
10483 class JSStringIterator : public JSObject { 10483 class JSStringIterator : public JSObject {
10484 public: 10484 public:
10485 // Dispatched behavior. 10485 // Dispatched behavior.
10486 DECLARE_PRINTER(JSStringIterator) 10486 DECLARE_PRINTER(JSStringIterator)
10487 DECLARE_VERIFIER(JSStringIterator) 10487 DECLARE_VERIFIER(JSStringIterator)
10488 10488
10489 DECLARE_CAST(JSStringIterator) 10489 DECLARE_CAST(JSStringIterator)
10490 10490
10491 // [string]: the [[IteratedString]] internal field. 10491 // [string]: the [[IteratedString]] inobject property.
10492 DECL_ACCESSORS(string, String) 10492 DECL_ACCESSORS(string, String)
10493 10493
10494 // [index]: The [[StringIteratorNextIndex]] internal field. 10494 // [index]: The [[StringIteratorNextIndex]] inobject property.
10495 inline int index() const; 10495 inline int index() const;
10496 inline void set_index(int value); 10496 inline void set_index(int value);
10497 10497
10498 static const int kStringOffset = JSObject::kHeaderSize; 10498 static const int kStringOffset = JSObject::kHeaderSize;
10499 static const int kNextIndexOffset = kStringOffset + kPointerSize; 10499 static const int kNextIndexOffset = kStringOffset + kPointerSize;
10500 static const int kSize = kNextIndexOffset + kPointerSize; 10500 static const int kSize = kNextIndexOffset + kPointerSize;
10501 10501
10502 private: 10502 private:
10503 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator); 10503 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator);
10504 }; 10504 };
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
10732 static const int kByteLengthOffset = JSObject::kHeaderSize; 10732 static const int kByteLengthOffset = JSObject::kHeaderSize;
10733 static const int kBackingStoreOffset = kByteLengthOffset + kPointerSize; 10733 static const int kBackingStoreOffset = kByteLengthOffset + kPointerSize;
10734 static const int kBitFieldSlot = kBackingStoreOffset + kPointerSize; 10734 static const int kBitFieldSlot = kBackingStoreOffset + kPointerSize;
10735 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT 10735 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT
10736 static const int kBitFieldOffset = kBitFieldSlot; 10736 static const int kBitFieldOffset = kBitFieldSlot;
10737 #else 10737 #else
10738 static const int kBitFieldOffset = kBitFieldSlot + kIntSize; 10738 static const int kBitFieldOffset = kBitFieldSlot + kIntSize;
10739 #endif 10739 #endif
10740 static const int kSize = kBitFieldSlot + kPointerSize; 10740 static const int kSize = kBitFieldSlot + kPointerSize;
10741 10741
10742 static const int kSizeWithInternalFields = 10742 static const int kSizeWithEmbedderFields =
10743 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 10743 kSize + v8::ArrayBuffer::kEmbedderFieldCount * kPointerSize;
10744 10744
10745 // Iterates all fields in the object including internal ones except 10745 // Iterates all fields in the object including internal ones except
10746 // kBackingStoreOffset and kBitFieldSlot. 10746 // kBackingStoreOffset and kBitFieldSlot.
10747 class BodyDescriptor; 10747 class BodyDescriptor;
10748 10748
10749 class IsExternal : public BitField<bool, 1, 1> {}; 10749 class IsExternal : public BitField<bool, 1, 1> {};
10750 class IsNeuterable : public BitField<bool, 2, 1> {}; 10750 class IsNeuterable : public BitField<bool, 2, 1> {};
10751 class WasNeutered : public BitField<bool, 3, 1> {}; 10751 class WasNeutered : public BitField<bool, 3, 1> {};
10752 class IsShared : public BitField<bool, 4, 1> {}; 10752 class IsShared : public BitField<bool, 4, 1> {};
10753 class HasGuardRegion : public BitField<bool, 5, 1> {}; 10753 class HasGuardRegion : public BitField<bool, 5, 1> {};
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
10811 Handle<Object> receiver, 10811 Handle<Object> receiver,
10812 const char* method_name); 10812 const char* method_name);
10813 10813
10814 // Dispatched behavior. 10814 // Dispatched behavior.
10815 DECLARE_PRINTER(JSTypedArray) 10815 DECLARE_PRINTER(JSTypedArray)
10816 DECLARE_VERIFIER(JSTypedArray) 10816 DECLARE_VERIFIER(JSTypedArray)
10817 10817
10818 static const int kLengthOffset = kViewSize + kPointerSize; 10818 static const int kLengthOffset = kViewSize + kPointerSize;
10819 static const int kSize = kLengthOffset + kPointerSize; 10819 static const int kSize = kLengthOffset + kPointerSize;
10820 10820
10821 static const int kSizeWithInternalFields = 10821 static const int kSizeWithEmbedderFields =
10822 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10822 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize;
10823 10823
10824 private: 10824 private:
10825 static Handle<JSArrayBuffer> MaterializeArrayBuffer( 10825 static Handle<JSArrayBuffer> MaterializeArrayBuffer(
10826 Handle<JSTypedArray> typed_array); 10826 Handle<JSTypedArray> typed_array);
10827 #ifdef VERIFY_HEAP 10827 #ifdef VERIFY_HEAP
10828 DECL_ACCESSORS(raw_length, Object) 10828 DECL_ACCESSORS(raw_length, Object)
10829 #endif 10829 #endif
10830 10830
10831 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 10831 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
10832 }; 10832 };
10833 10833
10834 10834
10835 class JSDataView: public JSArrayBufferView { 10835 class JSDataView: public JSArrayBufferView {
10836 public: 10836 public:
10837 DECLARE_CAST(JSDataView) 10837 DECLARE_CAST(JSDataView)
10838 10838
10839 // Dispatched behavior. 10839 // Dispatched behavior.
10840 DECLARE_PRINTER(JSDataView) 10840 DECLARE_PRINTER(JSDataView)
10841 DECLARE_VERIFIER(JSDataView) 10841 DECLARE_VERIFIER(JSDataView)
10842 10842
10843 static const int kSize = kViewSize; 10843 static const int kSize = kViewSize;
10844 10844
10845 static const int kSizeWithInternalFields = 10845 static const int kSizeWithEmbedderFields =
10846 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10846 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize;
10847 10847
10848 private: 10848 private:
10849 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); 10849 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
10850 }; 10850 };
10851 10851
10852 10852
10853 // Foreign describes objects pointing from JavaScript to C structures. 10853 // Foreign describes objects pointing from JavaScript to C structures.
10854 class Foreign: public HeapObject { 10854 class Foreign: public HeapObject {
10855 public: 10855 public:
10856 // [address]: field containing the address. 10856 // [address]: field containing the address.
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
11325 static const int kAcceptAnyReceiver = 6; 11325 static const int kAcceptAnyReceiver = 6;
11326 11326
11327 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); 11327 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
11328 }; 11328 };
11329 11329
11330 11330
11331 class ObjectTemplateInfo: public TemplateInfo { 11331 class ObjectTemplateInfo: public TemplateInfo {
11332 public: 11332 public:
11333 DECL_ACCESSORS(constructor, Object) 11333 DECL_ACCESSORS(constructor, Object)
11334 DECL_ACCESSORS(data, Object) 11334 DECL_ACCESSORS(data, Object)
11335 DECL_INT_ACCESSORS(internal_field_count) 11335 DECL_INT_ACCESSORS(embedder_field_count)
11336 DECL_BOOLEAN_ACCESSORS(immutable_proto) 11336 DECL_BOOLEAN_ACCESSORS(immutable_proto)
11337 11337
11338 DECLARE_CAST(ObjectTemplateInfo) 11338 DECLARE_CAST(ObjectTemplateInfo)
11339 11339
11340 // Dispatched behavior. 11340 // Dispatched behavior.
11341 DECLARE_PRINTER(ObjectTemplateInfo) 11341 DECLARE_PRINTER(ObjectTemplateInfo)
11342 DECLARE_VERIFIER(ObjectTemplateInfo) 11342 DECLARE_VERIFIER(ObjectTemplateInfo)
11343 11343
11344 static const int kConstructorOffset = TemplateInfo::kHeaderSize; 11344 static const int kConstructorOffset = TemplateInfo::kHeaderSize;
11345 // LSB is for immutable_proto, higher bits for internal_field_count 11345 // LSB is for immutable_proto, higher bits for embedder_field_count
11346 static const int kDataOffset = kConstructorOffset + kPointerSize; 11346 static const int kDataOffset = kConstructorOffset + kPointerSize;
11347 static const int kSize = kDataOffset + kPointerSize; 11347 static const int kSize = kDataOffset + kPointerSize;
11348 11348
11349 // Starting from given object template's constructor walk up the inheritance 11349 // Starting from given object template's constructor walk up the inheritance
11350 // chain till a function template that has an instance template is found. 11350 // chain till a function template that has an instance template is found.
11351 inline ObjectTemplateInfo* GetParent(Isolate* isolate); 11351 inline ObjectTemplateInfo* GetParent(Isolate* isolate);
11352 11352
11353 private: 11353 private:
11354 class IsImmutablePrototype : public BitField<bool, 0, 1> {}; 11354 class IsImmutablePrototype : public BitField<bool, 0, 1> {};
11355 class InternalFieldCount 11355 class EmbedderFieldCount
11356 : public BitField<int, IsImmutablePrototype::kNext, 29> {}; 11356 : public BitField<int, IsImmutablePrototype::kNext, 29> {};
11357 }; 11357 };
11358 11358
11359 11359
11360 // The DebugInfo class holds additional information for a function being 11360 // The DebugInfo class holds additional information for a function being
11361 // debugged. 11361 // debugged.
11362 class DebugInfo: public Struct { 11362 class DebugInfo: public Struct {
11363 public: 11363 public:
11364 // The shared function info for the source being debugged. 11364 // The shared function info for the source being debugged.
11365 DECL_ACCESSORS(shared, SharedFunctionInfo) 11365 DECL_ACCESSORS(shared, SharedFunctionInfo)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
11574 } 11574 }
11575 }; 11575 };
11576 11576
11577 11577
11578 } // NOLINT, false-positive due to second-order macros. 11578 } // NOLINT, false-positive due to second-order macros.
11579 } // NOLINT, false-positive due to second-order macros. 11579 } // NOLINT, false-positive due to second-order macros.
11580 11580
11581 #include "src/objects/object-macros-undef.h" 11581 #include "src/objects/object-macros-undef.h"
11582 11582
11583 #endif // V8_OBJECTS_H_ 11583 #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