[cleanup] #include heap-inl.h less often
This takes heap-inl.h out of the "Giant Include Cluster". Naturally, that means adding a bunch of explicit includes in a bunch of places that relied on transitively including them before. As of this patch, no header file outside src/heap/ includes heap-inl.h. Bug: v8:8562,v8:8499 Change-Id: I65fa763f90e66afc30d105b9277792721f05a6d4 Reviewed-on: https://chromium-review.googlesource.com/c/1459659 Commit-Queue: Jakob Kummerow <jkummerow@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Sigurd Schneider <sigurds@chromium.org> Cr-Commit-Position: refs/heads/master@{#59617}
This commit is contained in:
parent
4c2a3c027d
commit
6cac1382f4
1
BUILD.gn
1
BUILD.gn
@ -2004,6 +2004,7 @@ v8_source_set("v8_base") {
|
||||
"src/handles-inl.h",
|
||||
"src/handles.cc",
|
||||
"src/handles.h",
|
||||
"src/hash-seed-inl.h",
|
||||
"src/heap-symbols.h",
|
||||
"src/heap/array-buffer-collector.cc",
|
||||
"src/heap/array-buffer-collector.h",
|
||||
|
15
src/api.cc
15
src/api.cc
@ -45,6 +45,7 @@
|
||||
#include "src/gdb-jit.h"
|
||||
#include "src/global-handles.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/icu_util.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/json-parser.h"
|
||||
@ -5595,7 +5596,7 @@ Local<Value> Symbol::Name() const {
|
||||
i::Handle<i::Symbol> sym = Utils::OpenHandle(this);
|
||||
|
||||
i::Isolate* isolate;
|
||||
if (!i::Isolate::FromWritableHeapObject(*sym, &isolate)) {
|
||||
if (!i::GetIsolateFromWritableObject(*sym, &isolate)) {
|
||||
// If the Symbol is in RO_SPACE, then its name must be too. Since RO_SPACE
|
||||
// objects are immovable we can use the Handle(Address*) constructor with
|
||||
// the address of the name field in the Symbol object without needing an
|
||||
@ -6495,10 +6496,10 @@ bool v8::String::MakeExternal(v8::String::ExternalStringResource* resource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// It is safe to call FromWritable because SupportsExternalization already
|
||||
// checked that the object is writable.
|
||||
// It is safe to call GetIsolateFromWritableHeapObject because
|
||||
// SupportsExternalization already checked that the object is writable.
|
||||
i::Isolate* isolate;
|
||||
i::Isolate::FromWritableHeapObject(obj, &isolate);
|
||||
i::GetIsolateFromWritableObject(obj, &isolate);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
|
||||
CHECK(resource && resource->data());
|
||||
@ -6524,10 +6525,10 @@ bool v8::String::MakeExternal(
|
||||
return false;
|
||||
}
|
||||
|
||||
// It is safe to call FromWritable because SupportsExternalization already
|
||||
// checked that the object is writable.
|
||||
// It is safe to call GetIsolateFromWritableHeapObject because
|
||||
// SupportsExternalization already checked that the object is writable.
|
||||
i::Isolate* isolate;
|
||||
i::Isolate::FromWritableHeapObject(obj, &isolate);
|
||||
i::GetIsolateFromWritableObject(obj, &isolate);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
|
||||
|
||||
CHECK(resource && resource->data());
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "src/arguments.h"
|
||||
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects-inl.h" // TODO(jkummerow): Just smi-inl.h.
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "src/double.h"
|
||||
#include "src/external-reference-table.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/heap/heap-inl.h" // For MemoryChunk.
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/register-configuration.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "src/external-reference-table.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/heap/heap-inl.h" // For MemoryChunk.
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/register-configuration.h"
|
||||
#include "src/runtime/runtime.h"
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "src/assembler-inl.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/disassembler.h"
|
||||
#include "src/heap/heap-inl.h" // For MemoryAllocator. TODO(jkummerow): Drop.
|
||||
#include "src/isolate.h"
|
||||
#include "src/ostreams.h"
|
||||
#include "src/snapshot/embedded-data.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "src/property-details.h"
|
||||
#include "src/property.h"
|
||||
#include "src/string-stream.h"
|
||||
#include "src/zone/zone-list-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "src/extensions/statistics-extension.h"
|
||||
#include "src/extensions/trigger-failure-extension.h"
|
||||
#include "src/function-kind.h"
|
||||
#include "src/heap/heap.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/math-random.h"
|
||||
#include "src/objects/api-callbacks.h"
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames.h"
|
||||
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/cell.h"
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames.h"
|
||||
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/cell.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "src/code-stub-assembler.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/heap/factory-inl.h"
|
||||
#include "src/objects/allocation-site-inl.h"
|
||||
#include "src/objects/arguments-inl.h"
|
||||
#include "src/objects/property-cell.h"
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/conversions.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // For ToBoolean. TODO(jkummerow): Drop.
|
||||
#include "src/maybe-handles-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/js-array-buffer-inl.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "src/builtins/builtins-utils-inl.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // For ToBoolean. TODO(jkummerow): Drop.
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "src/builtins/builtins-utils-inl.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // For ToBoolean.
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/frame-array-inl.h"
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "src/builtins/builtins-utils-gen.h"
|
||||
#include "src/code-stub-assembler.h"
|
||||
#include "src/heap/factory-inl.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/objects/hash-table-inl.h"
|
||||
#include "src/objects/js-collection.h"
|
||||
#include "torque-generated/builtins-base-from-dsl-gen.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "src/objects/js-weak-refs.h"
|
||||
#include "src/objects/microtask-inl.h"
|
||||
#include "src/objects/promise.h"
|
||||
#include "src/objects/smi-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // For ToBoolean. TODO(jkummerow): Drop.
|
||||
#include "src/keys.h"
|
||||
#include "src/lookup.h"
|
||||
#include "src/message-template.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "src/builtins/builtins-utils-inl.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // For ToBoolean. TODO(jkummerow): Drop.
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/code-factory.h"
|
||||
#include "src/heap/factory-inl.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/objects.h"
|
||||
#include "src/objects/property-cell.h"
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/conversions.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // For ToBoolean. TODO(jkummerow): Drop.
|
||||
#include "src/objects-inl.h"
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
#include "src/objects/intl-objects.h"
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "src/builtins/builtins-utils-inl.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // For public_symbol_table().
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "src/builtins/builtins-utils-inl.h"
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap-inl.h" // For ToBoolean. TODO(jkummerow): Drop.
|
||||
#include "src/json-stringifier.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames.h"
|
||||
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/cell.h"
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames.h"
|
||||
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/mips/constants-mips.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames.h"
|
||||
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/mips64/constants-mips64.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames.h"
|
||||
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/objects/cell.h"
|
||||
#include "src/objects/foreign.h"
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames.h"
|
||||
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/objects/cell.h"
|
||||
#include "src/objects/foreign.h"
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "src/builtins/builtins.h"
|
||||
#include "src/code-events.h"
|
||||
#include "src/compiler/code-assembler.h"
|
||||
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/heap/heap-inl.h" // For MemoryAllocator::code_range.
|
||||
#include "src/interface-descriptors.h"
|
||||
#include "src/interpreter/bytecodes.h"
|
||||
#include "src/interpreter/interpreter-generator.h"
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames.h"
|
||||
// For interpreter_entry_return_pc_offset. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/macro-assembler-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/cell.h"
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/builtins/builtins-descriptors.h"
|
||||
#include "src/ic/ic.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/allocation-site-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "src/code-reference.h"
|
||||
|
||||
#include "src/code-desc.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/frames.h"
|
||||
#include "src/function-kind.h"
|
||||
#include "src/heap/heap-inl.h" // For Page/MemoryChunk. TODO(jkummerow): Drop.
|
||||
#include "src/objects/api-callbacks.h"
|
||||
#include "src/objects/cell.h"
|
||||
#include "src/objects/descriptor-array.h"
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "src/parsing/parse-info.h"
|
||||
#include "src/parsing/parser.h"
|
||||
#include "src/task-utils.h"
|
||||
#include "src/zone/zone-list-inl.h" // crbug.com/v8/8816
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "src/snapshot/code-serializer.h"
|
||||
#include "src/unoptimized-compilation-info.h"
|
||||
#include "src/vm-state-inl.h"
|
||||
#include "src/zone/zone-list-inl.h" // crbug.com/v8/8816
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/allocation-site-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "src/compiler/graph-reducer.h"
|
||||
#include "src/compiler/per-isolate-compiler-cache.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/allocation-site-inl.h"
|
||||
#include "src/objects/cell-inl.h"
|
||||
#include "src/objects/heap-number-inl.h"
|
||||
#include "src/objects/instance-type-inl.h"
|
||||
@ -1452,7 +1453,7 @@ void JSObjectData::SerializeRecursive(JSHeapBroker* broker, int depth) {
|
||||
elements_object->map() == ReadOnlyRoots(isolate).fixed_cow_array_map();
|
||||
if (empty_or_cow) {
|
||||
// We need to make sure copy-on-write elements are tenured.
|
||||
if (Heap::InYoungGeneration(*elements_object)) {
|
||||
if (ObjectInYoungGeneration(*elements_object)) {
|
||||
elements_object = isolate->factory()->CopyAndTenureFixedCOWArray(
|
||||
Handle<FixedArray>::cast(elements_object));
|
||||
boilerplate->set_elements(*elements_object);
|
||||
@ -2030,7 +2031,7 @@ void JSObjectRef::EnsureElementsTenured() {
|
||||
AllowHeapAllocation allow_heap_allocation;
|
||||
|
||||
Handle<FixedArrayBase> object_elements = elements().object();
|
||||
if (Heap::InYoungGeneration(*object_elements)) {
|
||||
if (ObjectInYoungGeneration(*object_elements)) {
|
||||
// If we would like to pretenure a fixed cow array, we must ensure that
|
||||
// the array is already in old space, otherwise we'll create too many
|
||||
// old-to-new-space pointers (overflowing the store buffer).
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/dictionary-inl.h"
|
||||
#include "src/objects/fixed-array-inl.h"
|
||||
#include "src/objects/js-objects-inl.h"
|
||||
#include "src/objects/map-inl.h"
|
||||
#include "src/objects/regexp-match-info.h"
|
||||
#include "src/objects/scope-info.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/global-handles.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/heap/heap-inl.h" // For NextDebuggingId.
|
||||
#include "src/interpreter/bytecode-array-accessor.h"
|
||||
#include "src/interpreter/bytecode-array-iterator.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "src/disasm.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/global-handles.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/log.h"
|
||||
#include "src/macro-assembler.h"
|
||||
@ -276,7 +277,7 @@ class ActivationsFinder : public ThreadVisitor {
|
||||
void Deoptimizer::DeoptimizeMarkedCodeForContext(Context context) {
|
||||
DisallowHeapAllocation no_allocation;
|
||||
|
||||
Isolate* isolate = context->GetHeap()->isolate();
|
||||
Isolate* isolate = context->GetIsolate();
|
||||
Code topmost_optimized_code;
|
||||
bool safe_to_deopt_topmost_optimized_code = false;
|
||||
#ifdef DEBUG
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/conversions.h"
|
||||
#include "src/frames.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/heap/heap-inl.h" // For MaxNumberToStringCacheSize.
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/keys.h"
|
||||
@ -2012,7 +2013,7 @@ class FastElementsAccessor : public ElementsAccessorBase<Subclass, KindTraits> {
|
||||
const int kMinLengthForSparsenessCheck = 64;
|
||||
if (backing_store->length() < kMinLengthForSparsenessCheck) return;
|
||||
// TODO(ulan): Check if it works with young large objects.
|
||||
if (Heap::InYoungGeneration(*backing_store)) return;
|
||||
if (ObjectInYoungGeneration(*backing_store)) return;
|
||||
uint32_t length = 0;
|
||||
if (obj->IsJSArray()) {
|
||||
JSArray::cast(*obj)->length()->ToArrayLength(&length);
|
||||
|
@ -13,7 +13,10 @@
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/elements.h"
|
||||
#include "src/hash-seed-inl.h"
|
||||
#include "src/heap/heap.h"
|
||||
// For IncrementalMarking::RecordWriteFromCode. TODO(jkummerow): Drop.
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/ic/stub-cache.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/isolate.h"
|
||||
@ -650,7 +653,7 @@ FUNCTION_REFERENCE(jsreceiver_create_identity_hash,
|
||||
|
||||
static uint32_t ComputeSeededIntegerHash(Isolate* isolate, uint32_t key) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
return ComputeSeededHash(key, isolate->heap()->HashSeed());
|
||||
return ComputeSeededHash(key, HashSeed(isolate));
|
||||
}
|
||||
|
||||
FUNCTION_REFERENCE(compute_integer_hash, ComputeSeededIntegerHash)
|
||||
@ -699,11 +702,6 @@ ExternalReference::search_string_raw<const uc16, const uint8_t>();
|
||||
template ExternalReference
|
||||
ExternalReference::search_string_raw<const uc16, const uc16>();
|
||||
|
||||
ExternalReference ExternalReference::page_flags(Page* page) {
|
||||
return ExternalReference(reinterpret_cast<Address>(page) +
|
||||
MemoryChunk::kFlagsOffset);
|
||||
}
|
||||
|
||||
ExternalReference ExternalReference::FromRawAddress(Address address) {
|
||||
return ExternalReference(address);
|
||||
}
|
||||
|
@ -287,8 +287,6 @@ class ExternalReference {
|
||||
template <typename SubjectChar, typename PatternChar>
|
||||
static ExternalReference search_string_raw();
|
||||
|
||||
static ExternalReference page_flags(Page* page);
|
||||
|
||||
static ExternalReference FromRawAddress(Address address);
|
||||
|
||||
#define DECL_EXTERNAL_REFERENCE(name, desc) static ExternalReference name();
|
||||
|
@ -6,10 +6,11 @@
|
||||
#define V8_FEEDBACK_VECTOR_INL_H_
|
||||
|
||||
#include "src/feedback-vector.h"
|
||||
|
||||
#include "src/globals.h"
|
||||
#include "src/heap/factory-inl.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/heap-write-barrier.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects/code-inl.h"
|
||||
#include "src/objects/maybe-object-inl.h"
|
||||
#include "src/objects/shared-function-info.h"
|
||||
#include "src/objects/smi.h"
|
||||
|
@ -199,7 +199,7 @@ bool IsInterpreterFramePc(Isolate* isolate, Address pc,
|
||||
// an InterpretedFrame, so we do these fast checks first
|
||||
if (StackFrame::IsTypeMarker(marker) || maybe_function->IsSmi()) {
|
||||
return false;
|
||||
} else if (!isolate->heap()->code_space()->ContainsSlow(pc)) {
|
||||
} else if (!isolate->heap()->InSpaceSlow(pc, CODE_SPACE)) {
|
||||
return false;
|
||||
}
|
||||
interpreter_entry_trampoline =
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/base/compiler-specific.h"
|
||||
#include "src/cancelable-task.h"
|
||||
#include "src/heap/embedder-tracing.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/slots.h"
|
||||
#include "src/task-utils.h"
|
||||
@ -714,7 +715,7 @@ GlobalHandles::~GlobalHandles() { regular_nodes_.reset(nullptr); }
|
||||
|
||||
Handle<Object> GlobalHandles::Create(Object value) {
|
||||
GlobalHandles::Node* result = regular_nodes_->Acquire(value);
|
||||
if (Heap::InYoungGeneration(value) && !result->is_in_young_list()) {
|
||||
if (ObjectInYoungGeneration(value) && !result->is_in_young_list()) {
|
||||
young_nodes_.push_back(result);
|
||||
result->set_in_young_list(true);
|
||||
}
|
||||
@ -727,7 +728,7 @@ Handle<Object> GlobalHandles::Create(Address value) {
|
||||
|
||||
Handle<Object> GlobalHandles::CreateTraced(Object value, Address* slot) {
|
||||
GlobalHandles::TracedNode* result = traced_nodes_->Acquire(value);
|
||||
if (Heap::InYoungGeneration(value) && !result->is_in_young_list()) {
|
||||
if (ObjectInYoungGeneration(value) && !result->is_in_young_list()) {
|
||||
traced_young_nodes_.push_back(result);
|
||||
result->set_in_young_list(true);
|
||||
}
|
||||
@ -1060,7 +1061,7 @@ void GlobalHandles::UpdateAndCompactListOfYoungNode(
|
||||
for (T* node : *node_list) {
|
||||
DCHECK(node->is_in_young_list());
|
||||
if (node->IsInUse()) {
|
||||
if (Heap::InYoungGeneration(node->object())) {
|
||||
if (ObjectInYoungGeneration(node->object())) {
|
||||
(*node_list)[last++] = node;
|
||||
isolate_->heap()->IncrementNodesCopiedInNewSpace();
|
||||
} else {
|
||||
@ -1362,7 +1363,7 @@ void EternalHandles::IterateYoungRoots(RootVisitor* visitor) {
|
||||
void EternalHandles::PostGarbageCollectionProcessing() {
|
||||
size_t last = 0;
|
||||
for (int index : young_node_indices_) {
|
||||
if (Heap::InYoungGeneration(Object(*GetLocation(index)))) {
|
||||
if (ObjectInYoungGeneration(Object(*GetLocation(index)))) {
|
||||
young_node_indices_[last++] = index;
|
||||
}
|
||||
}
|
||||
@ -1385,7 +1386,7 @@ void EternalHandles::Create(Isolate* isolate, Object object, int* index) {
|
||||
}
|
||||
DCHECK_EQ(the_hole->ptr(), blocks_[block][offset]);
|
||||
blocks_[block][offset] = object->ptr();
|
||||
if (Heap::InYoungGeneration(object)) {
|
||||
if (ObjectInYoungGeneration(object)) {
|
||||
young_node_indices_.push_back(size_);
|
||||
}
|
||||
*index = size_++;
|
||||
|
@ -12,6 +12,11 @@
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/roots-inl.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
// For GetIsolateFromWritableHeapObject.
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#endif
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
@ -29,7 +34,7 @@ bool HandleBase::IsDereferenceAllowed(DereferenceCheckMode mode) const {
|
||||
if (object->IsSmi()) return true;
|
||||
HeapObject heap_object = HeapObject::cast(object);
|
||||
Isolate* isolate;
|
||||
if (!Isolate::FromWritableHeapObject(heap_object, &isolate)) return true;
|
||||
if (!GetIsolateFromWritableObject(heap_object, &isolate)) return true;
|
||||
RootIndex root_index;
|
||||
if (isolate->roots_table().IsRootHandleLocation(location_, &root_index) &&
|
||||
RootsTable::IsImmortalImmovable(root_index)) {
|
||||
|
44
src/hash-seed-inl.h
Normal file
44
src/hash-seed-inl.h
Normal file
@ -0,0 +1,44 @@
|
||||
// Copyright 2019 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_HASH_SEED_INL_H_
|
||||
#define V8_HASH_SEED_INL_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// The #includes below currently lead to cyclic transitive includes, so
|
||||
// HashSeed() ends up being required before it is defined, so we have to
|
||||
// declare it here. This is a workaround; if we needed this permanently then
|
||||
// we should put that line into a "hash-seed.h" header; but we won't need
|
||||
// it for long.
|
||||
// TODO(jkummerow): Get rid of this by breaking circular include dependencies.
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
class Isolate;
|
||||
|
||||
inline uint64_t HashSeed(Isolate* isolate);
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
// See comment above for why this isn't at the top of the file.
|
||||
#include "src/objects/fixed-array-inl.h"
|
||||
#include "src/roots-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
inline uint64_t HashSeed(Isolate* isolate) {
|
||||
uint64_t seed;
|
||||
ReadOnlyRoots(isolate).hash_seed()->copy_out(
|
||||
0, reinterpret_cast<byte*>(&seed), kInt64Size);
|
||||
DCHECK(FLAG_randomize_hashes || seed == 0);
|
||||
return seed;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_HASH_SEED_INL_H_
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include "src/conversions-inl.h"
|
||||
#include "src/heap/array-buffer-tracker.h"
|
||||
#include "src/heap/heap.h"
|
||||
#include "src/heap/spaces.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/spaces-inl.h"
|
||||
#include "src/objects.h"
|
||||
#include "src/objects/js-array-buffer-inl.h"
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "src/heap/code-stats.h"
|
||||
|
||||
#include "src/code-comments.h"
|
||||
#include "src/heap/spaces-inl.h" // For HeapObjectIterator.
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/reloc-info.h"
|
||||
|
||||
|
@ -12,8 +12,10 @@
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/feedback-cell.h"
|
||||
#include "src/objects/heap-number-inl.h"
|
||||
#include "src/objects/oddball.h"
|
||||
#include "src/objects/string-inl.h"
|
||||
#include "src/string-hasher.h"
|
||||
|
||||
namespace v8 {
|
||||
|
@ -14,11 +14,15 @@
|
||||
#include "src/compiler.h"
|
||||
#include "src/conversions.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/hash-seed-inl.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/incremental-marking.h"
|
||||
#include "src/heap/mark-compact-inl.h"
|
||||
#include "src/ic/handler-configuration-inl.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/log.h"
|
||||
#include "src/objects/allocation-site-inl.h"
|
||||
#include "src/objects/api-callbacks.h"
|
||||
#include "src/objects/arguments-inl.h"
|
||||
#include "src/objects/bigint.h"
|
||||
@ -607,12 +611,12 @@ Handle<AccessorPair> Factory::NewAccessorPair() {
|
||||
|
||||
// Internalized strings are created in the old generation (data space).
|
||||
Handle<String> Factory::InternalizeUtf8String(Vector<const char> string) {
|
||||
Utf8StringKey key(string, isolate()->heap()->HashSeed());
|
||||
Utf8StringKey key(string, HashSeed(isolate()));
|
||||
return InternalizeStringWithKey(&key);
|
||||
}
|
||||
|
||||
Handle<String> Factory::InternalizeOneByteString(Vector<const uint8_t> string) {
|
||||
OneByteStringKey key(string, isolate()->heap()->HashSeed());
|
||||
OneByteStringKey key(string, HashSeed(isolate()));
|
||||
return InternalizeStringWithKey(&key);
|
||||
}
|
||||
|
||||
@ -623,7 +627,7 @@ Handle<String> Factory::InternalizeOneByteString(
|
||||
}
|
||||
|
||||
Handle<String> Factory::InternalizeTwoByteString(Vector<const uc16> string) {
|
||||
TwoByteStringKey key(string, isolate()->heap()->HashSeed());
|
||||
TwoByteStringKey key(string, HashSeed(isolate()));
|
||||
return InternalizeStringWithKey(&key);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/heap/heap-controller.h"
|
||||
|
||||
#include "src/heap/spaces.h"
|
||||
#include "src/isolate-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
@ -73,7 +75,7 @@ size_t MemoryController::CalculateAllocationLimit(
|
||||
double factor = GrowingFactor(gc_speed, mutator_speed, max_factor);
|
||||
|
||||
if (FLAG_trace_gc_verbose) {
|
||||
heap_->isolate()->PrintWithTimestamp(
|
||||
Isolate::FromHeap(heap_)->PrintWithTimestamp(
|
||||
"%s factor %.1f based on mu=%.3f, speed_ratio=%.f "
|
||||
"(gc=%.f, mutator=%.f)\n",
|
||||
ControllerName(), factor, target_mutator_utilization_,
|
||||
@ -104,7 +106,7 @@ size_t MemoryController::CalculateAllocationLimit(
|
||||
size_t result = static_cast<size_t>(Min(limit, halfway_to_the_max));
|
||||
|
||||
if (FLAG_trace_gc_verbose) {
|
||||
heap_->isolate()->PrintWithTimestamp(
|
||||
Isolate::FromHeap(heap_)->PrintWithTimestamp(
|
||||
"%s Limit: old size: %" PRIuS " KB, new limit: %" PRIuS " KB (%.1f)\n",
|
||||
ControllerName(), curr_size / KB, result / KB, factor);
|
||||
}
|
||||
|
@ -294,19 +294,6 @@ void Heap::RegisterExternalString(String string) {
|
||||
external_string_table_.AddString(string);
|
||||
}
|
||||
|
||||
void Heap::UpdateExternalString(String string, size_t old_payload,
|
||||
size_t new_payload) {
|
||||
DCHECK(string->IsExternalString());
|
||||
Page* page = Page::FromHeapObject(string);
|
||||
|
||||
if (old_payload > new_payload)
|
||||
page->DecrementExternalBackingStoreBytes(
|
||||
ExternalBackingStoreType::kExternalString, old_payload - new_payload);
|
||||
else
|
||||
page->IncrementExternalBackingStoreBytes(
|
||||
ExternalBackingStoreType::kExternalString, new_payload - old_payload);
|
||||
}
|
||||
|
||||
void Heap::FinalizeExternalString(String string) {
|
||||
DCHECK(string->IsExternalString());
|
||||
Page* page = Page::FromHeapObject(string);
|
||||
@ -553,14 +540,6 @@ Oddball Heap::ToBoolean(bool condition) {
|
||||
return condition ? roots.true_value() : roots.false_value();
|
||||
}
|
||||
|
||||
uint64_t Heap::HashSeed() {
|
||||
uint64_t seed;
|
||||
ReadOnlyRoots(this).hash_seed()->copy_out(0, reinterpret_cast<byte*>(&seed),
|
||||
kInt64Size);
|
||||
DCHECK(FLAG_randomize_hashes || seed == 0);
|
||||
return seed;
|
||||
}
|
||||
|
||||
int Heap::NextScriptId() {
|
||||
int last_id = last_script_id()->value();
|
||||
if (last_id == Smi::kMaxValue) last_id = v8::UnboundScript::kNoScriptId;
|
||||
|
@ -11,8 +11,11 @@
|
||||
#include "src/heap/heap-write-barrier.h"
|
||||
|
||||
#include "src/globals.h"
|
||||
#include "src/heap/heap.h"
|
||||
// TODO(jkummerow): Get rid of this by moving GetIsolateFromWritableObject
|
||||
// elsewhere.
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects/code.h"
|
||||
#include "src/objects/fixed-array.h"
|
||||
#include "src/objects/heap-object.h"
|
||||
#include "src/objects/maybe-object-inl.h"
|
||||
#include "src/objects/slots.h"
|
||||
@ -20,14 +23,48 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// Defined in heap.cc.
|
||||
V8_EXPORT_PRIVATE bool Heap_PageFlagsAreConsistent(HeapObject object);
|
||||
V8_EXPORT_PRIVATE void Heap_GenerationalBarrierSlow(HeapObject object,
|
||||
Address slot,
|
||||
HeapObject value);
|
||||
V8_EXPORT_PRIVATE void Heap_MarkingBarrierSlow(HeapObject object, Address slot,
|
||||
HeapObject value);
|
||||
V8_EXPORT_PRIVATE void Heap_WriteBarrierForCodeSlow(Code host);
|
||||
V8_EXPORT_PRIVATE void Heap_GenerationalBarrierForCodeSlow(Code host,
|
||||
RelocInfo* rinfo,
|
||||
HeapObject object);
|
||||
V8_EXPORT_PRIVATE void Heap_MarkingBarrierForCodeSlow(Code host,
|
||||
RelocInfo* rinfo,
|
||||
HeapObject object);
|
||||
V8_EXPORT_PRIVATE void Heap_GenerationalBarrierForElementsSlow(Heap* heap,
|
||||
FixedArray array,
|
||||
int offset,
|
||||
int length);
|
||||
V8_EXPORT_PRIVATE void Heap_MarkingBarrierForElementsSlow(Heap* heap,
|
||||
HeapObject object);
|
||||
V8_EXPORT_PRIVATE void Heap_MarkingBarrierForDescriptorArraySlow(
|
||||
Heap* heap, HeapObject host, HeapObject descriptor_array,
|
||||
int number_of_own_descriptors);
|
||||
|
||||
// Do not use these internal details anywhere outside of this file. These
|
||||
// internals are only intended to shortcut write barrier checks.
|
||||
namespace heap_internals {
|
||||
|
||||
struct Space {
|
||||
static constexpr uintptr_t kIdOffset = 9 * kSystemPointerSize;
|
||||
V8_INLINE AllocationSpace identity() {
|
||||
return *reinterpret_cast<AllocationSpace*>(reinterpret_cast<Address>(this) +
|
||||
kIdOffset);
|
||||
}
|
||||
};
|
||||
|
||||
struct MemoryChunk {
|
||||
static constexpr uintptr_t kFlagsOffset = sizeof(size_t);
|
||||
static constexpr uintptr_t kHeapOffset =
|
||||
kFlagsOffset + kUIntptrSize + 4 * kSystemPointerSize;
|
||||
static constexpr uintptr_t kOwnerOffset =
|
||||
kHeapOffset + 2 * kSystemPointerSize;
|
||||
static constexpr uintptr_t kMarkingBit = uintptr_t{1} << 18;
|
||||
static constexpr uintptr_t kFromPageBit = uintptr_t{1} << 3;
|
||||
static constexpr uintptr_t kToPageBit = uintptr_t{1} << 4;
|
||||
@ -55,31 +92,37 @@ struct MemoryChunk {
|
||||
SLOW_DCHECK(heap != nullptr);
|
||||
return heap;
|
||||
}
|
||||
|
||||
V8_INLINE Space* GetOwner() {
|
||||
return *reinterpret_cast<Space**>(reinterpret_cast<Address>(this) +
|
||||
kOwnerOffset);
|
||||
}
|
||||
};
|
||||
|
||||
inline void GenerationalBarrierInternal(HeapObject object, Address slot,
|
||||
HeapObject value) {
|
||||
DCHECK(Heap::PageFlagsAreConsistent(object));
|
||||
DCHECK(Heap_PageFlagsAreConsistent(object));
|
||||
heap_internals::MemoryChunk* value_chunk =
|
||||
heap_internals::MemoryChunk::FromHeapObject(value);
|
||||
heap_internals::MemoryChunk* object_chunk =
|
||||
heap_internals::MemoryChunk::FromHeapObject(object);
|
||||
|
||||
if (!value_chunk->InYoungGeneration() || object_chunk->InYoungGeneration())
|
||||
if (!value_chunk->InYoungGeneration() || object_chunk->InYoungGeneration()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Heap::GenerationalBarrierSlow(object, slot, value);
|
||||
Heap_GenerationalBarrierSlow(object, slot, value);
|
||||
}
|
||||
|
||||
inline void MarkingBarrierInternal(HeapObject object, Address slot,
|
||||
HeapObject value) {
|
||||
DCHECK(Heap::PageFlagsAreConsistent(object));
|
||||
DCHECK(Heap_PageFlagsAreConsistent(object));
|
||||
heap_internals::MemoryChunk* value_chunk =
|
||||
heap_internals::MemoryChunk::FromHeapObject(value);
|
||||
|
||||
if (!value_chunk->IsMarking()) return;
|
||||
|
||||
Heap::MarkingBarrierSlow(object, slot, value);
|
||||
Heap_MarkingBarrierSlow(object, slot, value);
|
||||
}
|
||||
|
||||
} // namespace heap_internals
|
||||
@ -93,7 +136,7 @@ inline void WriteBarrierForCode(Code host, RelocInfo* rinfo, Object value) {
|
||||
}
|
||||
|
||||
inline void WriteBarrierForCode(Code host) {
|
||||
Heap::WriteBarrierForCodeSlow(host);
|
||||
Heap_WriteBarrierForCodeSlow(host);
|
||||
}
|
||||
|
||||
inline void GenerationalBarrier(HeapObject object, ObjectSlot slot,
|
||||
@ -119,7 +162,7 @@ inline void GenerationalBarrierForElements(Heap* heap, FixedArray array,
|
||||
heap_internals::MemoryChunk::FromHeapObject(array);
|
||||
if (array_chunk->InYoungGeneration()) return;
|
||||
|
||||
Heap::GenerationalBarrierForElementsSlow(heap, array, offset, length);
|
||||
Heap_GenerationalBarrierForElementsSlow(heap, array, offset, length);
|
||||
}
|
||||
|
||||
inline void GenerationalBarrierForCode(Code host, RelocInfo* rinfo,
|
||||
@ -127,7 +170,7 @@ inline void GenerationalBarrierForCode(Code host, RelocInfo* rinfo,
|
||||
heap_internals::MemoryChunk* object_chunk =
|
||||
heap_internals::MemoryChunk::FromHeapObject(object);
|
||||
if (!object_chunk->InYoungGeneration()) return;
|
||||
Heap::GenerationalBarrierForCodeSlow(host, rinfo, object);
|
||||
Heap_GenerationalBarrierForCodeSlow(host, rinfo, object);
|
||||
}
|
||||
|
||||
inline void MarkingBarrier(HeapObject object, ObjectSlot slot, Object value) {
|
||||
@ -151,7 +194,7 @@ inline void MarkingBarrierForElements(Heap* heap, HeapObject object) {
|
||||
heap_internals::MemoryChunk::FromHeapObject(object);
|
||||
if (!object_chunk->IsMarking()) return;
|
||||
|
||||
Heap::MarkingBarrierForElementsSlow(heap, object);
|
||||
Heap_MarkingBarrierForElementsSlow(heap, object);
|
||||
}
|
||||
|
||||
inline void MarkingBarrierForCode(Code host, RelocInfo* rinfo,
|
||||
@ -160,7 +203,7 @@ inline void MarkingBarrierForCode(Code host, RelocInfo* rinfo,
|
||||
heap_internals::MemoryChunk* object_chunk =
|
||||
heap_internals::MemoryChunk::FromHeapObject(object);
|
||||
if (!object_chunk->IsMarking()) return;
|
||||
Heap::MarkingBarrierForCodeSlow(host, rinfo, object);
|
||||
Heap_MarkingBarrierForCodeSlow(host, rinfo, object);
|
||||
}
|
||||
|
||||
inline void MarkingBarrierForDescriptorArray(Heap* heap, HeapObject host,
|
||||
@ -170,8 +213,24 @@ inline void MarkingBarrierForDescriptorArray(Heap* heap, HeapObject host,
|
||||
heap_internals::MemoryChunk::FromHeapObject(descriptor_array);
|
||||
if (!chunk->IsMarking()) return;
|
||||
|
||||
Heap::MarkingBarrierForDescriptorArraySlow(heap, host, descriptor_array,
|
||||
number_of_own_descriptors);
|
||||
Heap_MarkingBarrierForDescriptorArraySlow(heap, host, descriptor_array,
|
||||
number_of_own_descriptors);
|
||||
}
|
||||
|
||||
inline WriteBarrierMode GetWriteBarrierModeForObject(
|
||||
HeapObject object, const DisallowHeapAllocation* promise) {
|
||||
DCHECK(Heap_PageFlagsAreConsistent(object));
|
||||
heap_internals::MemoryChunk* chunk =
|
||||
heap_internals::MemoryChunk::FromHeapObject(object);
|
||||
if (chunk->IsMarking()) return UPDATE_WRITE_BARRIER;
|
||||
if (chunk->InYoungGeneration()) return SKIP_WRITE_BARRIER;
|
||||
return UPDATE_WRITE_BARRIER;
|
||||
}
|
||||
|
||||
inline bool ObjectInYoungGeneration(const Object object) {
|
||||
if (object.IsSmi()) return false;
|
||||
return heap_internals::MemoryChunk::FromHeapObject(HeapObject::cast(object))
|
||||
->InYoungGeneration();
|
||||
}
|
||||
|
||||
inline Heap* GetHeapFromWritableObject(const HeapObject object) {
|
||||
@ -180,6 +239,17 @@ inline Heap* GetHeapFromWritableObject(const HeapObject object) {
|
||||
return chunk->GetHeap();
|
||||
}
|
||||
|
||||
inline bool GetIsolateFromWritableObject(HeapObject obj, Isolate** isolate) {
|
||||
heap_internals::MemoryChunk* chunk =
|
||||
heap_internals::MemoryChunk::FromHeapObject(obj);
|
||||
if (chunk->GetOwner()->identity() == RO_SPACE) {
|
||||
*isolate = nullptr;
|
||||
return false;
|
||||
}
|
||||
*isolate = Isolate::FromHeap(chunk->GetHeap());
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
|
@ -75,6 +75,52 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
// These are outside the Heap class so they can be forward-declared
|
||||
// in heap-write-barrier-inl.h.
|
||||
bool Heap_PageFlagsAreConsistent(HeapObject object) {
|
||||
return Heap::PageFlagsAreConsistent(object);
|
||||
}
|
||||
|
||||
void Heap_GenerationalBarrierSlow(HeapObject object, Address slot,
|
||||
HeapObject value) {
|
||||
Heap::GenerationalBarrierSlow(object, slot, value);
|
||||
}
|
||||
|
||||
void Heap_MarkingBarrierSlow(HeapObject object, Address slot,
|
||||
HeapObject value) {
|
||||
Heap::MarkingBarrierSlow(object, slot, value);
|
||||
}
|
||||
|
||||
void Heap_WriteBarrierForCodeSlow(Code host) {
|
||||
Heap::WriteBarrierForCodeSlow(host);
|
||||
}
|
||||
|
||||
void Heap_GenerationalBarrierForCodeSlow(Code host, RelocInfo* rinfo,
|
||||
HeapObject object) {
|
||||
Heap::GenerationalBarrierForCodeSlow(host, rinfo, object);
|
||||
}
|
||||
|
||||
void Heap_MarkingBarrierForCodeSlow(Code host, RelocInfo* rinfo,
|
||||
HeapObject object) {
|
||||
Heap::MarkingBarrierForCodeSlow(host, rinfo, object);
|
||||
}
|
||||
|
||||
void Heap_GenerationalBarrierForElementsSlow(Heap* heap, FixedArray array,
|
||||
int offset, int length) {
|
||||
Heap::GenerationalBarrierForElementsSlow(heap, array, offset, length);
|
||||
}
|
||||
|
||||
void Heap_MarkingBarrierForElementsSlow(Heap* heap, HeapObject object) {
|
||||
Heap::MarkingBarrierForElementsSlow(heap, object);
|
||||
}
|
||||
|
||||
void Heap_MarkingBarrierForDescriptorArraySlow(Heap* heap, HeapObject host,
|
||||
HeapObject descriptor_array,
|
||||
int number_of_own_descriptors) {
|
||||
Heap::MarkingBarrierForDescriptorArraySlow(heap, host, descriptor_array,
|
||||
number_of_own_descriptors);
|
||||
}
|
||||
|
||||
void Heap::SetArgumentsAdaptorDeoptPCOffset(int pc_offset) {
|
||||
DCHECK_EQ(Smi::kZero, arguments_adaptor_deopt_pc_offset());
|
||||
set_arguments_adaptor_deopt_pc_offset(Smi::FromInt(pc_offset));
|
||||
@ -2095,6 +2141,20 @@ bool Heap::ExternalStringTable::Contains(String string) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Heap::UpdateExternalString(String string, size_t old_payload,
|
||||
size_t new_payload) {
|
||||
DCHECK(string->IsExternalString());
|
||||
Page* page = Page::FromHeapObject(string);
|
||||
|
||||
if (old_payload > new_payload) {
|
||||
page->DecrementExternalBackingStoreBytes(
|
||||
ExternalBackingStoreType::kExternalString, old_payload - new_payload);
|
||||
} else {
|
||||
page->IncrementExternalBackingStoreBytes(
|
||||
ExternalBackingStoreType::kExternalString, new_payload - old_payload);
|
||||
}
|
||||
}
|
||||
|
||||
String Heap::UpdateYoungReferenceInExternalStringTableEntry(Heap* heap,
|
||||
FullObjectSlot p) {
|
||||
HeapObject obj = HeapObject::cast(*p);
|
||||
@ -5807,6 +5867,9 @@ static_assert(MemoryChunk::kFlagsOffset ==
|
||||
static_assert(MemoryChunk::kHeapOffset ==
|
||||
heap_internals::MemoryChunk::kHeapOffset,
|
||||
"Heap offset inconsistent");
|
||||
static_assert(MemoryChunk::kOwnerOffset ==
|
||||
heap_internals::MemoryChunk::kOwnerOffset,
|
||||
"Owner offset inconsistent");
|
||||
|
||||
void Heap::SetEmbedderStackStateForNextFinalizaton(
|
||||
EmbedderHeapTracer::EmbedderStackState stack_state) {
|
||||
|
@ -509,8 +509,6 @@ class Heap {
|
||||
|
||||
void IncrementDeferredCount(v8::Isolate::UseCounterFeature feature);
|
||||
|
||||
inline uint64_t HashSeed();
|
||||
|
||||
inline int NextScriptId();
|
||||
inline int NextDebuggingId();
|
||||
inline int GetNextTemplateSerialNumber();
|
||||
@ -894,8 +892,8 @@ class Heap {
|
||||
|
||||
// Called when a string's resource is changed. The size of the payload is sent
|
||||
// as argument of the method.
|
||||
inline void UpdateExternalString(String string, size_t old_payload,
|
||||
size_t new_payload);
|
||||
void UpdateExternalString(String string, size_t old_payload,
|
||||
size_t new_payload);
|
||||
|
||||
// Finalizes an external string by deleting the associated external
|
||||
// data and clearing the resource pointer.
|
||||
|
@ -5,9 +5,12 @@
|
||||
#ifndef V8_HEAP_MARK_COMPACT_INL_H_
|
||||
#define V8_HEAP_MARK_COMPACT_INL_H_
|
||||
|
||||
#include "src/heap/mark-compact.h"
|
||||
|
||||
#include "src/assembler-inl.h"
|
||||
#include "src/base/bits.h"
|
||||
#include "src/heap/mark-compact.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/incremental-marking.h"
|
||||
#include "src/heap/objects-visiting-inl.h"
|
||||
#include "src/heap/remembered-set.h"
|
||||
#include "src/objects/js-collection-inl.h"
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "src/contexts.h"
|
||||
#include "src/heap-symbols.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/heap/heap.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/ic/handler-configuration.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/isolate.h"
|
||||
|
@ -5,11 +5,13 @@
|
||||
#ifndef V8_HEAP_SPACES_INL_H_
|
||||
#define V8_HEAP_SPACES_INL_H_
|
||||
|
||||
#include "src/heap/spaces.h"
|
||||
|
||||
#include "src/base/atomic-utils.h"
|
||||
#include "src/base/bounded-page-allocator.h"
|
||||
#include "src/base/v8-fallthrough.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/incremental-marking.h"
|
||||
#include "src/heap/spaces.h"
|
||||
#include "src/msan.h"
|
||||
#include "src/objects/code-inl.h"
|
||||
|
||||
|
@ -670,6 +670,8 @@ MemoryChunk* MemoryChunk::Initialize(Heap* heap, Address base, size_t size,
|
||||
}
|
||||
|
||||
DCHECK_EQ(kFlagsOffset, OFFSET_OF(MemoryChunk, flags_));
|
||||
DCHECK_EQ(kHeapOffset, OFFSET_OF(MemoryChunk, heap_));
|
||||
DCHECK_EQ(kOwnerOffset, OFFSET_OF(MemoryChunk, owner_));
|
||||
|
||||
if (executable == EXECUTABLE) {
|
||||
chunk->SetFlag(IS_EXECUTABLE);
|
||||
@ -1464,6 +1466,12 @@ void MemoryChunk::ReleaseMarkingBitmap() {
|
||||
// -----------------------------------------------------------------------------
|
||||
// PagedSpace implementation
|
||||
|
||||
void Space::CheckOffsetsAreConsistent() const {
|
||||
static_assert(Space::kIdOffset == heap_internals::Space::kIdOffset,
|
||||
"ID offset inconsistent");
|
||||
DCHECK_EQ(Space::kIdOffset, OFFSET_OF(Space, id_));
|
||||
}
|
||||
|
||||
void Space::AddAllocationObserver(AllocationObserver* observer) {
|
||||
allocation_observers_.push_back(observer);
|
||||
StartNextInlineAllocationStep();
|
||||
|
@ -114,11 +114,6 @@ class Space;
|
||||
|
||||
// Some assertion macros used in the debugging mode.
|
||||
|
||||
#define DCHECK_PAGE_ALIGNED(address) DCHECK_EQ(0, (address)&kPageAlignmentMask)
|
||||
|
||||
#define DCHECK_OBJECT_ALIGNED(address) \
|
||||
DCHECK_EQ(0, (address)&kObjectAlignmentMask)
|
||||
|
||||
#define DCHECK_OBJECT_SIZE(size) \
|
||||
DCHECK((0 < size) && (size <= kMaxRegularHeapObjectSize))
|
||||
|
||||
@ -370,6 +365,8 @@ class MemoryChunk {
|
||||
kReservationOffset + 3 * kSystemPointerSize;
|
||||
static const intptr_t kHeaderSentinelOffset =
|
||||
kHeapOffset + kSystemPointerSize;
|
||||
static const intptr_t kOwnerOffset =
|
||||
kHeaderSentinelOffset + kSystemPointerSize;
|
||||
|
||||
static const size_t kHeaderSize =
|
||||
kSizeOffset // NOLINT
|
||||
@ -709,13 +706,13 @@ class MemoryChunk {
|
||||
// guaranteed to not contain such a pointer.
|
||||
Address header_sentinel_;
|
||||
|
||||
// The space owning this memory chunk.
|
||||
std::atomic<Space*> owner_;
|
||||
|
||||
// Start and end of allocatable memory on this chunk.
|
||||
Address area_start_;
|
||||
Address area_end_;
|
||||
|
||||
// The space owning this memory chunk.
|
||||
std::atomic<Space*> owner_;
|
||||
|
||||
// Used by the incremental marker to keep track of the scanning progress in
|
||||
// large objects that have a progress bar and are scanned in increments.
|
||||
std::atomic<intptr_t> progress_bar_;
|
||||
@ -981,8 +978,11 @@ class Space : public Malloced {
|
||||
external_backing_store_bytes_[ExternalBackingStoreType::kArrayBuffer] = 0;
|
||||
external_backing_store_bytes_[ExternalBackingStoreType::kExternalString] =
|
||||
0;
|
||||
CheckOffsetsAreConsistent();
|
||||
}
|
||||
|
||||
void CheckOffsetsAreConsistent() const;
|
||||
|
||||
static inline void MoveExternalBackingStoreBytes(
|
||||
ExternalBackingStoreType type, Space* from, Space* to, size_t amount);
|
||||
|
||||
@ -1092,6 +1092,8 @@ class Space : public Malloced {
|
||||
std::atomic<size_t>* external_backing_store_bytes_;
|
||||
|
||||
private:
|
||||
static const intptr_t kIdOffset = 9 * kSystemPointerSize;
|
||||
|
||||
bool allocation_observers_paused_;
|
||||
Heap* heap_;
|
||||
AllocationSpace id_;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "src/external-reference-table.h"
|
||||
#include "src/frame-constants.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/heap/heap-inl.h" // For MemoryChunk.
|
||||
#include "src/ia32/assembler-ia32-inl.h"
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/runtime/runtime.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/base/bits.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/heap/heap.h"
|
||||
#include "src/heap/heap-inl.h" // For InYoungGeneration().
|
||||
#include "src/ic/ic-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
|
@ -5,7 +5,6 @@
|
||||
#ifndef V8_ISOLATE_INL_H_
|
||||
#define V8_ISOLATE_INL_H_
|
||||
|
||||
#include "src/heap/heap-inl.h" // Need MemoryChunk from heap/spaces.h
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/cell-inl.h"
|
||||
@ -21,16 +20,6 @@ IsolateAllocationMode Isolate::isolate_allocation_mode() {
|
||||
return isolate_allocator_->mode();
|
||||
}
|
||||
|
||||
bool Isolate::FromWritableHeapObject(HeapObject obj, Isolate** isolate) {
|
||||
i::MemoryChunk* chunk = i::MemoryChunk::FromHeapObject(obj);
|
||||
if (chunk->owner()->identity() == i::RO_SPACE) {
|
||||
*isolate = nullptr;
|
||||
return false;
|
||||
}
|
||||
*isolate = chunk->heap()->isolate();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Isolate::set_context(Context context) {
|
||||
DCHECK(context.is_null() || context->IsContext());
|
||||
thread_local_top_.context_ = context;
|
||||
@ -128,7 +117,8 @@ NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_FIELD_ACCESSOR)
|
||||
#undef NATIVE_CONTEXT_FIELD_ACCESSOR
|
||||
|
||||
bool Isolate::IsArrayConstructorIntact() {
|
||||
Cell array_constructor_cell = heap()->array_constructor_protector();
|
||||
Cell array_constructor_cell =
|
||||
Cell::cast(root(RootIndex::kArrayConstructorProtector));
|
||||
return array_constructor_cell->value() == Smi::FromInt(kProtectorValid);
|
||||
}
|
||||
|
||||
@ -145,56 +135,65 @@ bool Isolate::IsArraySpeciesLookupChainIntact() {
|
||||
// done here. In place, there are mjsunit tests harmony/array-species* which
|
||||
// ensure that behavior is correct in various invalid protector cases.
|
||||
|
||||
PropertyCell species_cell = heap()->array_species_protector();
|
||||
PropertyCell species_cell =
|
||||
PropertyCell::cast(root(RootIndex::kArraySpeciesProtector));
|
||||
return species_cell->value()->IsSmi() &&
|
||||
Smi::ToInt(species_cell->value()) == kProtectorValid;
|
||||
}
|
||||
|
||||
bool Isolate::IsTypedArraySpeciesLookupChainIntact() {
|
||||
PropertyCell species_cell = heap()->typed_array_species_protector();
|
||||
PropertyCell species_cell =
|
||||
PropertyCell::cast(root(RootIndex::kTypedArraySpeciesProtector));
|
||||
return species_cell->value()->IsSmi() &&
|
||||
Smi::ToInt(species_cell->value()) == kProtectorValid;
|
||||
}
|
||||
|
||||
bool Isolate::IsRegExpSpeciesLookupChainIntact() {
|
||||
PropertyCell species_cell = heap()->regexp_species_protector();
|
||||
PropertyCell species_cell =
|
||||
PropertyCell::cast(root(RootIndex::kRegExpSpeciesProtector));
|
||||
return species_cell->value()->IsSmi() &&
|
||||
Smi::ToInt(species_cell->value()) == kProtectorValid;
|
||||
}
|
||||
|
||||
bool Isolate::IsPromiseSpeciesLookupChainIntact() {
|
||||
PropertyCell species_cell = heap()->promise_species_protector();
|
||||
PropertyCell species_cell =
|
||||
PropertyCell::cast(root(RootIndex::kPromiseSpeciesProtector));
|
||||
return species_cell->value()->IsSmi() &&
|
||||
Smi::ToInt(species_cell->value()) == kProtectorValid;
|
||||
}
|
||||
|
||||
bool Isolate::IsStringLengthOverflowIntact() {
|
||||
Cell string_length_cell = heap()->string_length_protector();
|
||||
Cell string_length_cell = Cell::cast(root(RootIndex::kStringLengthProtector));
|
||||
return string_length_cell->value() == Smi::FromInt(kProtectorValid);
|
||||
}
|
||||
|
||||
bool Isolate::IsArrayBufferDetachingIntact() {
|
||||
PropertyCell buffer_detaching = heap()->array_buffer_detaching_protector();
|
||||
PropertyCell buffer_detaching =
|
||||
PropertyCell::cast(root(RootIndex::kArrayBufferDetachingProtector));
|
||||
return buffer_detaching->value() == Smi::FromInt(kProtectorValid);
|
||||
}
|
||||
|
||||
bool Isolate::IsArrayIteratorLookupChainIntact() {
|
||||
PropertyCell array_iterator_cell = heap()->array_iterator_protector();
|
||||
PropertyCell array_iterator_cell =
|
||||
PropertyCell::cast(root(RootIndex::kArrayIteratorProtector));
|
||||
return array_iterator_cell->value() == Smi::FromInt(kProtectorValid);
|
||||
}
|
||||
|
||||
bool Isolate::IsMapIteratorLookupChainIntact() {
|
||||
PropertyCell map_iterator_cell = heap()->map_iterator_protector();
|
||||
PropertyCell map_iterator_cell =
|
||||
PropertyCell::cast(root(RootIndex::kMapIteratorProtector));
|
||||
return map_iterator_cell->value() == Smi::FromInt(kProtectorValid);
|
||||
}
|
||||
|
||||
bool Isolate::IsSetIteratorLookupChainIntact() {
|
||||
PropertyCell set_iterator_cell = heap()->set_iterator_protector();
|
||||
PropertyCell set_iterator_cell =
|
||||
PropertyCell::cast(root(RootIndex::kSetIteratorProtector));
|
||||
return set_iterator_cell->value() == Smi::FromInt(kProtectorValid);
|
||||
}
|
||||
|
||||
bool Isolate::IsStringIteratorLookupChainIntact() {
|
||||
PropertyCell string_iterator_cell = heap()->string_iterator_protector();
|
||||
PropertyCell string_iterator_cell =
|
||||
PropertyCell::cast(root(RootIndex::kStringIteratorProtector));
|
||||
return string_iterator_cell->value() == Smi::FromInt(kProtectorValid);
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,8 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/elements.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/hash-seed-inl.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/ic/stub-cache.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/isolate-inl.h"
|
||||
@ -52,6 +54,7 @@
|
||||
#include "src/objects/smi.h"
|
||||
#include "src/objects/stack-frame-info-inl.h"
|
||||
#include "src/ostreams.h"
|
||||
#include "src/profiler/heap-profiler.h"
|
||||
#include "src/profiler/tracing-cpu-profiler.h"
|
||||
#include "src/prototype.h"
|
||||
#include "src/ptr-compr.h"
|
||||
@ -3472,7 +3475,7 @@ bool Isolate::Init(StartupDeserializer* des) {
|
||||
|
||||
{
|
||||
HandleScope scope(this);
|
||||
ast_string_constants_ = new AstStringConstants(this, heap()->HashSeed());
|
||||
ast_string_constants_ = new AstStringConstants(this, HashSeed(this));
|
||||
}
|
||||
|
||||
initialized_from_snapshot_ = (des != nullptr);
|
||||
|
@ -608,11 +608,6 @@ class Isolate final : private HiddenFactory {
|
||||
return isolate;
|
||||
}
|
||||
|
||||
// Get the isolate that the given HeapObject lives in, returning true on
|
||||
// success. If the object is not writable (i.e. lives in read-only space),
|
||||
// return false.
|
||||
inline static bool FromWritableHeapObject(HeapObject obj, Isolate** isolate);
|
||||
|
||||
// Usually called by Init(), but can be called early e.g. to allow
|
||||
// testing components that require logging but not the whole
|
||||
// isolate.
|
||||
@ -970,6 +965,10 @@ class Isolate final : private HiddenFactory {
|
||||
}
|
||||
StackGuard* stack_guard() { return &stack_guard_; }
|
||||
Heap* heap() { return &heap_; }
|
||||
static Isolate* FromHeap(Heap* heap) {
|
||||
return reinterpret_cast<Isolate*>(reinterpret_cast<Address>(heap) -
|
||||
OFFSET_OF(Isolate, heap_));
|
||||
}
|
||||
|
||||
const IsolateData* isolate_data() const { return &isolate_data_; }
|
||||
IsolateData* isolate_data() { return &isolate_data_; }
|
||||
@ -1924,11 +1923,9 @@ class Isolate final : private HiddenFactory {
|
||||
DISALLOW_COPY_AND_ASSIGN(Isolate);
|
||||
};
|
||||
|
||||
|
||||
#undef FIELD_ACCESSOR
|
||||
#undef THREAD_LOCAL_TOP_ACCESSOR
|
||||
|
||||
|
||||
class PromiseOnStack {
|
||||
public:
|
||||
PromiseOnStack(Handle<JSObject> promise, PromiseOnStack* prev)
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "src/conversions.h"
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/field-type.h"
|
||||
#include "src/hash-seed-inl.h"
|
||||
#include "src/heap/heap-inl.h" // For string_table().
|
||||
#include "src/message-template.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/hash-table-inl.h"
|
||||
@ -839,8 +841,7 @@ Handle<String> JsonParser<seq_one_byte>::ScanJsonString() {
|
||||
|
||||
int position = position_;
|
||||
uc32 c0 = c0_;
|
||||
uint32_t running_hash =
|
||||
static_cast<uint32_t>(isolate()->heap()->HashSeed());
|
||||
uint32_t running_hash = static_cast<uint32_t>(HashSeed(isolate()));
|
||||
uint32_t index = 0;
|
||||
bool is_array_index = true;
|
||||
|
||||
|
@ -1759,7 +1759,8 @@ static int EnumerateWasmModuleObjects(
|
||||
if (obj->IsWasmModuleObject()) {
|
||||
WasmModuleObject module = WasmModuleObject::cast(obj);
|
||||
if (module_objects != nullptr) {
|
||||
module_objects[module_objects_count] = handle(module, heap->isolate());
|
||||
module_objects[module_objects_count] =
|
||||
handle(module, Isolate::FromHeap(heap));
|
||||
}
|
||||
module_objects_count++;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/external-reference-table.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/heap/heap-inl.h" // For MemoryChunk.
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/objects/heap-number.h"
|
||||
#include "src/register-configuration.h"
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/external-reference-table.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/heap/heap-inl.h" // For MemoryChunk.
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/objects/heap-number.h"
|
||||
#include "src/register-configuration.h"
|
||||
|
@ -12,9 +12,11 @@
|
||||
#include "src/disassembler.h"
|
||||
#include "src/elements.h"
|
||||
#include "src/field-type.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/ic/handler-configuration-inl.h"
|
||||
#include "src/layout-descriptor.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/allocation-site-inl.h"
|
||||
#include "src/objects/arguments-inl.h"
|
||||
#include "src/objects/bigint.h"
|
||||
#include "src/objects/cell-inl.h"
|
||||
@ -635,12 +637,12 @@ void JSObject::JSObjectVerify(Isolate* isolate) {
|
||||
|
||||
void Map::MapVerify(Isolate* isolate) {
|
||||
Heap* heap = isolate->heap();
|
||||
CHECK(!Heap::InYoungGeneration(*this));
|
||||
CHECK(!ObjectInYoungGeneration(*this));
|
||||
CHECK(FIRST_TYPE <= instance_type() && instance_type() <= LAST_TYPE);
|
||||
CHECK(instance_size() == kVariableSizeSentinel ||
|
||||
(kTaggedSize <= instance_size() &&
|
||||
static_cast<size_t>(instance_size()) < heap->Capacity()));
|
||||
CHECK(GetBackPointer()->IsUndefined(heap->isolate()) ||
|
||||
CHECK(GetBackPointer()->IsUndefined(isolate) ||
|
||||
!Map::cast(GetBackPointer())->is_stable());
|
||||
HeapObject::VerifyHeapPointer(isolate, prototype());
|
||||
HeapObject::VerifyHeapPointer(isolate, instance_descriptors());
|
||||
@ -991,7 +993,7 @@ void String::StringVerify(Isolate* isolate) {
|
||||
CHECK(length() >= 0 && length() <= Smi::kMaxValue);
|
||||
CHECK_IMPLIES(length() == 0, *this == ReadOnlyRoots(isolate).empty_string());
|
||||
if (IsInternalizedString()) {
|
||||
CHECK(!Heap::InYoungGeneration(*this));
|
||||
CHECK(!ObjectInYoungGeneration(*this));
|
||||
}
|
||||
if (IsConsString()) {
|
||||
ConsString::cast(*this)->ConsStringVerify(isolate);
|
||||
|
@ -21,12 +21,13 @@
|
||||
#include "src/double.h"
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/keys.h"
|
||||
#include "src/lookup-inl.h"
|
||||
#include "src/lookup-inl.h" // TODO(jkummerow): Drop.
|
||||
#include "src/objects/bigint.h"
|
||||
#include "src/objects/heap-number-inl.h"
|
||||
#include "src/objects/heap-object.h"
|
||||
#include "src/objects/js-proxy-inl.h"
|
||||
#include "src/objects/js-proxy-inl.h" // TODO(jkummerow): Drop.
|
||||
#include "src/objects/literal-objects.h"
|
||||
#include "src/objects/oddball.h"
|
||||
#include "src/objects/regexp-match-info.h"
|
||||
@ -81,10 +82,6 @@ bool HeapObject::IsDataHandler() const {
|
||||
|
||||
bool HeapObject::IsClassBoilerplate() const { return IsFixedArrayExact(); }
|
||||
|
||||
bool HeapObject::IsExternal(Isolate* isolate) const {
|
||||
return map()->FindRootMap(isolate) == isolate->heap()->external_map();
|
||||
}
|
||||
|
||||
#define IS_TYPE_FUNCTION_DEF(type_) \
|
||||
bool Object::Is##type_() const { \
|
||||
return IsHeapObject() && HeapObject::cast(*this)->Is##type_(); \
|
||||
@ -395,7 +392,6 @@ bool Object::IsMinusZero() const {
|
||||
i::IsMinusZero(HeapNumber::cast(*this)->value());
|
||||
}
|
||||
|
||||
OBJECT_CONSTRUCTORS_IMPL(HeapObject, Object)
|
||||
OBJECT_CONSTRUCTORS_IMPL(RegExpMatchInfo, FixedArray)
|
||||
OBJECT_CONSTRUCTORS_IMPL(ScopeInfo, FixedArray)
|
||||
OBJECT_CONSTRUCTORS_IMPL(BigIntBase, HeapObject)
|
||||
@ -408,8 +404,6 @@ OBJECT_CONSTRUCTORS_IMPL(TemplateObjectDescription, Tuple2)
|
||||
// Cast operations
|
||||
|
||||
CAST_ACCESSOR(BigInt)
|
||||
CAST_ACCESSOR(HeapObject)
|
||||
CAST_ACCESSOR(Object)
|
||||
CAST_ACCESSOR(RegExpMatchInfo)
|
||||
CAST_ACCESSOR(ScopeInfo)
|
||||
CAST_ACCESSOR(TemplateObjectDescription)
|
||||
@ -635,7 +629,7 @@ void HeapObject::VerifySmiField(int offset) {
|
||||
ReadOnlyRoots HeapObject::GetReadOnlyRoots() const {
|
||||
// TODO(v8:7464): When RO_SPACE is embedded, this will access a global
|
||||
// variable instead.
|
||||
return ReadOnlyRoots(MemoryChunk::FromHeapObject(*this)->heap());
|
||||
return ReadOnlyRoots(GetHeapFromWritableObject(*this));
|
||||
}
|
||||
|
||||
Map HeapObject::map() const { return map_word().ToMap(); }
|
||||
@ -643,7 +637,7 @@ Map HeapObject::map() const { return map_word().ToMap(); }
|
||||
void HeapObject::set_map(Map value) {
|
||||
if (!value.is_null()) {
|
||||
#ifdef VERIFY_HEAP
|
||||
Heap::FromWritableHeapObject(*this)->VerifyObjectLayoutChange(*this, value);
|
||||
GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value);
|
||||
#endif
|
||||
}
|
||||
set_map_word(MapWord::FromMap(value));
|
||||
@ -661,7 +655,7 @@ Map HeapObject::synchronized_map() const {
|
||||
void HeapObject::synchronized_set_map(Map value) {
|
||||
if (!value.is_null()) {
|
||||
#ifdef VERIFY_HEAP
|
||||
Heap::FromWritableHeapObject(*this)->VerifyObjectLayoutChange(*this, value);
|
||||
GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value);
|
||||
#endif
|
||||
}
|
||||
synchronized_set_map_word(MapWord::FromMap(value));
|
||||
@ -677,7 +671,7 @@ void HeapObject::synchronized_set_map(Map value) {
|
||||
void HeapObject::set_map_no_write_barrier(Map value) {
|
||||
if (!value.is_null()) {
|
||||
#ifdef VERIFY_HEAP
|
||||
Heap::FromWritableHeapObject(*this)->VerifyObjectLayoutChange(*this, value);
|
||||
GetHeapFromWritableObject(*this)->VerifyObjectLayoutChange(*this, value);
|
||||
#endif
|
||||
}
|
||||
set_map_word(MapWord::FromMap(value));
|
||||
@ -806,10 +800,7 @@ void RegExpMatchInfo::SetCapture(int i, int value) {
|
||||
|
||||
WriteBarrierMode HeapObject::GetWriteBarrierMode(
|
||||
const DisallowHeapAllocation& promise) {
|
||||
Heap* heap = Heap::FromWritableHeapObject(*this);
|
||||
if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER;
|
||||
if (Heap::InYoungGeneration(*this)) return SKIP_WRITE_BARRIER;
|
||||
return UPDATE_WRITE_BARRIER;
|
||||
return GetWriteBarrierModeForObject(*this, &promise);
|
||||
}
|
||||
|
||||
AllocationAlignment HeapObject::RequiredAlignment(Map map) {
|
||||
@ -994,7 +985,7 @@ Relocatable::~Relocatable() {
|
||||
// offset of the address in respective MemoryChunk.
|
||||
static inline uint32_t ObjectAddressForHashing(Address object) {
|
||||
uint32_t value = static_cast<uint32_t>(object);
|
||||
return value & MemoryChunk::kAlignmentMask;
|
||||
return value & kPageAlignmentMask;
|
||||
}
|
||||
|
||||
static inline Handle<Object> MakeEntryPair(Isolate* isolate, uint32_t index,
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "src/bootstrapper.h"
|
||||
#include "src/disasm.h"
|
||||
#include "src/disassembler.h"
|
||||
#include "src/heap/heap-inl.h" // For InOldSpace.
|
||||
#include "src/heap/heap-write-barrier-inl.h" // For GetIsolateFromWritableObj.
|
||||
#include "src/interpreter/bytecodes.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/arguments-inl.h"
|
||||
@ -96,8 +98,9 @@ void HeapObject::PrintHeader(std::ostream& os, const char* id) { // NOLINT
|
||||
os << map()->instance_type();
|
||||
}
|
||||
os << "]";
|
||||
MemoryChunk* chunk = MemoryChunk::FromAddress(ptr());
|
||||
if (chunk->owner()->identity() == OLD_SPACE) os << " in OldSpace";
|
||||
if (GetHeapFromWritableObject(*this)->InOldSpace(*this)) {
|
||||
os << " in OldSpace";
|
||||
}
|
||||
if (!IsMap()) os << "\n - map: " << Brief(map());
|
||||
}
|
||||
|
||||
@ -2446,7 +2449,7 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
|
||||
Isolate* isolate;
|
||||
// Read-only maps can't have transitions, which is fortunate because we need
|
||||
// the isolate to iterate over the transitions.
|
||||
if (Isolate::FromWritableHeapObject(*this, &isolate)) {
|
||||
if (GetIsolateFromWritableObject(*this, &isolate)) {
|
||||
DisallowHeapAllocation no_gc;
|
||||
TransitionsAccessor transitions(isolate, *this, &no_gc);
|
||||
int nof_transitions = transitions.NumberOfTransitions();
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/function-kind.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/ic/ic.h"
|
||||
#include "src/identity-map.h"
|
||||
#include "src/isolate-inl.h"
|
||||
@ -48,6 +49,7 @@
|
||||
#include "src/message-template.h"
|
||||
#include "src/microtask-queue.h"
|
||||
#include "src/objects-body-descriptors-inl.h"
|
||||
#include "src/objects/allocation-site-inl.h"
|
||||
#include "src/objects/api-callbacks.h"
|
||||
#include "src/objects/arguments-inl.h"
|
||||
#include "src/objects/bigint.h"
|
||||
@ -579,6 +581,11 @@ bool Object::BooleanValue(Isolate* isolate) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Object Object::ToBoolean(Isolate* isolate) {
|
||||
if (IsBoolean()) return *this;
|
||||
return isolate->heap()->ToBoolean(BooleanValue(isolate));
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
// TODO(bmeurer): Maybe we should introduce a marker interface Number,
|
||||
@ -2390,6 +2397,10 @@ void HeapObject::RehashBasedOnMap(Isolate* isolate) {
|
||||
}
|
||||
}
|
||||
|
||||
bool HeapObject::IsExternal(Isolate* isolate) const {
|
||||
return map()->FindRootMap(isolate) == isolate->heap()->external_map();
|
||||
}
|
||||
|
||||
const char* Representation::Mnemonic() const {
|
||||
switch (kind_) {
|
||||
case kNone: return "v";
|
||||
@ -6695,7 +6706,7 @@ MaybeHandle<String> StringTable::LookupTwoCharsStringIfExists(
|
||||
Isolate* isolate,
|
||||
uint16_t c1,
|
||||
uint16_t c2) {
|
||||
TwoCharHashTableKey key(c1, c2, isolate->heap()->HashSeed());
|
||||
TwoCharHashTableKey key(c1, c2, HashSeed(isolate));
|
||||
Handle<StringTable> string_table = isolate->factory()->string_table();
|
||||
int entry = string_table->FindEntry(isolate, &key);
|
||||
if (entry == kNotFound) return MaybeHandle<String>();
|
||||
@ -7000,7 +7011,7 @@ Address StringTable::LookupStringIfExists_NoAllocate(Isolate* isolate,
|
||||
Heap* heap = isolate->heap();
|
||||
StringTable table = heap->string_table();
|
||||
|
||||
StringTableNoAllocateKey key(string, heap->HashSeed());
|
||||
StringTableNoAllocateKey key(string, HashSeed(isolate));
|
||||
|
||||
// String could be an array index.
|
||||
uint32_t hash = string->hash_field();
|
||||
|
@ -652,6 +652,7 @@ class Object {
|
||||
|
||||
// ECMA-262 9.2.
|
||||
bool BooleanValue(Isolate* isolate);
|
||||
Object ToBoolean(Isolate* isolate);
|
||||
|
||||
// ES6 section 7.2.11 Abstract Relational Comparison
|
||||
V8_WARN_UNUSED_RESULT static Maybe<ComparisonResult> Compare(
|
||||
@ -928,7 +929,8 @@ class Object {
|
||||
|
||||
void ShortPrint(std::ostream& os) const; // NOLINT
|
||||
|
||||
DECL_CAST(Object)
|
||||
inline static Object cast(Object object) { return object; }
|
||||
inline static Object unchecked_cast(Object object) { return object; }
|
||||
|
||||
// Layout description.
|
||||
static const int kHeaderSize = 0; // Object does not take up any space.
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "src/objects/allocation-site.h"
|
||||
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects/js-objects-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
|
@ -7,9 +7,10 @@
|
||||
|
||||
#include "src/objects/api-callbacks.h"
|
||||
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/heap/heap-write-barrier.h"
|
||||
#include "src/objects/foreign-inl.h"
|
||||
#include "src/objects/js-objects-inl.h"
|
||||
#include "src/objects/name.h"
|
||||
#include "src/objects/templates.h"
|
||||
|
||||
|
@ -19,8 +19,14 @@
|
||||
|
||||
#include "src/objects/bigint.h"
|
||||
|
||||
#include "src/conversions.h"
|
||||
#include "src/double.h"
|
||||
#include "src/heap/factory.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/heap-number-inl.h"
|
||||
#include "src/objects/instance-type-inl.h"
|
||||
#include "src/objects/smi.h"
|
||||
|
||||
namespace v8 {
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
#include "src/objects/cell.h"
|
||||
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
|
@ -201,10 +201,10 @@ INT_ACCESSORS(Code, handler_table_offset, kHandlerTableOffsetOffset)
|
||||
INT_ACCESSORS(Code, code_comments_offset, kCodeCommentsOffsetOffset)
|
||||
#define CODE_ACCESSORS(name, type, offset) \
|
||||
ACCESSORS_CHECKED2(Code, name, type, offset, true, \
|
||||
!Heap::InYoungGeneration(value))
|
||||
!ObjectInYoungGeneration(value))
|
||||
#define SYNCHRONIZED_CODE_ACCESSORS(name, type, offset) \
|
||||
SYNCHRONIZED_ACCESSORS_CHECKED2(Code, name, type, offset, true, \
|
||||
!Heap::InYoungGeneration(value))
|
||||
!ObjectInYoungGeneration(value))
|
||||
|
||||
CODE_ACCESSORS(relocation_info, ByteArray, kRelocationInfoOffset)
|
||||
CODE_ACCESSORS(deoptimization_data, FixedArray, kDeoptimizationDataOffset)
|
||||
|
@ -4,13 +4,15 @@
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include "src/objects/code.h"
|
||||
|
||||
#include "src/assembler-inl.h"
|
||||
#include "src/cpu-features.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/interpreter/bytecode-array-iterator.h"
|
||||
#include "src/interpreter/bytecode-decoder.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/objects/code.h"
|
||||
#include "src/objects/allocation-site-inl.h"
|
||||
#include "src/ostreams.h"
|
||||
#include "src/reloc-info.h"
|
||||
#include "src/roots-inl.h"
|
||||
@ -1046,7 +1048,7 @@ void Code::SetMarkedForDeoptimization(const char* reason) {
|
||||
(deoptimization_data() != GetReadOnlyRoots().empty_fixed_array())) {
|
||||
DeoptimizationData deopt_data =
|
||||
DeoptimizationData::cast(deoptimization_data());
|
||||
CodeTracer::Scope scope(GetHeap()->isolate()->GetCodeTracer());
|
||||
CodeTracer::Scope scope(GetIsolate()->GetCodeTracer());
|
||||
PrintF(scope.file(),
|
||||
"[marking dependent code " V8PRIxPTR_FMT
|
||||
" (opt #%d) for deoptimization, reason: %s]\n",
|
||||
|
@ -7,9 +7,9 @@
|
||||
|
||||
#include "src/objects/debug-objects.h"
|
||||
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/heap-write-barrier.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/code-inl.h"
|
||||
#include "src/objects/shared-function-info.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "src/objects/dictionary.h"
|
||||
|
||||
#include "src/hash-seed-inl.h"
|
||||
#include "src/objects/hash-table-inl.h"
|
||||
#include "src/objects/oddball.h"
|
||||
#include "src/objects/property-cell-inl.h"
|
||||
@ -137,14 +138,14 @@ bool NumberDictionaryBaseShape::IsMatch(uint32_t key, Object other) {
|
||||
}
|
||||
|
||||
uint32_t NumberDictionaryBaseShape::Hash(Isolate* isolate, uint32_t key) {
|
||||
return ComputeSeededHash(key, isolate->heap()->HashSeed());
|
||||
return ComputeSeededHash(key, HashSeed(isolate));
|
||||
}
|
||||
|
||||
uint32_t NumberDictionaryBaseShape::HashForObject(Isolate* isolate,
|
||||
Object other) {
|
||||
DCHECK(other->IsNumber());
|
||||
return ComputeSeededHash(static_cast<uint32_t>(other->Number()),
|
||||
isolate->heap()->HashSeed());
|
||||
HashSeed(isolate));
|
||||
}
|
||||
|
||||
Handle<Object> NumberDictionaryBaseShape::AsHandle(Isolate* isolate,
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "src/objects/embedder-data-array.h"
|
||||
|
||||
//#include "src/objects-inl.h" // Needed for write barriers
|
||||
#include "src/objects/instance-type-inl.h"
|
||||
#include "src/objects/maybe-object-inl.h"
|
||||
#include "src/objects/slots.h"
|
||||
|
||||
|
@ -3,6 +3,8 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "src/objects/embedder-data-array.h"
|
||||
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects/embedder-data-array-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
|
@ -5,10 +5,12 @@
|
||||
#ifndef V8_OBJECTS_EMBEDDER_DATA_SLOT_INL_H_
|
||||
#define V8_OBJECTS_EMBEDDER_DATA_SLOT_INL_H_
|
||||
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects/embedder-data-array.h"
|
||||
#include "src/objects/embedder-data-slot.h"
|
||||
#include "src/objects/js-objects.h"
|
||||
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/embedder-data-array.h"
|
||||
#include "src/objects/js-objects-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "src/objects/feedback-cell.h"
|
||||
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/struct-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
|
@ -7,15 +7,18 @@
|
||||
|
||||
#include "src/objects/fixed-array.h"
|
||||
|
||||
#include "src/base/tsan.h"
|
||||
#include "src/conversions.h"
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/bigint.h"
|
||||
#include "src/objects/heap-number-inl.h"
|
||||
#include "src/objects/map.h"
|
||||
#include "src/objects/maybe-object-inl.h"
|
||||
#include "src/objects/oddball.h"
|
||||
#include "src/objects/slots.h"
|
||||
#include "src/roots-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
@ -146,7 +149,7 @@ void FixedArray::NoWriteBarrierSet(FixedArray array, int index, Object value) {
|
||||
DCHECK_NE(array->map(), array->GetReadOnlyRoots().fixed_cow_array_map());
|
||||
DCHECK_GE(index, 0);
|
||||
DCHECK_LT(index, array->length());
|
||||
DCHECK(!Heap::InYoungGeneration(value));
|
||||
DCHECK(!ObjectInYoungGeneration(value));
|
||||
RELAXED_WRITE_FIELD(array, kHeaderSize + index * kTaggedSize, value);
|
||||
}
|
||||
|
||||
@ -324,7 +327,7 @@ uint64_t FixedDoubleArray::get_representation(int index) {
|
||||
Handle<Object> FixedDoubleArray::get(FixedDoubleArray array, int index,
|
||||
Isolate* isolate) {
|
||||
if (array->is_the_hole(index)) {
|
||||
return isolate->factory()->the_hole_value();
|
||||
return ReadOnlyRoots(isolate).the_hole_value_handle();
|
||||
} else {
|
||||
return isolate->factory()->NewNumber(array->get_scalar(index));
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/objects/foreign.h"
|
||||
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
|
@ -7,7 +7,10 @@
|
||||
|
||||
#include "src/objects/free-space.h"
|
||||
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/heap/heap.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
@ -24,8 +27,9 @@ int FreeSpace::Size() { return size(); }
|
||||
|
||||
FreeSpace FreeSpace::next() {
|
||||
#ifdef DEBUG
|
||||
Heap* heap = Heap::FromWritableHeapObject(*this);
|
||||
Object free_space_map = heap->isolate()->root(RootIndex::kFreeSpaceMap);
|
||||
Heap* heap = GetHeapFromWritableObject(*this);
|
||||
Object free_space_map =
|
||||
Isolate::FromHeap(heap)->root(RootIndex::kFreeSpaceMap);
|
||||
DCHECK_IMPLIES(!map_slot().contains_value(free_space_map->ptr()),
|
||||
!heap->deserialization_complete() &&
|
||||
map_slot().contains_value(kNullAddress));
|
||||
@ -36,8 +40,9 @@ FreeSpace FreeSpace::next() {
|
||||
|
||||
void FreeSpace::set_next(FreeSpace next) {
|
||||
#ifdef DEBUG
|
||||
Heap* heap = Heap::FromWritableHeapObject(*this);
|
||||
Object free_space_map = heap->isolate()->root(RootIndex::kFreeSpaceMap);
|
||||
Heap* heap = GetHeapFromWritableObject(*this);
|
||||
Object free_space_map =
|
||||
Isolate::FromHeap(heap)->root(RootIndex::kFreeSpaceMap);
|
||||
DCHECK_IMPLIES(!map_slot().contains_value(free_space_map->ptr()),
|
||||
!heap->deserialization_complete() &&
|
||||
map_slot().contains_value(kNullAddress));
|
||||
@ -47,7 +52,7 @@ void FreeSpace::set_next(FreeSpace next) {
|
||||
}
|
||||
|
||||
FreeSpace FreeSpace::cast(HeapObject o) {
|
||||
SLOW_DCHECK(!Heap::FromWritableHeapObject(o)->deserialization_complete() ||
|
||||
SLOW_DCHECK(!GetHeapFromWritableObject(o)->deserialization_complete() ||
|
||||
o->IsFreeSpace());
|
||||
return bit_cast<FreeSpace>(o);
|
||||
}
|
||||
|
@ -8,7 +8,9 @@
|
||||
#include "src/objects/hash-table.h"
|
||||
|
||||
#include "src/heap/heap.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/fixed-array-inl.h"
|
||||
#include "src/objects/heap-object-inl.h"
|
||||
#include "src/roots-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
|
@ -7,7 +7,8 @@
|
||||
|
||||
#include "src/objects/heap-number.h"
|
||||
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/heap-object-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
|
@ -8,6 +8,8 @@
|
||||
#include "src/objects/heap-object.h"
|
||||
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
// TODO(jkummerow): Get rid of this by moving NROSO::GetIsolate elsewhere.
|
||||
#include "src/isolate.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
@ -15,6 +17,9 @@
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
OBJECT_CONSTRUCTORS_IMPL(HeapObject, Object)
|
||||
CAST_ACCESSOR(HeapObject)
|
||||
|
||||
HeapObject::HeapObject(Address ptr, AllowInlineSmiStorage allow_smi)
|
||||
: Object(ptr) {
|
||||
SLOW_DCHECK(
|
||||
@ -32,7 +37,7 @@ Heap* NeverReadOnlySpaceObject::GetHeap(const HeapObject object) {
|
||||
}
|
||||
|
||||
Isolate* NeverReadOnlySpaceObject::GetIsolate(const HeapObject object) {
|
||||
return GetHeap(object)->isolate();
|
||||
return Isolate::FromHeap(GetHeap(object));
|
||||
}
|
||||
|
||||
} // namespace internal
|
||||
|
@ -62,7 +62,7 @@ class HeapObject : public Object {
|
||||
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
|
||||
#undef IS_TYPE_FUNCTION_DECL
|
||||
|
||||
V8_INLINE bool IsExternal(Isolate* isolate) const;
|
||||
bool IsExternal(Isolate* isolate) const;
|
||||
|
||||
// Oddball checks are faster when they are raw pointer comparisons, so the
|
||||
// isolate/read-only roots overloads should be preferred where possible.
|
||||
|
@ -7,7 +7,9 @@
|
||||
|
||||
#include "src/objects/js-array-buffer.h"
|
||||
|
||||
#include "src/objects-inl.h" // Needed for write barriers
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/js-objects-inl.h"
|
||||
#include "src/wasm/wasm-engine.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
|
@ -8,7 +8,10 @@
|
||||
#include "src/objects/js-collection.h"
|
||||
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/heap-object-inl.h"
|
||||
#include "src/objects/ordered-hash-table-inl.h"
|
||||
#include "src/roots-inl.h"
|
||||
|
||||
// Has to be the last include (doesn't have include guards):
|
||||
#include "src/objects/object-macros.h"
|
||||
|
@ -433,9 +433,9 @@ Object JSObject::InObjectPropertyAtPut(int index, Object value,
|
||||
void JSObject::InitializeBody(Map map, int start_offset,
|
||||
Object pre_allocated_value, Object filler_value) {
|
||||
DCHECK_IMPLIES(filler_value->IsHeapObject(),
|
||||
!Heap::InYoungGeneration(filler_value));
|
||||
!ObjectInYoungGeneration(filler_value));
|
||||
DCHECK_IMPLIES(pre_allocated_value->IsHeapObject(),
|
||||
!Heap::InYoungGeneration(pre_allocated_value));
|
||||
!ObjectInYoungGeneration(pre_allocated_value));
|
||||
int size = map->instance_size();
|
||||
int offset = start_offset;
|
||||
if (filler_value != pre_allocated_value) {
|
||||
@ -548,13 +548,13 @@ Code JSFunction::code() const {
|
||||
}
|
||||
|
||||
void JSFunction::set_code(Code value) {
|
||||
DCHECK(!Heap::InYoungGeneration(value));
|
||||
DCHECK(!ObjectInYoungGeneration(value));
|
||||
RELAXED_WRITE_FIELD(*this, kCodeOffset, value);
|
||||
MarkingBarrier(*this, RawField(kCodeOffset), value);
|
||||
}
|
||||
|
||||
void JSFunction::set_code_no_write_barrier(Code value) {
|
||||
DCHECK(!Heap::InYoungGeneration(value));
|
||||
DCHECK(!ObjectInYoungGeneration(value));
|
||||
RELAXED_WRITE_FIELD(*this, kCodeOffset, value);
|
||||
}
|
||||
|
||||
@ -851,8 +851,8 @@ NumberDictionary JSObject::element_dictionary() {
|
||||
|
||||
void JSReceiver::initialize_properties() {
|
||||
ReadOnlyRoots roots = GetReadOnlyRoots();
|
||||
DCHECK(!Heap::InYoungGeneration(roots.empty_fixed_array()));
|
||||
DCHECK(!Heap::InYoungGeneration(roots.empty_property_dictionary()));
|
||||
DCHECK(!ObjectInYoungGeneration(roots.empty_fixed_array()));
|
||||
DCHECK(!ObjectInYoungGeneration(roots.empty_property_dictionary()));
|
||||
if (map()->is_dictionary_map()) {
|
||||
WRITE_FIELD(*this, kPropertiesOrHashOffset,
|
||||
roots.empty_property_dictionary());
|
||||
@ -996,7 +996,7 @@ static inline bool ShouldConvertToSlowElements(JSObject object,
|
||||
// TODO(ulan): Check if it works with young large objects.
|
||||
if (*new_capacity <= JSObject::kMaxUncheckedOldFastElementsLength ||
|
||||
(*new_capacity <= JSObject::kMaxUncheckedFastElementsLength &&
|
||||
Heap::InYoungGeneration(object))) {
|
||||
ObjectInYoungGeneration(object))) {
|
||||
return false;
|
||||
}
|
||||
// If the fast-case backing storage takes up much more memory than a
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "src/elements.h"
|
||||
#include "src/field-type.h"
|
||||
#include "src/handles-inl.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/ic/ic.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/layout-descriptor.h"
|
||||
@ -2039,9 +2040,8 @@ void JSObject::EnsureWritableFastElements(Handle<JSObject> object) {
|
||||
DCHECK(object->HasSmiOrObjectElements() ||
|
||||
object->HasFastStringWrapperElements());
|
||||
FixedArray raw_elems = FixedArray::cast(object->elements());
|
||||
Heap* heap = object->GetHeap();
|
||||
if (raw_elems->map() != ReadOnlyRoots(heap).fixed_cow_array_map()) return;
|
||||
Isolate* isolate = heap->isolate();
|
||||
Isolate* isolate = object->GetIsolate();
|
||||
if (raw_elems->map() != ReadOnlyRoots(isolate).fixed_cow_array_map()) return;
|
||||
Handle<FixedArray> elems(raw_elems, isolate);
|
||||
Handle<FixedArray> writable_elems = isolate->factory()->CopyFixedArrayWithMap(
|
||||
elems, isolate->factory()->fixed_array_map());
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "src/objects/map.h"
|
||||
|
||||
#include "src/field-type.h"
|
||||
#include "src/heap/heap-inl.h"
|
||||
#include "src/heap/heap-write-barrier-inl.h"
|
||||
#include "src/layout-descriptor-inl.h"
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/api-callbacks-inl.h"
|
||||
@ -197,13 +197,14 @@ FixedArrayBase Map::GetInitialElements() const {
|
||||
} else if (has_fast_sloppy_arguments_elements()) {
|
||||
result = GetReadOnlyRoots().empty_sloppy_arguments_elements();
|
||||
} else if (has_fixed_typed_array_elements()) {
|
||||
result = GetReadOnlyRoots().EmptyFixedTypedArrayForMap(*this);
|
||||
result =
|
||||
GetReadOnlyRoots().EmptyFixedTypedArrayForTypedArray(elements_kind());
|
||||
} else if (has_dictionary_elements()) {
|
||||
result = GetReadOnlyRoots().empty_slow_element_dictionary();
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
DCHECK(!Heap::InYoungGeneration(result));
|
||||
DCHECK(!ObjectInYoungGeneration(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -10,8 +10,9 @@
|
||||
#ifdef V8_COMPRESS_POINTERS
|
||||
#include "src/isolate.h"
|
||||
#endif
|
||||
#include "src/objects-inl.h"
|
||||
#include "src/objects/heap-object-inl.h"
|
||||
#include "src/objects/slots-inl.h"
|
||||
#include "src/objects/smi-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user