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

Side by Side Diff: src/objects.h

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: DEPRECATE_SOON(GetInternalField) 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
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 5657 matching lines...) Expand 10 before | Expand all | Expand 10 after
8035 // by the garbage collector. 8035 // by the garbage collector.
8036 DECL_ACCESSORS(next_function_link, Object) 8036 DECL_ACCESSORS(next_function_link, Object)
8037 8037
8038 // Prints the name of the function using PrintF. 8038 // Prints the name of the function using PrintF.
8039 void PrintName(FILE* out = stdout); 8039 void PrintName(FILE* out = stdout);
8040 8040
8041 DECLARE_CAST(JSFunction) 8041 DECLARE_CAST(JSFunction)
8042 8042
8043 // Calculate the instance size and in-object properties count. 8043 // Calculate the instance size and in-object properties count.
8044 void CalculateInstanceSize(InstanceType instance_type, 8044 void CalculateInstanceSize(InstanceType instance_type,
8045 int requested_internal_fields, int* instance_size, 8045 int requested_embedder_fields, int* instance_size,
8046 int* in_object_properties); 8046 int* in_object_properties);
8047 void CalculateInstanceSizeForDerivedClass(InstanceType instance_type, 8047 void CalculateInstanceSizeForDerivedClass(InstanceType instance_type,
8048 int requested_internal_fields, 8048 int requested_embedder_fields,
8049 int* instance_size, 8049 int* instance_size,
8050 int* in_object_properties); 8050 int* in_object_properties);
8051 static void CalculateInstanceSizeHelper(InstanceType instance_type, 8051 static void CalculateInstanceSizeHelper(InstanceType instance_type,
8052 int requested_internal_fields, 8052 int requested_embedder_fields,
8053 int requested_in_object_properties, 8053 int requested_in_object_properties,
8054 int* instance_size, 8054 int* instance_size,
8055 int* in_object_properties); 8055 int* in_object_properties);
8056 // Visiting policy flags define whether the code entry or next function 8056 // Visiting policy flags define whether the code entry or next function
8057 // should be visited or not. 8057 // should be visited or not.
8058 enum BodyVisitingPolicy { 8058 enum BodyVisitingPolicy {
8059 kVisitCodeEntry = 1 << 0, 8059 kVisitCodeEntry = 1 << 0,
8060 kVisitNextFunction = 1 << 1, 8060 kVisitNextFunction = 1 << 1,
8061 8061
8062 kSkipCodeEntryAndNextFunction = 0, 8062 kSkipCodeEntryAndNextFunction = 0,
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
8129 // It is null value if this object is not used by any context. 8129 // It is null value if this object is not used by any context.
8130 DECL_ACCESSORS(native_context, Object) 8130 DECL_ACCESSORS(native_context, Object)
8131 8131
8132 // [hash]: The hash code property (undefined if not initialized yet). 8132 // [hash]: The hash code property (undefined if not initialized yet).
8133 DECL_ACCESSORS(hash, Object) 8133 DECL_ACCESSORS(hash, Object)
8134 8134
8135 DECLARE_CAST(JSGlobalProxy) 8135 DECLARE_CAST(JSGlobalProxy)
8136 8136
8137 inline bool IsDetachedFrom(JSGlobalObject* global) const; 8137 inline bool IsDetachedFrom(JSGlobalObject* global) const;
8138 8138
8139 static int SizeWithInternalFields(int internal_field_count); 8139 static int SizeWithEmbedderFields(int embedder_field_count);
8140 8140
8141 // Dispatched behavior. 8141 // Dispatched behavior.
8142 DECLARE_PRINTER(JSGlobalProxy) 8142 DECLARE_PRINTER(JSGlobalProxy)
8143 DECLARE_VERIFIER(JSGlobalProxy) 8143 DECLARE_VERIFIER(JSGlobalProxy)
8144 8144
8145 // Layout description. 8145 // Layout description.
8146 static const int kNativeContextOffset = JSObject::kHeaderSize; 8146 static const int kNativeContextOffset = JSObject::kHeaderSize;
8147 static const int kHashOffset = kNativeContextOffset + kPointerSize; 8147 static const int kHashOffset = kNativeContextOffset + kPointerSize;
8148 static const int kSize = kHashOffset + kPointerSize; 8148 static const int kSize = kHashOffset + kPointerSize;
8149 8149
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
10419 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap); 10419 DISALLOW_IMPLICIT_CONSTRUCTORS(JSMap);
10420 }; 10420 };
10421 10421
10422 class JSArrayIterator : public JSObject { 10422 class JSArrayIterator : public JSObject {
10423 public: 10423 public:
10424 DECLARE_PRINTER(JSArrayIterator) 10424 DECLARE_PRINTER(JSArrayIterator)
10425 DECLARE_VERIFIER(JSArrayIterator) 10425 DECLARE_VERIFIER(JSArrayIterator)
10426 10426
10427 DECLARE_CAST(JSArrayIterator) 10427 DECLARE_CAST(JSArrayIterator)
10428 10428
10429 // [object]: the [[IteratedObject]] internal field. 10429 // [object]: the [[IteratedObject]] inobject property.
10430 DECL_ACCESSORS(object, Object) 10430 DECL_ACCESSORS(object, Object)
10431 10431
10432 // [index]: The [[ArrayIteratorNextIndex]] internal field. 10432 // [index]: The [[ArrayIteratorNextIndex]] inobject property.
10433 DECL_ACCESSORS(index, Object) 10433 DECL_ACCESSORS(index, Object)
10434 10434
10435 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is 10435 // [map]: The Map of the [[IteratedObject]] field at the time the iterator is
10436 // allocated. 10436 // allocated.
10437 DECL_ACCESSORS(object_map, Object) 10437 DECL_ACCESSORS(object_map, Object)
10438 10438
10439 // Return the ElementsKind that a JSArrayIterator's [[IteratedObject]] is 10439 // Return the ElementsKind that a JSArrayIterator's [[IteratedObject]] is
10440 // expected to have, based on its instance type. 10440 // expected to have, based on its instance type.
10441 static ElementsKind ElementsKindForInstanceType(InstanceType instance_type); 10441 static ElementsKind ElementsKindForInstanceType(InstanceType instance_type);
10442 10442
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
10476 }; 10476 };
10477 10477
10478 class JSStringIterator : public JSObject { 10478 class JSStringIterator : public JSObject {
10479 public: 10479 public:
10480 // Dispatched behavior. 10480 // Dispatched behavior.
10481 DECLARE_PRINTER(JSStringIterator) 10481 DECLARE_PRINTER(JSStringIterator)
10482 DECLARE_VERIFIER(JSStringIterator) 10482 DECLARE_VERIFIER(JSStringIterator)
10483 10483
10484 DECLARE_CAST(JSStringIterator) 10484 DECLARE_CAST(JSStringIterator)
10485 10485
10486 // [string]: the [[IteratedString]] internal field. 10486 // [string]: the [[IteratedString]] inobject property.
10487 DECL_ACCESSORS(string, String) 10487 DECL_ACCESSORS(string, String)
10488 10488
10489 // [index]: The [[StringIteratorNextIndex]] internal field. 10489 // [index]: The [[StringIteratorNextIndex]] inobject property.
10490 inline int index() const; 10490 inline int index() const;
10491 inline void set_index(int value); 10491 inline void set_index(int value);
10492 10492
10493 static const int kStringOffset = JSObject::kHeaderSize; 10493 static const int kStringOffset = JSObject::kHeaderSize;
10494 static const int kNextIndexOffset = kStringOffset + kPointerSize; 10494 static const int kNextIndexOffset = kStringOffset + kPointerSize;
10495 static const int kSize = kNextIndexOffset + kPointerSize; 10495 static const int kSize = kNextIndexOffset + kPointerSize;
10496 10496
10497 private: 10497 private:
10498 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator); 10498 DISALLOW_IMPLICIT_CONSTRUCTORS(JSStringIterator);
10499 }; 10499 };
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
10727 static const int kByteLengthOffset = JSObject::kHeaderSize; 10727 static const int kByteLengthOffset = JSObject::kHeaderSize;
10728 static const int kBackingStoreOffset = kByteLengthOffset + kPointerSize; 10728 static const int kBackingStoreOffset = kByteLengthOffset + kPointerSize;
10729 static const int kBitFieldSlot = kBackingStoreOffset + kPointerSize; 10729 static const int kBitFieldSlot = kBackingStoreOffset + kPointerSize;
10730 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT 10730 #if V8_TARGET_LITTLE_ENDIAN || !V8_HOST_ARCH_64_BIT
10731 static const int kBitFieldOffset = kBitFieldSlot; 10731 static const int kBitFieldOffset = kBitFieldSlot;
10732 #else 10732 #else
10733 static const int kBitFieldOffset = kBitFieldSlot + kIntSize; 10733 static const int kBitFieldOffset = kBitFieldSlot + kIntSize;
10734 #endif 10734 #endif
10735 static const int kSize = kBitFieldSlot + kPointerSize; 10735 static const int kSize = kBitFieldSlot + kPointerSize;
10736 10736
10737 static const int kSizeWithInternalFields = 10737 static const int kSizeWithEmbedderFields =
10738 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 10738 kSize + v8::ArrayBuffer::kEmbedderFieldCount * kPointerSize;
10739 10739
10740 // Iterates all fields in the object including internal ones except 10740 // Iterates all fields in the object including internal ones except
10741 // kBackingStoreOffset and kBitFieldSlot. 10741 // kBackingStoreOffset and kBitFieldSlot.
10742 class BodyDescriptor; 10742 class BodyDescriptor;
10743 10743
10744 class IsExternal : public BitField<bool, 1, 1> {}; 10744 class IsExternal : public BitField<bool, 1, 1> {};
10745 class IsNeuterable : public BitField<bool, 2, 1> {}; 10745 class IsNeuterable : public BitField<bool, 2, 1> {};
10746 class WasNeutered : public BitField<bool, 3, 1> {}; 10746 class WasNeutered : public BitField<bool, 3, 1> {};
10747 class IsShared : public BitField<bool, 4, 1> {}; 10747 class IsShared : public BitField<bool, 4, 1> {};
10748 class HasGuardRegion : public BitField<bool, 5, 1> {}; 10748 class HasGuardRegion : public BitField<bool, 5, 1> {};
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
10806 Handle<Object> receiver, 10806 Handle<Object> receiver,
10807 const char* method_name); 10807 const char* method_name);
10808 10808
10809 // Dispatched behavior. 10809 // Dispatched behavior.
10810 DECLARE_PRINTER(JSTypedArray) 10810 DECLARE_PRINTER(JSTypedArray)
10811 DECLARE_VERIFIER(JSTypedArray) 10811 DECLARE_VERIFIER(JSTypedArray)
10812 10812
10813 static const int kLengthOffset = kViewSize + kPointerSize; 10813 static const int kLengthOffset = kViewSize + kPointerSize;
10814 static const int kSize = kLengthOffset + kPointerSize; 10814 static const int kSize = kLengthOffset + kPointerSize;
10815 10815
10816 static const int kSizeWithInternalFields = 10816 static const int kSizeWithEmbedderFields =
10817 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10817 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize;
10818 10818
10819 private: 10819 private:
10820 static Handle<JSArrayBuffer> MaterializeArrayBuffer( 10820 static Handle<JSArrayBuffer> MaterializeArrayBuffer(
10821 Handle<JSTypedArray> typed_array); 10821 Handle<JSTypedArray> typed_array);
10822 #ifdef VERIFY_HEAP 10822 #ifdef VERIFY_HEAP
10823 DECL_ACCESSORS(raw_length, Object) 10823 DECL_ACCESSORS(raw_length, Object)
10824 #endif 10824 #endif
10825 10825
10826 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 10826 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
10827 }; 10827 };
10828 10828
10829 10829
10830 class JSDataView: public JSArrayBufferView { 10830 class JSDataView: public JSArrayBufferView {
10831 public: 10831 public:
10832 DECLARE_CAST(JSDataView) 10832 DECLARE_CAST(JSDataView)
10833 10833
10834 // Dispatched behavior. 10834 // Dispatched behavior.
10835 DECLARE_PRINTER(JSDataView) 10835 DECLARE_PRINTER(JSDataView)
10836 DECLARE_VERIFIER(JSDataView) 10836 DECLARE_VERIFIER(JSDataView)
10837 10837
10838 static const int kSize = kViewSize; 10838 static const int kSize = kViewSize;
10839 10839
10840 static const int kSizeWithInternalFields = 10840 static const int kSizeWithEmbedderFields =
10841 kSize + v8::ArrayBufferView::kInternalFieldCount * kPointerSize; 10841 kSize + v8::ArrayBufferView::kEmbedderFieldCount * kPointerSize;
10842 10842
10843 private: 10843 private:
10844 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView); 10844 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
10845 }; 10845 };
10846 10846
10847 10847
10848 // Foreign describes objects pointing from JavaScript to C structures. 10848 // Foreign describes objects pointing from JavaScript to C structures.
10849 class Foreign: public HeapObject { 10849 class Foreign: public HeapObject {
10850 public: 10850 public:
10851 // [address]: field containing the address. 10851 // [address]: field containing the address.
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
11322 static const int kAcceptAnyReceiver = 6; 11322 static const int kAcceptAnyReceiver = 6;
11323 11323
11324 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); 11324 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo);
11325 }; 11325 };
11326 11326
11327 11327
11328 class ObjectTemplateInfo: public TemplateInfo { 11328 class ObjectTemplateInfo: public TemplateInfo {
11329 public: 11329 public:
11330 DECL_ACCESSORS(constructor, Object) 11330 DECL_ACCESSORS(constructor, Object)
11331 DECL_ACCESSORS(data, Object) 11331 DECL_ACCESSORS(data, Object)
11332 DECL_INT_ACCESSORS(internal_field_count) 11332 DECL_INT_ACCESSORS(embedder_field_count)
11333 DECL_BOOLEAN_ACCESSORS(immutable_proto) 11333 DECL_BOOLEAN_ACCESSORS(immutable_proto)
11334 11334
11335 DECLARE_CAST(ObjectTemplateInfo) 11335 DECLARE_CAST(ObjectTemplateInfo)
11336 11336
11337 // Dispatched behavior. 11337 // Dispatched behavior.
11338 DECLARE_PRINTER(ObjectTemplateInfo) 11338 DECLARE_PRINTER(ObjectTemplateInfo)
11339 DECLARE_VERIFIER(ObjectTemplateInfo) 11339 DECLARE_VERIFIER(ObjectTemplateInfo)
11340 11340
11341 static const int kConstructorOffset = TemplateInfo::kHeaderSize; 11341 static const int kConstructorOffset = TemplateInfo::kHeaderSize;
11342 // LSB is for immutable_proto, higher bits for internal_field_count 11342 // LSB is for immutable_proto, higher bits for embedder_field_count
11343 static const int kDataOffset = kConstructorOffset + kPointerSize; 11343 static const int kDataOffset = kConstructorOffset + kPointerSize;
11344 static const int kSize = kDataOffset + kPointerSize; 11344 static const int kSize = kDataOffset + kPointerSize;
11345 11345
11346 // Starting from given object template's constructor walk up the inheritance 11346 // Starting from given object template's constructor walk up the inheritance
11347 // chain till a function template that has an instance template is found. 11347 // chain till a function template that has an instance template is found.
11348 inline ObjectTemplateInfo* GetParent(Isolate* isolate); 11348 inline ObjectTemplateInfo* GetParent(Isolate* isolate);
11349 11349
11350 private: 11350 private:
11351 class IsImmutablePrototype : public BitField<bool, 0, 1> {}; 11351 class IsImmutablePrototype : public BitField<bool, 0, 1> {};
11352 class InternalFieldCount 11352 class EmbedderFieldCount
11353 : public BitField<int, IsImmutablePrototype::kNext, 29> {}; 11353 : public BitField<int, IsImmutablePrototype::kNext, 29> {};
11354 }; 11354 };
11355 11355
11356 11356
11357 // The DebugInfo class holds additional information for a function being 11357 // The DebugInfo class holds additional information for a function being
11358 // debugged. 11358 // debugged.
11359 class DebugInfo: public Struct { 11359 class DebugInfo: public Struct {
11360 public: 11360 public:
11361 // The shared function info for the source being debugged. 11361 // The shared function info for the source being debugged.
11362 DECL_ACCESSORS(shared, SharedFunctionInfo) 11362 DECL_ACCESSORS(shared, SharedFunctionInfo)
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
11571 } 11571 }
11572 }; 11572 };
11573 11573
11574 11574
11575 } // NOLINT, false-positive due to second-order macros. 11575 } // NOLINT, false-positive due to second-order macros.
11576 } // NOLINT, false-positive due to second-order macros. 11576 } // NOLINT, false-positive due to second-order macros.
11577 11577
11578 #include "src/objects/object-macros-undef.h" 11578 #include "src/objects/object-macros-undef.h"
11579 11579
11580 #endif // V8_OBJECTS_H_ 11580 #endif // V8_OBJECTS_H_
OLDNEW
« include/v8-experimental.h ('K') | « src/i18n.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698