chromium/v8/src/objects/js-function.cc

// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "src/objects/js-function.h"

#include <optional>

#include "src/baseline/baseline-batch-compiler.h"
#include "src/codegen/compiler.h"
#include "src/common/globals.h"
#include "src/diagnostics/code-tracer.h"
#include "src/execution/frames-inl.h"
#include "src/execution/isolate.h"
#include "src/execution/tiering-manager.h"
#include "src/heap/heap-inl.h"
#include "src/ic/ic.h"
#include "src/init/bootstrapper.h"
#include "src/objects/feedback-cell-inl.h"
#include "src/strings/string-builder-inl.h"

// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"

namespace v8::internal {

CodeKinds JSFunction::GetAttachedCodeKinds(IsolateForSandbox isolate) const {}

CodeKinds JSFunction::GetAvailableCodeKinds(IsolateForSandbox isolate) const {}

bool JSFunction::HasAttachedOptimizedCode(IsolateForSandbox isolate) const {}

bool JSFunction::HasAvailableHigherTierCodeThan(IsolateForSandbox isolate,
                                                CodeKind kind) const {}

bool JSFunction::HasAvailableHigherTierCodeThanWithFilter(
    IsolateForSandbox isolate, CodeKind kind, CodeKinds filter_mask) const {}

bool JSFunction::HasAvailableOptimizedCode(IsolateForSandbox isolate) const {}

bool JSFunction::HasAttachedCodeKind(IsolateForSandbox isolate,
                                     CodeKind kind) const {}

bool JSFunction::HasAvailableCodeKind(IsolateForSandbox isolate,
                                      CodeKind kind) const {}

namespace {

// Returns false if no highest tier exists (i.e. the function is not compiled),
// otherwise returns true and sets highest_tier.
V8_WARN_UNUSED_RESULT bool HighestTierOf(CodeKinds kinds,
                                         CodeKind* highest_tier) {}

}  // namespace

std::optional<CodeKind> JSFunction::GetActiveTier(
    IsolateForSandbox isolate) const {}

bool JSFunction::ActiveTierIsIgnition(IsolateForSandbox isolate) const {}

bool JSFunction::ActiveTierIsBaseline(IsolateForSandbox isolate) const {}

bool JSFunction::ActiveTierIsMaglev(IsolateForSandbox isolate) const {}

bool JSFunction::ActiveTierIsTurbofan(IsolateForSandbox isolate) const {}

bool JSFunction::CanDiscardCompiled(IsolateForSandbox isolate) const {}

namespace {

constexpr TieringState TieringStateFor(CodeKind target_kind,
                                       ConcurrencyMode mode) {}

}  // namespace

void JSFunction::MarkForOptimization(Isolate* isolate, CodeKind target_kind,
                                     ConcurrencyMode mode) {}

void JSFunction::SetInterruptBudget(
    Isolate* isolate, std::optional<CodeKind> override_active_tier) {}

// static
Maybe<bool> JSFunctionOrBoundFunctionOrWrappedFunction::CopyNameAndLength(
    Isolate* isolate,
    Handle<JSFunctionOrBoundFunctionOrWrappedFunction> function,
    Handle<JSReceiver> target, Handle<String> prefix, int arg_count) {}

// static
MaybeHandle<String> JSBoundFunction::GetName(
    Isolate* isolate, DirectHandle<JSBoundFunction> function) {}

// static
Maybe<int> JSBoundFunction::GetLength(Isolate* isolate,
                                      DirectHandle<JSBoundFunction> function) {}

// static
Handle<String> JSBoundFunction::ToString(
    DirectHandle<JSBoundFunction> function) {}

// static
MaybeHandle<String> JSWrappedFunction::GetName(
    Isolate* isolate, DirectHandle<JSWrappedFunction> function) {}

// static
Maybe<int> JSWrappedFunction::GetLength(
    Isolate* isolate, DirectHandle<JSWrappedFunction> function) {}

// static
Handle<String> JSWrappedFunction::ToString(
    DirectHandle<JSWrappedFunction> function) {}

// static
MaybeHandle<Object> JSWrappedFunction::Create(
    Isolate* isolate, DirectHandle<NativeContext> creation_context,
    Handle<JSReceiver> value) {}

// static
Handle<String> JSFunction::GetName(Isolate* isolate,
                                   DirectHandle<JSFunction> function) {}

// static
void JSFunction::EnsureClosureFeedbackCellArray(
    DirectHandle<JSFunction> function,
    bool reset_budget_for_feedback_allocation) {}

// static
void JSFunction::EnsureFeedbackVector(Isolate* isolate,
                                      DirectHandle<JSFunction> function,
                                      IsCompiledScope* compiled_scope) {}

// static
void JSFunction::CreateAndAttachFeedbackVector(
    Isolate* isolate, DirectHandle<JSFunction> function,
    IsCompiledScope* compiled_scope) {}

// static
void JSFunction::InitializeFeedbackCell(
    DirectHandle<JSFunction> function, IsCompiledScope* is_compiled_scope,
    bool reset_budget_for_feedback_allocation) {}

namespace {

void SetInstancePrototype(Isolate* isolate, DirectHandle<JSFunction> function,
                          Handle<JSReceiver> value) {}

}  // anonymous namespace

void JSFunction::SetPrototype(DirectHandle<JSFunction> function,
                              Handle<Object> value) {}

void JSFunction::SetInitialMap(Isolate* isolate,
                               DirectHandle<JSFunction> function,
                               Handle<Map> map, Handle<HeapObject> prototype) {}

void JSFunction::SetInitialMap(Isolate* isolate,
                               DirectHandle<JSFunction> function,
                               Handle<Map> map, Handle<HeapObject> prototype,
                               DirectHandle<JSFunction> constructor) {}

void JSFunction::EnsureHasInitialMap(Handle<JSFunction> function) {}

namespace {

#ifdef DEBUG
bool CanSubclassHaveInobjectProperties(InstanceType instance_type) {}
#endif  // DEBUG

bool FastInitializeDerivedMap(Isolate* isolate, Handle<JSFunction> new_target,
                              DirectHandle<JSFunction> constructor,
                              Handle<Map> constructor_initial_map) {}

}  // namespace

// static
MaybeHandle<Map> JSFunction::GetDerivedMap(Isolate* isolate,
                                           Handle<JSFunction> constructor,
                                           Handle<JSReceiver> new_target) {}

namespace  // namespace

MaybeHandle<Map> JSFunction::GetDerivedRabGsabTypedArrayMap(
    Isolate* isolate, Handle<JSFunction> constructor,
    Handle<JSReceiver> new_target) {}

MaybeHandle<Map> JSFunction::GetDerivedRabGsabDataViewMap(
    Isolate* isolate, Handle<JSReceiver> new_target) {}

int JSFunction::ComputeInstanceSizeWithMinSlack(Isolate* isolate) {}

std::unique_ptr<char[]> JSFunction::DebugNameCStr() {}

void JSFunction::PrintName(FILE* out) {}

namespace {

bool UseFastFunctionNameLookup(Isolate* isolate, Tagged<Map> map) {}

}  // namespace

Handle<String> JSFunction::GetDebugName(Handle<JSFunction> function) {}

bool JSFunction::SetName(Handle<JSFunction> function, Handle<Name> name,
                         DirectHandle<String> prefix) {}

namespace {

Handle<String> NativeCodeFunctionSourceString(
    Isolate* isolate, DirectHandle<SharedFunctionInfo> shared_info) {}

}  // namespace

// static
Handle<String> JSFunction::ToString(DirectHandle<JSFunction> function) {}

// static
int JSFunction::CalculateExpectedNofProperties(Isolate* isolate,
                                               Handle<JSFunction> function) {}

// static
void JSFunction::CalculateInstanceSizeHelper(InstanceType instance_type,
                                             bool has_prototype_slot,
                                             int requested_embedder_fields,
                                             int requested_in_object_properties,
                                             int* instance_size,
                                             int* in_object_properties) {}

void JSFunction::ClearAllTypeFeedbackInfoForTesting() {}

}  // namespace v8::internal

#include "src/objects/object-macros-undef.h"