| OLD | NEW |
| 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 | 9 |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // - Object | 44 // - Object |
| 45 // - Smi (immediate small integer) | 45 // - Smi (immediate small integer) |
| 46 // - HeapObject (superclass for everything allocated in the heap) | 46 // - HeapObject (superclass for everything allocated in the heap) |
| 47 // - JSReceiver (suitable for property access) | 47 // - JSReceiver (suitable for property access) |
| 48 // - JSObject | 48 // - JSObject |
| 49 // - JSArray | 49 // - JSArray |
| 50 // - JSArrayBuffer | 50 // - JSArrayBuffer |
| 51 // - JSArrayBufferView | 51 // - JSArrayBufferView |
| 52 // - JSTypedArray | 52 // - JSTypedArray |
| 53 // - JSDataView | 53 // - JSDataView |
| 54 // - JSBoundFunction | |
| 55 // - JSCollection | 54 // - JSCollection |
| 56 // - JSSet | 55 // - JSSet |
| 57 // - JSMap | 56 // - JSMap |
| 58 // - JSSetIterator | 57 // - JSSetIterator |
| 59 // - JSMapIterator | 58 // - JSMapIterator |
| 60 // - JSWeakCollection | 59 // - JSWeakCollection |
| 61 // - JSWeakMap | 60 // - JSWeakMap |
| 62 // - JSWeakSet | 61 // - JSWeakSet |
| 63 // - JSRegExp | 62 // - JSRegExp |
| 64 // - JSFunction | 63 // - JSFunction |
| 65 // - JSGeneratorObject | 64 // - JSGeneratorObject |
| 66 // - JSModule | 65 // - JSModule |
| 67 // - JSGlobalObject | 66 // - JSGlobalObject |
| 68 // - JSGlobalProxy | 67 // - JSGlobalProxy |
| 69 // - JSValue | 68 // - JSValue |
| 70 // - JSDate | 69 // - JSDate |
| 71 // - JSMessageObject | 70 // - JSMessageObject |
| 72 // - JSProxy | 71 // - JSProxy |
| 73 // - FixedArrayBase | 72 // - FixedArrayBase |
| 74 // - ByteArray | 73 // - ByteArray |
| 75 // - BytecodeArray | 74 // - BytecodeArray |
| 76 // - FixedArray | 75 // - FixedArray |
| 77 // - DescriptorArray | 76 // - DescriptorArray |
| 78 // - LiteralsArray | 77 // - LiteralsArray |
| 78 // - BindingsArray |
| 79 // - HashTable | 79 // - HashTable |
| 80 // - Dictionary | 80 // - Dictionary |
| 81 // - StringTable | 81 // - StringTable |
| 82 // - CompilationCacheTable | 82 // - CompilationCacheTable |
| 83 // - CodeCacheHashTable | 83 // - CodeCacheHashTable |
| 84 // - MapCache | 84 // - MapCache |
| 85 // - OrderedHashTable | 85 // - OrderedHashTable |
| 86 // - OrderedHashSet | 86 // - OrderedHashSet |
| 87 // - OrderedHashMap | 87 // - OrderedHashMap |
| 88 // - Context | 88 // - Context |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 V(JS_SET_TYPE) \ | 430 V(JS_SET_TYPE) \ |
| 431 V(JS_MAP_TYPE) \ | 431 V(JS_MAP_TYPE) \ |
| 432 V(JS_SET_ITERATOR_TYPE) \ | 432 V(JS_SET_ITERATOR_TYPE) \ |
| 433 V(JS_MAP_ITERATOR_TYPE) \ | 433 V(JS_MAP_ITERATOR_TYPE) \ |
| 434 V(JS_ITERATOR_RESULT_TYPE) \ | 434 V(JS_ITERATOR_RESULT_TYPE) \ |
| 435 V(JS_WEAK_MAP_TYPE) \ | 435 V(JS_WEAK_MAP_TYPE) \ |
| 436 V(JS_WEAK_SET_TYPE) \ | 436 V(JS_WEAK_SET_TYPE) \ |
| 437 V(JS_PROMISE_TYPE) \ | 437 V(JS_PROMISE_TYPE) \ |
| 438 V(JS_REGEXP_TYPE) \ | 438 V(JS_REGEXP_TYPE) \ |
| 439 \ | 439 \ |
| 440 V(JS_BOUND_FUNCTION_TYPE) \ | |
| 441 V(JS_FUNCTION_TYPE) \ | 440 V(JS_FUNCTION_TYPE) \ |
| 442 V(DEBUG_INFO_TYPE) \ | 441 V(DEBUG_INFO_TYPE) \ |
| 443 V(BREAK_POINT_INFO_TYPE) | 442 V(BREAK_POINT_INFO_TYPE) |
| 444 | 443 |
| 445 | 444 |
| 446 // Since string types are not consecutive, this macro is used to | 445 // Since string types are not consecutive, this macro is used to |
| 447 // iterate over them. | 446 // iterate over them. |
| 448 #define STRING_TYPE_LIST(V) \ | 447 #define STRING_TYPE_LIST(V) \ |
| 449 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ | 448 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ |
| 450 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ | 449 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 JS_DATA_VIEW_TYPE, | 725 JS_DATA_VIEW_TYPE, |
| 727 JS_SET_TYPE, | 726 JS_SET_TYPE, |
| 728 JS_MAP_TYPE, | 727 JS_MAP_TYPE, |
| 729 JS_SET_ITERATOR_TYPE, | 728 JS_SET_ITERATOR_TYPE, |
| 730 JS_MAP_ITERATOR_TYPE, | 729 JS_MAP_ITERATOR_TYPE, |
| 731 JS_ITERATOR_RESULT_TYPE, | 730 JS_ITERATOR_RESULT_TYPE, |
| 732 JS_WEAK_MAP_TYPE, | 731 JS_WEAK_MAP_TYPE, |
| 733 JS_WEAK_SET_TYPE, | 732 JS_WEAK_SET_TYPE, |
| 734 JS_PROMISE_TYPE, | 733 JS_PROMISE_TYPE, |
| 735 JS_REGEXP_TYPE, | 734 JS_REGEXP_TYPE, |
| 736 JS_BOUND_FUNCTION_TYPE, | |
| 737 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE | 735 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE |
| 738 | 736 |
| 739 // Pseudo-types | 737 // Pseudo-types |
| 740 FIRST_TYPE = 0x0, | 738 FIRST_TYPE = 0x0, |
| 741 LAST_TYPE = JS_FUNCTION_TYPE, | 739 LAST_TYPE = JS_FUNCTION_TYPE, |
| 742 FIRST_NAME_TYPE = FIRST_TYPE, | 740 FIRST_NAME_TYPE = FIRST_TYPE, |
| 743 LAST_NAME_TYPE = SYMBOL_TYPE, | 741 LAST_NAME_TYPE = SYMBOL_TYPE, |
| 744 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, | 742 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, |
| 745 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, | 743 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, |
| 746 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, | 744 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, |
| 747 FIRST_PRIMITIVE_TYPE = FIRST_NAME_TYPE, | 745 FIRST_PRIMITIVE_TYPE = FIRST_NAME_TYPE, |
| 748 LAST_PRIMITIVE_TYPE = ODDBALL_TYPE, | 746 LAST_PRIMITIVE_TYPE = ODDBALL_TYPE, |
| 749 FIRST_FUNCTION_TYPE = JS_BOUND_FUNCTION_TYPE, | |
| 750 LAST_FUNCTION_TYPE = JS_FUNCTION_TYPE, | |
| 751 // Boundaries for testing for a fixed typed array. | 747 // Boundaries for testing for a fixed typed array. |
| 752 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, | 748 FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE, |
| 753 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, | 749 LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_UINT8_CLAMPED_ARRAY_TYPE, |
| 754 // Boundary for promotion to old space. | 750 // Boundary for promotion to old space. |
| 755 LAST_DATA_TYPE = FILLER_TYPE, | 751 LAST_DATA_TYPE = FILLER_TYPE, |
| 756 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). | 752 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). |
| 757 // Note that there is no range for JSObject or JSProxy, since their subtypes | 753 // Note that there is no range for JSObject or JSProxy, since their subtypes |
| 758 // are not continuous in this enum! The enum ranges instead reflect the | 754 // are not continuous in this enum! The enum ranges instead reflect the |
| 759 // external class names, where proxies are treated as either ordinary objects, | 755 // external class names, where proxies are treated as either ordinary objects, |
| 760 // or functions. | 756 // or functions. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 V(BytecodeArray) \ | 923 V(BytecodeArray) \ |
| 928 V(FreeSpace) \ | 924 V(FreeSpace) \ |
| 929 V(JSReceiver) \ | 925 V(JSReceiver) \ |
| 930 V(JSObject) \ | 926 V(JSObject) \ |
| 931 V(JSContextExtensionObject) \ | 927 V(JSContextExtensionObject) \ |
| 932 V(JSGeneratorObject) \ | 928 V(JSGeneratorObject) \ |
| 933 V(JSModule) \ | 929 V(JSModule) \ |
| 934 V(LayoutDescriptor) \ | 930 V(LayoutDescriptor) \ |
| 935 V(Map) \ | 931 V(Map) \ |
| 936 V(DescriptorArray) \ | 932 V(DescriptorArray) \ |
| 933 V(BindingsArray) \ |
| 937 V(TransitionArray) \ | 934 V(TransitionArray) \ |
| 938 V(LiteralsArray) \ | 935 V(LiteralsArray) \ |
| 939 V(TypeFeedbackMetadata) \ | 936 V(TypeFeedbackMetadata) \ |
| 940 V(TypeFeedbackVector) \ | 937 V(TypeFeedbackVector) \ |
| 941 V(DeoptimizationInputData) \ | 938 V(DeoptimizationInputData) \ |
| 942 V(DeoptimizationOutputData) \ | 939 V(DeoptimizationOutputData) \ |
| 943 V(DependentCode) \ | 940 V(DependentCode) \ |
| 944 V(HandlerTable) \ | 941 V(HandlerTable) \ |
| 945 V(FixedArray) \ | 942 V(FixedArray) \ |
| 946 V(FixedDoubleArray) \ | 943 V(FixedDoubleArray) \ |
| 947 V(WeakFixedArray) \ | 944 V(WeakFixedArray) \ |
| 948 V(ArrayList) \ | 945 V(ArrayList) \ |
| 949 V(Context) \ | 946 V(Context) \ |
| 950 V(ScriptContextTable) \ | 947 V(ScriptContextTable) \ |
| 951 V(NativeContext) \ | 948 V(NativeContext) \ |
| 952 V(ScopeInfo) \ | 949 V(ScopeInfo) \ |
| 953 V(JSBoundFunction) \ | |
| 954 V(JSFunction) \ | 950 V(JSFunction) \ |
| 955 V(Code) \ | 951 V(Code) \ |
| 956 V(Oddball) \ | 952 V(Oddball) \ |
| 957 V(SharedFunctionInfo) \ | 953 V(SharedFunctionInfo) \ |
| 958 V(JSValue) \ | 954 V(JSValue) \ |
| 959 V(JSDate) \ | 955 V(JSDate) \ |
| 960 V(JSMessageObject) \ | 956 V(JSMessageObject) \ |
| 961 V(StringWrapper) \ | 957 V(StringWrapper) \ |
| 962 V(Foreign) \ | 958 V(Foreign) \ |
| 963 V(Boolean) \ | 959 V(Boolean) \ |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 | 1043 |
| 1048 INLINE(bool IsStruct() const); | 1044 INLINE(bool IsStruct() const); |
| 1049 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ | 1045 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) \ |
| 1050 INLINE(bool Is##Name() const); | 1046 INLINE(bool Is##Name() const); |
| 1051 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) | 1047 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) |
| 1052 #undef DECLARE_STRUCT_PREDICATE | 1048 #undef DECLARE_STRUCT_PREDICATE |
| 1053 | 1049 |
| 1054 // ES6, section 7.2.2 IsArray. NOT to be confused with %_IsArray. | 1050 // ES6, section 7.2.2 IsArray. NOT to be confused with %_IsArray. |
| 1055 MUST_USE_RESULT static Maybe<bool> IsArray(Handle<Object> object); | 1051 MUST_USE_RESULT static Maybe<bool> IsArray(Handle<Object> object); |
| 1056 | 1052 |
| 1057 // Test for JSBoundFunction or JSFunction. | |
| 1058 INLINE(bool IsFunction() const); | |
| 1059 | |
| 1060 // ES6, section 7.2.3 IsCallable. | 1053 // ES6, section 7.2.3 IsCallable. |
| 1061 INLINE(bool IsCallable() const); | 1054 INLINE(bool IsCallable() const); |
| 1062 | 1055 |
| 1063 // ES6, section 7.2.4 IsConstructor. | 1056 // ES6, section 7.2.4 IsConstructor. |
| 1064 INLINE(bool IsConstructor() const); | 1057 INLINE(bool IsConstructor() const); |
| 1065 | 1058 |
| 1066 INLINE(bool IsTemplateInfo()) const; | 1059 INLINE(bool IsTemplateInfo()) const; |
| 1067 INLINE(bool IsNameDictionary() const); | 1060 INLINE(bool IsNameDictionary() const); |
| 1068 INLINE(bool IsGlobalDictionary() const); | 1061 INLINE(bool IsGlobalDictionary() const); |
| 1069 INLINE(bool IsSeededNumberDictionary() const); | 1062 INLINE(bool IsSeededNumberDictionary() const); |
| (...skipping 3594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4664 DECLARE_CAST(LiteralsArray) | 4657 DECLARE_CAST(LiteralsArray) |
| 4665 | 4658 |
| 4666 private: | 4659 private: |
| 4667 inline Object* get(int index) const; | 4660 inline Object* get(int index) const; |
| 4668 inline void set(int index, Object* value); | 4661 inline void set(int index, Object* value); |
| 4669 inline void set(int index, Smi* value); | 4662 inline void set(int index, Smi* value); |
| 4670 inline void set(int index, Object* value, WriteBarrierMode mode); | 4663 inline void set(int index, Object* value, WriteBarrierMode mode); |
| 4671 }; | 4664 }; |
| 4672 | 4665 |
| 4673 | 4666 |
| 4667 // A bindings array contains the bindings for a bound function. It also holds |
| 4668 // the type feedback vector. |
| 4669 class BindingsArray : public FixedArray { |
| 4670 public: |
| 4671 inline TypeFeedbackVector* feedback_vector() const; |
| 4672 inline void set_feedback_vector(TypeFeedbackVector* vector); |
| 4673 |
| 4674 inline JSReceiver* bound_function() const; |
| 4675 inline void set_bound_function(JSReceiver* function); |
| 4676 inline Object* bound_this() const; |
| 4677 inline void set_bound_this(Object* bound_this); |
| 4678 |
| 4679 inline Object* binding(int binding_index) const; |
| 4680 inline void set_binding(int binding_index, Object* binding); |
| 4681 inline int bindings_count() const; |
| 4682 |
| 4683 static Handle<BindingsArray> New(Isolate* isolate, |
| 4684 Handle<TypeFeedbackVector> vector, |
| 4685 Handle<JSReceiver> bound_function, |
| 4686 Handle<Object> bound_this, |
| 4687 int number_of_bindings); |
| 4688 |
| 4689 static Handle<JSArray> CreateBoundArguments(Handle<BindingsArray> bindings); |
| 4690 static Handle<JSArray> CreateRuntimeBindings(Handle<BindingsArray> bindings); |
| 4691 |
| 4692 DECLARE_CAST(BindingsArray) |
| 4693 |
| 4694 private: |
| 4695 static const int kVectorIndex = 0; |
| 4696 static const int kBoundFunctionIndex = 1; |
| 4697 static const int kBoundThisIndex = 2; |
| 4698 static const int kFirstBindingIndex = 3; |
| 4699 |
| 4700 inline Object* get(int index) const; |
| 4701 inline void set(int index, Object* value); |
| 4702 inline void set(int index, Smi* value); |
| 4703 inline void set(int index, Object* value, WriteBarrierMode mode); |
| 4704 |
| 4705 inline int length() const; |
| 4706 }; |
| 4707 |
| 4708 |
| 4674 // HandlerTable is a fixed array containing entries for exception handlers in | 4709 // HandlerTable is a fixed array containing entries for exception handlers in |
| 4675 // the code object it is associated with. The tables comes in two flavors: | 4710 // the code object it is associated with. The tables comes in two flavors: |
| 4676 // 1) Based on ranges: Used for unoptimized code. Contains one entry per | 4711 // 1) Based on ranges: Used for unoptimized code. Contains one entry per |
| 4677 // exception handler and a range representing the try-block covered by that | 4712 // exception handler and a range representing the try-block covered by that |
| 4678 // handler. Layout looks as follows: | 4713 // handler. Layout looks as follows: |
| 4679 // [ range-start , range-end , handler-offset , stack-depth ] | 4714 // [ range-start , range-end , handler-offset , stack-depth ] |
| 4680 // 2) Based on return addresses: Used for turbofanned code. Contains one entry | 4715 // 2) Based on return addresses: Used for turbofanned code. Contains one entry |
| 4681 // per call-site that could throw an exception. Layout looks as follows: | 4716 // per call-site that could throw an exception. Layout looks as follows: |
| 4682 // [ return-address-offset , handler-offset ] | 4717 // [ return-address-offset , handler-offset ] |
| 4683 class HandlerTable : public FixedArray { | 4718 class HandlerTable : public FixedArray { |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5522 // Tells whether the object in the prototype property will be used | 5557 // Tells whether the object in the prototype property will be used |
| 5523 // for instances created from this function. If the prototype | 5558 // for instances created from this function. If the prototype |
| 5524 // property is set to a value that is not a JSObject, the prototype | 5559 // property is set to a value that is not a JSObject, the prototype |
| 5525 // property will not be used to create instances of the function. | 5560 // property will not be used to create instances of the function. |
| 5526 // See ECMA-262, 13.2.2. | 5561 // See ECMA-262, 13.2.2. |
| 5527 inline void set_non_instance_prototype(bool value); | 5562 inline void set_non_instance_prototype(bool value); |
| 5528 inline bool has_non_instance_prototype(); | 5563 inline bool has_non_instance_prototype(); |
| 5529 | 5564 |
| 5530 // Tells whether the instance has a [[Construct]] internal method. | 5565 // Tells whether the instance has a [[Construct]] internal method. |
| 5531 // This property is implemented according to ES6, section 7.2.4. | 5566 // This property is implemented according to ES6, section 7.2.4. |
| 5532 inline void set_is_constructor(); | 5567 inline void set_is_constructor(bool value); |
| 5533 inline bool is_constructor() const; | 5568 inline bool is_constructor() const; |
| 5534 | 5569 |
| 5535 // Tells whether the instance with this map should be ignored by the | 5570 // Tells whether the instance with this map should be ignored by the |
| 5536 // Object.getPrototypeOf() function and the __proto__ accessor. | 5571 // Object.getPrototypeOf() function and the __proto__ accessor. |
| 5537 inline void set_is_hidden_prototype(); | 5572 inline void set_is_hidden_prototype(); |
| 5538 inline bool is_hidden_prototype() const; | 5573 inline bool is_hidden_prototype() const; |
| 5539 | 5574 |
| 5540 // Records and queries whether the instance has a named interceptor. | 5575 // Records and queries whether the instance has a named interceptor. |
| 5541 inline void set_has_named_interceptor(); | 5576 inline void set_has_named_interceptor(); |
| 5542 inline bool has_named_interceptor(); | 5577 inline bool has_named_interceptor(); |
| (...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6697 | 6732 |
| 6698 // Indicate that this function should always be inlined in optimized code. | 6733 // Indicate that this function should always be inlined in optimized code. |
| 6699 DECL_BOOLEAN_ACCESSORS(force_inline) | 6734 DECL_BOOLEAN_ACCESSORS(force_inline) |
| 6700 | 6735 |
| 6701 // Indicates that the function was created by the Function function. | 6736 // Indicates that the function was created by the Function function. |
| 6702 // Though it's anonymous, toString should treat it as if it had the name | 6737 // Though it's anonymous, toString should treat it as if it had the name |
| 6703 // "anonymous". We don't set the name itself so that the system does not | 6738 // "anonymous". We don't set the name itself so that the system does not |
| 6704 // see a binding for it. | 6739 // see a binding for it. |
| 6705 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) | 6740 DECL_BOOLEAN_ACCESSORS(name_should_print_as_anonymous) |
| 6706 | 6741 |
| 6742 // Indicates whether the function is a bound function created using |
| 6743 // the bind function. |
| 6744 DECL_BOOLEAN_ACCESSORS(bound) |
| 6745 |
| 6707 // Indicates that the function is anonymous (the name field can be set | 6746 // Indicates that the function is anonymous (the name field can be set |
| 6708 // through the API, which does not change this flag). | 6747 // through the API, which does not change this flag). |
| 6709 DECL_BOOLEAN_ACCESSORS(is_anonymous) | 6748 DECL_BOOLEAN_ACCESSORS(is_anonymous) |
| 6710 | 6749 |
| 6711 // Is this a function or top-level/eval code. | 6750 // Is this a function or top-level/eval code. |
| 6712 DECL_BOOLEAN_ACCESSORS(is_function) | 6751 DECL_BOOLEAN_ACCESSORS(is_function) |
| 6713 | 6752 |
| 6714 // Indicates that code for this function cannot be compiled with Crankshaft. | 6753 // Indicates that code for this function cannot be compiled with Crankshaft. |
| 6715 DECL_BOOLEAN_ACCESSORS(dont_crankshaft) | 6754 DECL_BOOLEAN_ACCESSORS(dont_crankshaft) |
| 6716 | 6755 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6986 kAllowLazyCompilationWithoutContext, | 7025 kAllowLazyCompilationWithoutContext, |
| 6987 kOptimizationDisabled, | 7026 kOptimizationDisabled, |
| 6988 kNative, | 7027 kNative, |
| 6989 kStrictModeFunction, | 7028 kStrictModeFunction, |
| 6990 kStrongModeFunction, | 7029 kStrongModeFunction, |
| 6991 kUsesArguments, | 7030 kUsesArguments, |
| 6992 kNeedsHomeObject, | 7031 kNeedsHomeObject, |
| 6993 // byte 1 | 7032 // byte 1 |
| 6994 kHasDuplicateParameters, | 7033 kHasDuplicateParameters, |
| 6995 kForceInline, | 7034 kForceInline, |
| 6996 kIsAsmFunction, | 7035 kBoundFunction, |
| 6997 kIsAnonymous, | 7036 kIsAnonymous, |
| 6998 kNameShouldPrintAsAnonymous, | 7037 kNameShouldPrintAsAnonymous, |
| 6999 kIsFunction, | 7038 kIsFunction, |
| 7000 kDontCrankshaft, | 7039 kDontCrankshaft, |
| 7001 kDontFlush, | 7040 kDontFlush, |
| 7002 // byte 2 | 7041 // byte 2 |
| 7003 kFunctionKind, | 7042 kFunctionKind, |
| 7004 kIsArrow = kFunctionKind, | 7043 kIsArrow = kFunctionKind, |
| 7005 kIsGenerator, | 7044 kIsGenerator, |
| 7006 kIsConciseMethod, | 7045 kIsConciseMethod, |
| 7007 kIsAccessorFunction, | 7046 kIsAccessorFunction, |
| 7008 kIsDefaultConstructor, | 7047 kIsDefaultConstructor, |
| 7009 kIsSubclassConstructor, | 7048 kIsSubclassConstructor, |
| 7010 kIsBaseConstructor, | 7049 kIsBaseConstructor, |
| 7011 kIsInObjectLiteral, | 7050 kIsInObjectLiteral, |
| 7012 // byte 3 | 7051 // byte 3 |
| 7052 kIsAsmFunction, |
| 7013 kDeserialized, | 7053 kDeserialized, |
| 7014 kNeverCompiled, | 7054 kNeverCompiled, |
| 7015 kCompilerHintsCount, // Pseudo entry | 7055 kCompilerHintsCount, // Pseudo entry |
| 7016 }; | 7056 }; |
| 7017 // Add hints for other modes when they're added. | 7057 // Add hints for other modes when they're added. |
| 7018 STATIC_ASSERT(LANGUAGE_END == 3); | 7058 STATIC_ASSERT(LANGUAGE_END == 3); |
| 7019 // kFunctionKind has to be byte-aligned | 7059 // kFunctionKind has to be byte-aligned |
| 7020 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); | 7060 STATIC_ASSERT((kFunctionKind % kBitsPerByte) == 0); |
| 7021 // Make sure that FunctionKind and byte 2 are in sync: | 7061 // Make sure that FunctionKind and byte 2 are in sync: |
| 7022 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ | 7062 #define ASSERT_FUNCTION_KIND_ORDER(functionKind, compilerFunctionKind) \ |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7056 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); | 7096 SharedFunctionInfo::kCompilerHintsSize * kBitsPerByte); |
| 7057 | 7097 |
| 7058 public: | 7098 public: |
| 7059 // Constants for optimizing codegen for strict mode function and | 7099 // Constants for optimizing codegen for strict mode function and |
| 7060 // native tests when using integer-width instructions. | 7100 // native tests when using integer-width instructions. |
| 7061 static const int kStrictModeBit = | 7101 static const int kStrictModeBit = |
| 7062 kStrictModeFunction + kCompilerHintsSmiTagSize; | 7102 kStrictModeFunction + kCompilerHintsSmiTagSize; |
| 7063 static const int kStrongModeBit = | 7103 static const int kStrongModeBit = |
| 7064 kStrongModeFunction + kCompilerHintsSmiTagSize; | 7104 kStrongModeFunction + kCompilerHintsSmiTagSize; |
| 7065 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize; | 7105 static const int kNativeBit = kNative + kCompilerHintsSmiTagSize; |
| 7106 static const int kBoundBit = kBoundFunction + kCompilerHintsSmiTagSize; |
| 7066 | 7107 |
| 7067 static const int kClassConstructorBits = | 7108 static const int kClassConstructorBits = |
| 7068 FunctionKind::kClassConstructor | 7109 FunctionKind::kClassConstructor |
| 7069 << (kFunctionKind + kCompilerHintsSmiTagSize); | 7110 << (kFunctionKind + kCompilerHintsSmiTagSize); |
| 7070 | 7111 |
| 7071 // Constants for optimizing codegen for strict mode function and | 7112 // Constants for optimizing codegen for strict mode function and |
| 7072 // native tests. | 7113 // native tests. |
| 7073 // Allows to use byte-width instructions. | 7114 // Allows to use byte-width instructions. |
| 7074 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte; | 7115 static const int kStrictModeBitWithinByte = kStrictModeBit % kBitsPerByte; |
| 7075 static const int kStrongModeBitWithinByte = kStrongModeBit % kBitsPerByte; | 7116 static const int kStrongModeBitWithinByte = kStrongModeBit % kBitsPerByte; |
| 7076 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte; | 7117 static const int kNativeBitWithinByte = kNativeBit % kBitsPerByte; |
| 7118 static const int kBoundBitWithinByte = kBoundBit % kBitsPerByte; |
| 7077 | 7119 |
| 7078 static const int kClassConstructorBitsWithinByte = | 7120 static const int kClassConstructorBitsWithinByte = |
| 7079 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; | 7121 FunctionKind::kClassConstructor << kCompilerHintsSmiTagSize; |
| 7080 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); | 7122 STATIC_ASSERT(kClassConstructorBitsWithinByte < (1 << kBitsPerByte)); |
| 7081 | 7123 |
| 7082 #if defined(V8_TARGET_LITTLE_ENDIAN) | 7124 #if defined(V8_TARGET_LITTLE_ENDIAN) |
| 7083 #define BYTE_OFFSET(compiler_hint) \ | 7125 #define BYTE_OFFSET(compiler_hint) \ |
| 7084 kCompilerHintsOffset + \ | 7126 kCompilerHintsOffset + \ |
| 7085 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte | 7127 (compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte |
| 7086 #elif defined(V8_TARGET_BIG_ENDIAN) | 7128 #elif defined(V8_TARGET_BIG_ENDIAN) |
| 7087 #define BYTE_OFFSET(compiler_hint) \ | 7129 #define BYTE_OFFSET(compiler_hint) \ |
| 7088 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ | 7130 kCompilerHintsOffset + (kCompilerHintsSize - 1) - \ |
| 7089 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) | 7131 ((compiler_hint + kCompilerHintsSmiTagSize) / kBitsPerByte) |
| 7090 #else | 7132 #else |
| 7091 #error Unknown byte ordering | 7133 #error Unknown byte ordering |
| 7092 #endif | 7134 #endif |
| 7093 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); | 7135 static const int kStrictModeByteOffset = BYTE_OFFSET(kStrictModeFunction); |
| 7094 static const int kStrongModeByteOffset = BYTE_OFFSET(kStrongModeFunction); | 7136 static const int kStrongModeByteOffset = BYTE_OFFSET(kStrongModeFunction); |
| 7095 static const int kNativeByteOffset = BYTE_OFFSET(kNative); | 7137 static const int kNativeByteOffset = BYTE_OFFSET(kNative); |
| 7138 static const int kBoundByteOffset = BYTE_OFFSET(kBoundFunction); |
| 7096 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); | 7139 static const int kFunctionKindByteOffset = BYTE_OFFSET(kFunctionKind); |
| 7097 #undef BYTE_OFFSET | 7140 #undef BYTE_OFFSET |
| 7098 | 7141 |
| 7099 private: | 7142 private: |
| 7100 // Returns entry from optimized code map for specified context and OSR entry. | 7143 // Returns entry from optimized code map for specified context and OSR entry. |
| 7101 // The result is either kNotFound, kSharedCodeIndex for context-independent | 7144 // The result is either kNotFound, kSharedCodeIndex for context-independent |
| 7102 // entry or a start index of the context-dependent entry. | 7145 // entry or a start index of the context-dependent entry. |
| 7103 int SearchOptimizedCodeMapEntry(Context* native_context, | 7146 int SearchOptimizedCodeMapEntry(Context* native_context, |
| 7104 BailoutId osr_ast_id); | 7147 BailoutId osr_ast_id); |
| 7105 | 7148 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7195 // Layout description. | 7238 // Layout description. |
| 7196 static const int kContextOffset = JSObject::kHeaderSize; | 7239 static const int kContextOffset = JSObject::kHeaderSize; |
| 7197 static const int kScopeInfoOffset = kContextOffset + kPointerSize; | 7240 static const int kScopeInfoOffset = kContextOffset + kPointerSize; |
| 7198 static const int kSize = kScopeInfoOffset + kPointerSize; | 7241 static const int kSize = kScopeInfoOffset + kPointerSize; |
| 7199 | 7242 |
| 7200 private: | 7243 private: |
| 7201 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModule); | 7244 DISALLOW_IMPLICIT_CONSTRUCTORS(JSModule); |
| 7202 }; | 7245 }; |
| 7203 | 7246 |
| 7204 | 7247 |
| 7205 // JSBoundFunction describes a bound function exotic object. | |
| 7206 class JSBoundFunction : public JSObject { | |
| 7207 public: | |
| 7208 // [length]: The bound function "length" property. | |
| 7209 DECL_ACCESSORS(length, Object) | |
| 7210 | |
| 7211 // [name]: The bound function "name" property. | |
| 7212 DECL_ACCESSORS(name, Object) | |
| 7213 | |
| 7214 // [bound_target_function]: The wrapped function object. | |
| 7215 DECL_ACCESSORS(bound_target_function, JSReceiver) | |
| 7216 | |
| 7217 // [bound_this]: The value that is always passed as the this value when | |
| 7218 // calling the wrapped function. | |
| 7219 DECL_ACCESSORS(bound_this, Object) | |
| 7220 | |
| 7221 // [bound_arguments]: A list of values whose elements are used as the first | |
| 7222 // arguments to any call to the wrapped function. | |
| 7223 DECL_ACCESSORS(bound_arguments, FixedArray) | |
| 7224 | |
| 7225 // [creation_context]: The native context in which the function was bound. | |
| 7226 // TODO(bmeurer, verwaest): Can we (mis)use (unused) constructor field in | |
| 7227 // the Map instead of putting this into the object? Only required for | |
| 7228 // JSReceiver::GetCreationContext() anyway. | |
| 7229 DECL_ACCESSORS(creation_context, Context) | |
| 7230 | |
| 7231 static MaybeHandle<Context> GetFunctionRealm( | |
| 7232 Handle<JSBoundFunction> function); | |
| 7233 | |
| 7234 DECLARE_CAST(JSBoundFunction) | |
| 7235 | |
| 7236 // Dispatched behavior. | |
| 7237 DECLARE_PRINTER(JSBoundFunction) | |
| 7238 DECLARE_VERIFIER(JSBoundFunction) | |
| 7239 | |
| 7240 // The bound function's string representation implemented according | |
| 7241 // to ES6 section 19.2.3.5 Function.prototype.toString ( ). | |
| 7242 static Handle<String> ToString(Handle<JSBoundFunction> function); | |
| 7243 | |
| 7244 // Layout description. | |
| 7245 static const int kBoundTargetFunctionOffset = JSObject::kHeaderSize; | |
| 7246 static const int kBoundThisOffset = kBoundTargetFunctionOffset + kPointerSize; | |
| 7247 static const int kBoundArgumentsOffset = kBoundThisOffset + kPointerSize; | |
| 7248 static const int kCreationContextOffset = | |
| 7249 kBoundArgumentsOffset + kPointerSize; | |
| 7250 static const int kLengthOffset = kCreationContextOffset + kPointerSize; | |
| 7251 static const int kNameOffset = kLengthOffset + kPointerSize; | |
| 7252 static const int kSize = kNameOffset + kPointerSize; | |
| 7253 | |
| 7254 // Indices of in-object properties. | |
| 7255 static const int kLengthIndex = 0; | |
| 7256 static const int kNameIndex = 1; | |
| 7257 | |
| 7258 private: | |
| 7259 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBoundFunction); | |
| 7260 }; | |
| 7261 | |
| 7262 | |
| 7263 // JSFunction describes JavaScript functions. | 7248 // JSFunction describes JavaScript functions. |
| 7264 class JSFunction: public JSObject { | 7249 class JSFunction: public JSObject { |
| 7265 public: | 7250 public: |
| 7266 // [prototype_or_initial_map]: | 7251 // [prototype_or_initial_map]: |
| 7267 DECL_ACCESSORS(prototype_or_initial_map, Object) | 7252 DECL_ACCESSORS(prototype_or_initial_map, Object) |
| 7268 | 7253 |
| 7269 // [shared]: The information about the function that | 7254 // [shared]: The information about the function that |
| 7270 // can be shared by instances. | 7255 // can be shared by instances. |
| 7271 DECL_ACCESSORS(shared, SharedFunctionInfo) | 7256 DECL_ACCESSORS(shared, SharedFunctionInfo) |
| 7272 | 7257 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 7302 // recompilation. | 7287 // recompilation. |
| 7303 inline bool IsMarkedForOptimization(); | 7288 inline bool IsMarkedForOptimization(); |
| 7304 inline bool IsMarkedForConcurrentOptimization(); | 7289 inline bool IsMarkedForConcurrentOptimization(); |
| 7305 | 7290 |
| 7306 // Tells whether or not the function is on the concurrent recompilation queue. | 7291 // Tells whether or not the function is on the concurrent recompilation queue. |
| 7307 inline bool IsInOptimizationQueue(); | 7292 inline bool IsInOptimizationQueue(); |
| 7308 | 7293 |
| 7309 // Completes inobject slack tracking on initial map if it is active. | 7294 // Completes inobject slack tracking on initial map if it is active. |
| 7310 inline void CompleteInobjectSlackTrackingIfActive(); | 7295 inline void CompleteInobjectSlackTrackingIfActive(); |
| 7311 | 7296 |
| 7312 // [literals]: Fixed array holding the materialized literals. | 7297 // [literals_or_bindings]: Fixed array holding either |
| 7298 // the materialized literals or the bindings of a bound function. |
| 7313 // | 7299 // |
| 7314 // If the function contains object, regexp or array literals, the | 7300 // If the function contains object, regexp or array literals, the |
| 7315 // literals array prefix contains the object, regexp, and array | 7301 // literals array prefix contains the object, regexp, and array |
| 7316 // function to be used when creating these literals. This is | 7302 // function to be used when creating these literals. This is |
| 7317 // necessary so that we do not dynamically lookup the object, regexp | 7303 // necessary so that we do not dynamically lookup the object, regexp |
| 7318 // or array functions. Performing a dynamic lookup, we might end up | 7304 // or array functions. Performing a dynamic lookup, we might end up |
| 7319 // using the functions from a new context that we should not have | 7305 // using the functions from a new context that we should not have |
| 7320 // access to. | 7306 // access to. |
| 7321 DECL_ACCESSORS(literals, LiteralsArray) | 7307 // |
| 7308 // On bound functions, the array is a (copy-on-write) fixed-array containing |
| 7309 // the function that was bound, bound this-value and any bound |
| 7310 // arguments. Bound functions never contain literals. |
| 7311 DECL_ACCESSORS(literals_or_bindings, FixedArray) |
| 7312 |
| 7313 inline LiteralsArray* literals(); |
| 7314 inline void set_literals(LiteralsArray* literals); |
| 7315 |
| 7316 inline BindingsArray* function_bindings(); |
| 7317 inline void set_function_bindings(BindingsArray* bindings); |
| 7322 | 7318 |
| 7323 // The initial map for an object created by this constructor. | 7319 // The initial map for an object created by this constructor. |
| 7324 inline Map* initial_map(); | 7320 inline Map* initial_map(); |
| 7325 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, | 7321 static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map, |
| 7326 Handle<Object> prototype); | 7322 Handle<Object> prototype); |
| 7327 inline bool has_initial_map(); | 7323 inline bool has_initial_map(); |
| 7328 static void EnsureHasInitialMap(Handle<JSFunction> function); | 7324 static void EnsureHasInitialMap(Handle<JSFunction> function); |
| 7329 | 7325 |
| 7330 // Creates a map that matches the constructor's initial map, but with | 7326 // Creates a map that matches the constructor's initial map, but with |
| 7331 // [[prototype]] being new.target.prototype. Because new.target can be a | 7327 // [[prototype]] being new.target.prototype. Because new.target can be a |
| (...skipping 3388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10720 } | 10716 } |
| 10721 return value; | 10717 return value; |
| 10722 } | 10718 } |
| 10723 }; | 10719 }; |
| 10724 | 10720 |
| 10725 | 10721 |
| 10726 } // NOLINT, false-positive due to second-order macros. | 10722 } // NOLINT, false-positive due to second-order macros. |
| 10727 } // NOLINT, false-positive due to second-order macros. | 10723 } // NOLINT, false-positive due to second-order macros. |
| 10728 | 10724 |
| 10729 #endif // V8_OBJECTS_H_ | 10725 #endif // V8_OBJECTS_H_ |
| OLD | NEW |