/
githubmirror
/
node
Обзор
Документация
Войти
/
githubmirror
/
node
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
deps/v8/src/codegen/constant-pool-entry.h
82 строки
2 KB
Michaël Zasso
deps: update V8 to 14.2.231.9
23 окт 2025, 08:36
Не верифицирован
23 окт 2025, 08:36
c2843b7
Код
Авторство
О чём код?
// Copyright 2025 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. #ifndef V8_CODEGEN_CONSTANT_POOL_ENTRY_H_ #define V8_CODEGEN_CONSTANT_POOL_ENTRY_H_ #include "src/base/numbers/double.h" #include "src/codegen/reloc-info.h" #include "src/common/globals.h" namespace v8 { namespace internal { // ----------------------------------------------------------------------------- // Constant pool support class ConstantPoolEntry { public: ConstantPoolEntry() = default; ConstantPoolEntry(int position, intptr_t value, bool sharing_ok, RelocInfo::Mode rmode = RelocInfo::NO_INFO) : position_(position), merged_index_(sharing_ok ? SHARING_ALLOWED : SHARING_PROHIBITED), value_(value), rmode_(rmode) {} ConstantPoolEntry(int position, base::Double value, RelocInfo::Mode rmode = RelocInfo::NO_INFO) : position_(position), merged_index_(SHARING_ALLOWED), value64_(value.AsUint64()), rmode_(rmode) {} int position() const { return position_; } bool sharing_ok() const { return merged_index_ != SHARING_PROHIBITED; } bool is_merged() const { return merged_index_ >= 0; } int merged_index() const { DCHECK(is_merged()); return merged_index_; } void set_merged_index(int index) { DCHECK(sharing_ok()); merged_index_ = index; DCHECK(is_merged()); } int offset() const { DCHECK_GE(merged_index_, 0); return merged_index_; } void set_offset(int offset) { DCHECK_GE(offset, 0); merged_index_ = offset; } intptr_t value() const { return value_; } uint64_t value64() const { return value64_; } RelocInfo::Mode rmode() const { return rmode_; } enum Type { INTPTR, DOUBLE, NUMBER_OF_TYPES }; static int size(Type type) { return (type == INTPTR) ? kSystemPointerSize : kDoubleSize; } enum Access { REGULAR, OVERFLOWED }; private: int position_; int merged_index_; union { intptr_t value_; uint64_t value64_; }; // TODO(leszeks): The way we use this, it could probably be packed into // merged_index_ if size is a concern. RelocInfo::Mode rmode_; enum { SHARING_PROHIBITED = -2, SHARING_ALLOWED = -1 }; }; } // namespace internal } // namespace v8 #endif // V8_CODEGEN_CONSTANT_POOL_ENTRY_H_