chromium/v8/src/objects/literal-objects.cc

// Copyright 2017 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/literal-objects.h"

#include "src/ast/ast.h"
#include "src/base/logging.h"
#include "src/builtins/accessors.h"
#include "src/common/globals.h"
#include "src/execution/isolate.h"
#include "src/heap/factory.h"
#include "src/heap/local-factory-inl.h"
#include "src/objects/dictionary.h"
#include "src/objects/hash-table-inl.h"
#include "src/objects/js-regexp.h"
#include "src/objects/literal-objects-inl.h"
#include "src/objects/objects-inl.h"
#include "src/objects/smi.h"
#include "src/objects/struct-inl.h"

namespace v8 {
namespace internal {

namespace {

// The enumeration order index in the property details is unused if they are
// stored in a SwissNameDictionary or NumberDictionary (because they handle
// propery ordering differently). We then use this dummy value instead.
constexpr int kDummyEnumerationIndex =;

inline int EncodeComputedEntry(ClassBoilerplate::ValueKind value_kind,
                               unsigned key_index) {}

void SetAccessorPlaceholderIndices(Tagged<AccessorPair> pair,
                                   ClassBoilerplate::ValueKind value_kind,
                                   Tagged<Smi> index) {}

void SetAccessorPlaceholderIndices(Tagged<AccessorPair> pair,
                                   ClassBoilerplate::ValueKind value_kind,
                                   Tagged<Smi> index, ReleaseStoreTag tag) {}

template <typename IsolateT>
void AddToDescriptorArrayTemplate(
    IsolateT* isolate, DirectHandle<DescriptorArray> descriptor_array_template,
    Handle<Name> name, ClassBoilerplate::ValueKind value_kind,
    Handle<Object> value) {}

template <typename IsolateT>
Handle<NameDictionary> DictionaryAddNoUpdateNextEnumerationIndex(
    IsolateT* isolate, Handle<NameDictionary> dictionary, Handle<Name> name,
    Handle<Object> value, PropertyDetails details,
    InternalIndex* entry_out = nullptr) {}

template <typename IsolateT>
Handle<SwissNameDictionary> DictionaryAddNoUpdateNextEnumerationIndex(
    IsolateT* isolate, Handle<SwissNameDictionary> dictionary,
    Handle<Name> name, Handle<Object> value, PropertyDetails details,
    InternalIndex* entry_out = nullptr) {}

template <typename IsolateT>
Handle<NumberDictionary> DictionaryAddNoUpdateNextEnumerationIndex(
    IsolateT* isolate, Handle<NumberDictionary> dictionary, uint32_t element,
    Handle<Object> value, PropertyDetails details,
    InternalIndex* entry_out = nullptr) {}

// TODO(42203211): The first parameter should be just DirectHandle<Dictionary>
// but now it does not compile with implicit Handle to DirectHandle conversions.
template <template <typename T> typename HandleType, typename Dictionary,
          typename = std::enable_if_t<std::is_convertible_v<
              HandleType<Dictionary>, DirectHandle<Dictionary>>>>
void DictionaryUpdateMaxNumberKey(HandleType<Dictionary> dictionary,
                                  DirectHandle<Name> name) {}

void DictionaryUpdateMaxNumberKey(DirectHandle<NumberDictionary> dictionary,
                                  uint32_t element) {}

constexpr int ComputeEnumerationIndex(int value_index) {}

constexpr int kAccessorNotDefined =;

inline int GetExistingValueIndex(Tagged<Object> value) {}

template <typename IsolateT, typename Dictionary, typename Key>
void AddToDictionaryTemplate(IsolateT* isolate, Handle<Dictionary> dictionary,
                             Key key, int key_index,
                             ClassBoilerplate::ValueKind value_kind,
                             Tagged<Smi> value) {}

}  // namespace

// Helper class that eases building of a properties, elements and computed
// properties templates.
template <typename IsolateT>
class ObjectDescriptor {};

template <typename IsolateT, typename PropertyDict>
void ClassBoilerplate::AddToPropertiesTemplate(
    IsolateT* isolate, Handle<PropertyDict> dictionary, Handle<Name> name,
    int key_index, ClassBoilerplate::ValueKind value_kind, Tagged<Smi> value) {}
template void ClassBoilerplate::AddToPropertiesTemplate(
    Isolate* isolate, Handle<NameDictionary> dictionary, Handle<Name> name,
    int key_index, ClassBoilerplate::ValueKind value_kind, Tagged<Smi> value);
template void ClassBoilerplate::AddToPropertiesTemplate(
    LocalIsolate* isolate, Handle<NameDictionary> dictionary, Handle<Name> name,
    int key_index, ClassBoilerplate::ValueKind value_kind, Tagged<Smi> value);
template void ClassBoilerplate::AddToPropertiesTemplate(
    Isolate* isolate, Handle<SwissNameDictionary> dictionary, Handle<Name> name,
    int key_index, ClassBoilerplate::ValueKind value_kind, Tagged<Smi> value);

template <typename IsolateT>
void ClassBoilerplate::AddToElementsTemplate(
    IsolateT* isolate, Handle<NumberDictionary> dictionary, uint32_t key,
    int key_index, ClassBoilerplate::ValueKind value_kind, Tagged<Smi> value) {}
template void ClassBoilerplate::AddToElementsTemplate(
    Isolate* isolate, Handle<NumberDictionary> dictionary, uint32_t key,
    int key_index, ClassBoilerplate::ValueKind value_kind, Tagged<Smi> value);
template void ClassBoilerplate::AddToElementsTemplate(
    LocalIsolate* isolate, Handle<NumberDictionary> dictionary, uint32_t key,
    int key_index, ClassBoilerplate::ValueKind value_kind, Tagged<Smi> value);

// static
template <typename IsolateT>
Handle<ClassBoilerplate> ClassBoilerplate::New(IsolateT* isolate,
                                               ClassLiteral* expr,
                                               AllocationType allocation) {}

template Handle<ClassBoilerplate> ClassBoilerplate::New(
    Isolate* isolate, ClassLiteral* expr, AllocationType allocation);
template Handle<ClassBoilerplate> ClassBoilerplate::New(
    LocalIsolate* isolate, ClassLiteral* expr, AllocationType allocation);

void ArrayBoilerplateDescription::BriefPrintDetails(std::ostream& os) {}

void RegExpBoilerplateDescription::BriefPrintDetails(std::ostream& os) {}

}  // namespace internal
}  // namespace v8