diff options
Diffstat (limited to 'deps/v8/src/objects/js-function.h')
-rw-r--r-- | deps/v8/src/objects/js-function.h | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/deps/v8/src/objects/js-function.h b/deps/v8/src/objects/js-function.h index 866871628f..6d430aec30 100644 --- a/deps/v8/src/objects/js-function.h +++ b/deps/v8/src/objects/js-function.h @@ -19,21 +19,21 @@ namespace internal { // An abstract superclass for classes representing JavaScript function values. // It doesn't carry any functionality but allows function classes to be // identified in the type system. -class JSFunctionOrBoundFunction - : public TorqueGeneratedJSFunctionOrBoundFunction<JSFunctionOrBoundFunction, - JSObject> { +class JSFunctionOrBoundFunctionOrWrappedFunction + : public TorqueGeneratedJSFunctionOrBoundFunctionOrWrappedFunction< + JSFunctionOrBoundFunctionOrWrappedFunction, JSObject> { public: static const int kLengthDescriptorIndex = 0; static const int kNameDescriptorIndex = 1; STATIC_ASSERT(kHeaderSize == JSObject::kHeaderSize); - TQ_OBJECT_CONSTRUCTORS(JSFunctionOrBoundFunction) + TQ_OBJECT_CONSTRUCTORS(JSFunctionOrBoundFunctionOrWrappedFunction) }; // JSBoundFunction describes a bound function exotic object. class JSBoundFunction - : public TorqueGeneratedJSBoundFunction<JSBoundFunction, - JSFunctionOrBoundFunction> { + : public TorqueGeneratedJSBoundFunction< + JSBoundFunction, JSFunctionOrBoundFunctionOrWrappedFunction> { public: static MaybeHandle<String> GetName(Isolate* isolate, Handle<JSBoundFunction> function); @@ -51,9 +51,25 @@ class JSBoundFunction TQ_OBJECT_CONSTRUCTORS(JSBoundFunction) }; +// JSWrappedFunction describes a wrapped function exotic object. +class JSWrappedFunction + : public TorqueGeneratedJSWrappedFunction< + JSWrappedFunction, JSFunctionOrBoundFunctionOrWrappedFunction> { + public: + // Dispatched behavior. + DECL_PRINTER(JSWrappedFunction) + DECL_VERIFIER(JSWrappedFunction) + + // The wrapped function's string representation implemented according + // to ES6 section 19.2.3.5 Function.prototype.toString ( ). + static Handle<String> ToString(Handle<JSWrappedFunction> function); + + TQ_OBJECT_CONSTRUCTORS(JSWrappedFunction) +}; + // JSFunction describes JavaScript functions. -class JSFunction - : public TorqueGeneratedJSFunction<JSFunction, JSFunctionOrBoundFunction> { +class JSFunction : public TorqueGeneratedJSFunction< + JSFunction, JSFunctionOrBoundFunctionOrWrappedFunction> { public: // [prototype_or_initial_map]: DECL_RELEASE_ACQUIRE_ACCESSORS(prototype_or_initial_map, HeapObject) @@ -84,14 +100,12 @@ class JSFunction // optimized code object, or when reading from the background thread. // Storing a builtin doesn't require release semantics because these objects // are fully initialized. - DECL_ACCESSORS(code, Code) - DECL_RELEASE_ACQUIRE_ACCESSORS(code, Code) + DECL_ACCESSORS(code, CodeT) + DECL_RELEASE_ACQUIRE_ACCESSORS(code, CodeT) #ifdef V8_EXTERNAL_CODE_SPACE // Convenient overloads to avoid unnecessary Code <-> CodeT conversions. // TODO(v8:11880): remove once |code| accessors are migrated to CodeT. - inline void set_code(CodeT code, - WriteBarrierMode mode = UPDATE_WRITE_BARRIER); - inline void set_code(CodeT code, ReleaseStoreTag, + inline void set_code(Code code, ReleaseStoreTag, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); #endif @@ -129,12 +143,9 @@ class JSFunction base::Optional<CodeKind> GetActiveTier() const; V8_EXPORT_PRIVATE bool ActiveTierIsIgnition() const; - bool ActiveTierIsTurbofan() const; bool ActiveTierIsBaseline() const; - bool ActiveTierIsMidtierTurboprop() const; - bool ActiveTierIsToptierTurboprop() const; - - CodeKind NextTier() const; + bool ActiveTierIsMaglev() const; + bool ActiveTierIsTurbofan() const; // Similar to SharedFunctionInfo::CanDiscardCompiled. Returns true, if the // attached code can be recreated at a later point by replacing it with @@ -150,7 +161,8 @@ class JSFunction // Mark this function for lazy recompilation. The function will be recompiled // the next time it is executed. - inline void MarkForOptimization(ConcurrencyMode mode); + void MarkForOptimization(Isolate* isolate, CodeKind target_kind, + ConcurrencyMode mode); // Tells whether or not the function is already marked for lazy recompilation. inline bool IsMarkedForOptimization(); @@ -167,7 +179,7 @@ class JSFunction // Sets the interrupt budget based on whether the function has a feedback // vector and any optimized code. - inline void SetInterruptBudget(); + void SetInterruptBudget(Isolate* isolate); // If slack tracking is active, it computes instance size of the initial map // with minimum permissible object slack. If it is not active, it simply @@ -194,7 +206,11 @@ class JSFunction inline FeedbackVector feedback_vector() const; inline bool has_feedback_vector() const; V8_EXPORT_PRIVATE static void EnsureFeedbackVector( - Handle<JSFunction> function, IsCompiledScope* compiled_scope); + Isolate* isolate, Handle<JSFunction> function, + IsCompiledScope* compiled_scope); + static void CreateAndAttachFeedbackVector(Isolate* isolate, + Handle<JSFunction> function, + IsCompiledScope* compiled_scope); // Functions related to closure feedback cell array that holds feedback cells // used to create closures from this function. We allocate closure feedback @@ -317,9 +333,6 @@ class JSFunction class BodyDescriptor; private: - DECL_ACCESSORS(raw_code, CodeT) - DECL_RELEASE_ACQUIRE_ACCESSORS(raw_code, CodeT) - // JSFunction doesn't have a fixed header size: // Hide TorqueGeneratedClass::kHeaderSize to avoid confusion. static const int kHeaderSize; |