summaryrefslogtreecommitdiff
path: root/deps/v8/src/objects/js-objects.h
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2020-10-15 20:17:08 +0200
committerMichaël Zasso <targos@protonmail.com>2020-10-18 20:16:47 +0200
commita1d639ba5de4ff34e34fb575fbb6cc1d41ec3cce (patch)
treeabc7d41c12f1495b1208fa4449cb2508c92c5e85 /deps/v8/src/objects/js-objects.h
parent089d654dd85f8e548597329f60a41d6029260caa (diff)
downloadnode-new-a1d639ba5de4ff34e34fb575fbb6cc1d41ec3cce.tar.gz
deps: update V8 to 8.6.395
PR-URL: https://github.com/nodejs/node/pull/35415 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/src/objects/js-objects.h')
-rw-r--r--deps/v8/src/objects/js-objects.h272
1 files changed, 2 insertions, 270 deletions
diff --git a/deps/v8/src/objects/js-objects.h b/deps/v8/src/objects/js-objects.h
index 9e9f8e3128..e33df30ac8 100644
--- a/deps/v8/src/objects/js-objects.h
+++ b/deps/v8/src/objects/js-objects.h
@@ -27,6 +27,7 @@ enum InstanceType : uint16_t;
class JSGlobalObject;
class JSGlobalProxy;
class NativeContext;
+class IsCompiledScope;
// JSReceiver includes types on which properties can be defined, i.e.,
// JSObject and JSProxy.
@@ -237,7 +238,7 @@ class JSReceiver : public HeapObject {
LookupIterator* it);
// Set the object's prototype (only JSReceiver and null are allowed values).
- V8_WARN_UNUSED_RESULT static Maybe<bool> SetPrototype(
+ V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static Maybe<bool> SetPrototype(
Handle<JSReceiver> object, Handle<Object> value, bool from_javascript,
ShouldThrow should_throw);
@@ -925,271 +926,6 @@ class JSIteratorResult : public JSObject {
OBJECT_CONSTRUCTORS(JSIteratorResult, JSObject);
};
-// 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> {
- public:
- STATIC_ASSERT(kHeaderSize == JSObject::kHeaderSize);
- TQ_OBJECT_CONSTRUCTORS(JSFunctionOrBoundFunction)
-};
-
-// JSBoundFunction describes a bound function exotic object.
-class JSBoundFunction
- : public TorqueGeneratedJSBoundFunction<JSBoundFunction,
- JSFunctionOrBoundFunction> {
- public:
- static MaybeHandle<String> GetName(Isolate* isolate,
- Handle<JSBoundFunction> function);
- static Maybe<int> GetLength(Isolate* isolate,
- Handle<JSBoundFunction> function);
- static MaybeHandle<NativeContext> GetFunctionRealm(
- Handle<JSBoundFunction> function);
-
- // Dispatched behavior.
- DECL_PRINTER(JSBoundFunction)
- DECL_VERIFIER(JSBoundFunction)
-
- // The bound function's string representation implemented according
- // to ES6 section 19.2.3.5 Function.prototype.toString ( ).
- static Handle<String> ToString(Handle<JSBoundFunction> function);
-
- TQ_OBJECT_CONSTRUCTORS(JSBoundFunction)
-};
-
-// JSFunction describes JavaScript functions.
-class JSFunction : public JSFunctionOrBoundFunction {
- public:
- // [prototype_or_initial_map]:
- DECL_ACCESSORS(prototype_or_initial_map, HeapObject)
-
- // [shared]: The information about the function that
- // can be shared by instances.
- DECL_ACCESSORS(shared, SharedFunctionInfo)
-
- static const int kLengthDescriptorIndex = 0;
- static const int kNameDescriptorIndex = 1;
- // Home object descriptor index when function has a [[HomeObject]] slot.
- static const int kMaybeHomeObjectDescriptorIndex = 2;
-
- // [context]: The context for this function.
- inline Context context();
- inline bool has_context() const;
- inline void set_context(HeapObject context);
- inline JSGlobalProxy global_proxy();
- inline NativeContext native_context();
- inline int length();
-
- static Handle<Object> GetName(Isolate* isolate, Handle<JSFunction> function);
- static Handle<NativeContext> GetFunctionRealm(Handle<JSFunction> function);
-
- // [code]: The generated code object for this function. Executed
- // when the function is invoked, e.g. foo() or new foo(). See
- // [[Call]] and [[Construct]] description in ECMA-262, section
- // 8.6.2, page 27.
- inline Code code() const;
- inline void set_code(Code code);
- inline void set_code_no_write_barrier(Code code);
-
- // Get the abstract code associated with the function, which will either be
- // a Code object or a BytecodeArray.
- inline AbstractCode abstract_code();
-
- // Tells whether or not this function is interpreted.
- //
- // Note: function->IsInterpreted() does not necessarily return the same value
- // as function->shared()->IsInterpreted() because the closure might have been
- // optimized.
- inline bool IsInterpreted();
-
- // Tells whether or not this function checks its optimization marker in its
- // feedback vector.
- inline bool ChecksOptimizationMarker();
-
- // Tells whether or not this function holds optimized code.
- //
- // Note: Returning false does not necessarily mean that this function hasn't
- // been optimized, as it may have optimized code on its feedback vector.
- inline bool IsOptimized();
-
- // Tells whether or not this function has optimized code available to it,
- // either because it is optimized or because it has optimized code in its
- // feedback vector.
- inline bool HasOptimizedCode();
-
- // Tells whether or not this function has a (non-zero) optimization marker.
- inline bool HasOptimizationMarker();
-
- // Mark this function for lazy recompilation. The function will be recompiled
- // the next time it is executed.
- void MarkForOptimization(ConcurrencyMode mode);
-
- // Tells whether or not the function is already marked for lazy recompilation.
- inline bool IsMarkedForOptimization();
- inline bool IsMarkedForConcurrentOptimization();
-
- // Tells whether or not the function is on the concurrent recompilation queue.
- inline bool IsInOptimizationQueue();
-
- // Clears the optimized code slot in the function's feedback vector.
- inline void ClearOptimizedCodeSlot(const char* reason);
-
- // Sets the optimization marker in the function's feedback vector.
- inline void SetOptimizationMarker(OptimizationMarker marker);
-
- // Clears the optimization marker in the function's feedback vector.
- inline void ClearOptimizationMarker();
-
- // 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
- // returns the initial map's instance size.
- int ComputeInstanceSizeWithMinSlack(Isolate* isolate);
-
- // Completes inobject slack tracking on initial map if it is active.
- inline void CompleteInobjectSlackTrackingIfActive();
-
- // [raw_feedback_cell]: Gives raw access to the FeedbackCell used to hold the
- /// FeedbackVector eventually. Generally this shouldn't be used to get the
- // feedback_vector, instead use feedback_vector() which correctly deals with
- // the JSFunction's bytecode being flushed.
- DECL_ACCESSORS(raw_feedback_cell, FeedbackCell)
-
- // Functions related to feedback vector. feedback_vector() can be used once
- // the function has feedback vectors allocated. feedback vectors may not be
- // available after compile when lazily allocating feedback vectors.
- inline FeedbackVector feedback_vector() const;
- inline bool has_feedback_vector() const;
- V8_EXPORT_PRIVATE static void EnsureFeedbackVector(
- Handle<JSFunction> function);
-
- // Functions related to clousre feedback cell array that holds feedback cells
- // used to create closures from this function. We allocate closure feedback
- // cell arrays after compile, when we want to allocate feedback vectors
- // lazily.
- inline bool has_closure_feedback_cell_array() const;
- inline ClosureFeedbackCellArray closure_feedback_cell_array() const;
- static void EnsureClosureFeedbackCellArray(Handle<JSFunction> function);
-
- // Initializes the feedback cell of |function|. In lite mode, this would be
- // initialized to the closure feedback cell array that holds the feedback
- // cells for create closure calls from this function. In the regular mode,
- // this allocates feedback vector.
- static void InitializeFeedbackCell(Handle<JSFunction> function);
-
- // Unconditionally clear the type feedback vector.
- void ClearTypeFeedbackInfo();
-
- // Resets function to clear compiled data after bytecode has been flushed.
- inline bool NeedsResetDueToFlushedBytecode();
- inline void ResetIfBytecodeFlushed(
- base::Optional<std::function<void(HeapObject object, ObjectSlot slot,
- HeapObject target)>>
- gc_notify_updated_slot = base::nullopt);
-
- DECL_GETTER(has_prototype_slot, bool)
-
- // The initial map for an object created by this constructor.
- DECL_GETTER(initial_map, Map)
-
- static void SetInitialMap(Handle<JSFunction> function, Handle<Map> map,
- Handle<HeapObject> prototype);
- DECL_GETTER(has_initial_map, bool)
- V8_EXPORT_PRIVATE static void EnsureHasInitialMap(
- Handle<JSFunction> function);
-
- // Creates a map that matches the constructor's initial map, but with
- // [[prototype]] being new.target.prototype. Because new.target can be a
- // JSProxy, this can call back into JavaScript.
- static V8_WARN_UNUSED_RESULT MaybeHandle<Map> GetDerivedMap(
- Isolate* isolate, Handle<JSFunction> constructor,
- Handle<JSReceiver> new_target);
-
- // Get and set the prototype property on a JSFunction. If the
- // function has an initial map the prototype is set on the initial
- // map. Otherwise, the prototype is put in the initial map field
- // until an initial map is needed.
- DECL_GETTER(has_prototype, bool)
- DECL_GETTER(has_instance_prototype, bool)
- DECL_GETTER(prototype, Object)
- DECL_GETTER(instance_prototype, HeapObject)
- DECL_GETTER(has_prototype_property, bool)
- DECL_GETTER(PrototypeRequiresRuntimeLookup, bool)
- static void SetPrototype(Handle<JSFunction> function, Handle<Object> value);
-
- // Returns if this function has been compiled to native code yet.
- inline bool is_compiled() const;
-
- static int GetHeaderSize(bool function_has_prototype_slot) {
- return function_has_prototype_slot ? JSFunction::kSizeWithPrototype
- : JSFunction::kSizeWithoutPrototype;
- }
-
- // Prints the name of the function using PrintF.
- void PrintName(FILE* out = stdout);
-
- DECL_CAST(JSFunction)
-
- // Calculate the instance size and in-object properties count.
- static V8_WARN_UNUSED_RESULT int CalculateExpectedNofProperties(
- Isolate* isolate, Handle<JSFunction> function);
- static void CalculateInstanceSizeHelper(InstanceType instance_type,
- bool has_prototype_slot,
- int requested_embedder_fields,
- int requested_in_object_properties,
- int* instance_size,
- int* in_object_properties);
-
- // Dispatched behavior.
- DECL_PRINTER(JSFunction)
- DECL_VERIFIER(JSFunction)
-
- // The function's name if it is configured, otherwise shared function info
- // debug name.
- static Handle<String> GetName(Handle<JSFunction> function);
-
- // ES6 section 9.2.11 SetFunctionName
- // Because of the way this abstract operation is used in the spec,
- // it should never fail, but in practice it will fail if the generated
- // function name's length exceeds String::kMaxLength.
- static V8_WARN_UNUSED_RESULT bool SetName(Handle<JSFunction> function,
- Handle<Name> name,
- Handle<String> prefix);
-
- // The function's displayName if it is set, otherwise name if it is
- // configured, otherwise shared function info
- // debug name.
- static Handle<String> GetDebugName(Handle<JSFunction> function);
-
- // The function's string representation implemented according to
- // ES6 section 19.2.3.5 Function.prototype.toString ( ).
- static Handle<String> ToString(Handle<JSFunction> function);
-
- struct FieldOffsets {
- DEFINE_FIELD_OFFSET_CONSTANTS(JSFunctionOrBoundFunction::kHeaderSize,
- TORQUE_GENERATED_JS_FUNCTION_FIELDS)
- };
- static constexpr int kSharedFunctionInfoOffset =
- FieldOffsets::kSharedFunctionInfoOffset;
- static constexpr int kContextOffset = FieldOffsets::kContextOffset;
- static constexpr int kFeedbackCellOffset = FieldOffsets::kFeedbackCellOffset;
- static constexpr int kCodeOffset = FieldOffsets::kCodeOffset;
- static constexpr int kPrototypeOrInitialMapOffset =
- FieldOffsets::kPrototypeOrInitialMapOffset;
-
- private:
- // JSFunction doesn't have a fixed header size:
- // Hide JSFunctionOrBoundFunction::kHeaderSize to avoid confusion.
- static const int kHeaderSize;
-
- public:
- static constexpr int kSizeWithoutPrototype = kPrototypeOrInitialMapOffset;
- static constexpr int kSizeWithPrototype = FieldOffsets::kHeaderSize;
-
- OBJECT_CONSTRUCTORS(JSFunction, JSFunctionOrBoundFunction);
-};
-
// JSGlobalProxy's prototype must be a JSGlobalObject or null,
// and the prototype is hidden. JSGlobalProxy always delegates
// property accesses to its prototype if the prototype is not null.
@@ -1227,10 +963,6 @@ class JSGlobalObject : public JSSpecialObject {
static void InvalidatePropertyCell(Handle<JSGlobalObject> object,
Handle<Name> name);
- // Ensure that the global object has a cell for the given property name.
- static Handle<PropertyCell> EnsureEmptyPropertyCell(
- Handle<JSGlobalObject> global, Handle<Name> name,
- PropertyCellType cell_type, InternalIndex* entry_out = nullptr);
DECL_CAST(JSGlobalObject)