Commit 670be6ae authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[runtime] Mark more methods const on Isolate and Heap

Bug: v8:11263
Change-Id: I320a75b8819353ab7af5bf7608329e6f0a7a66ca
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2821544Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Reviewed-by: 's avatarVictor Gomes <victorgomes@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73929}
parent 930f2654
......@@ -2944,7 +2944,7 @@ void Isolate::SetUpFromReadOnlyArtifacts(
heap_.SetUpFromReadOnlyHeap(read_only_heap_);
}
v8::PageAllocator* Isolate::page_allocator() {
v8::PageAllocator* Isolate::page_allocator() const {
return isolate_allocator_->page_allocator();
}
......
......@@ -559,7 +559,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
void set_read_only_heap(ReadOnlyHeap* ro_heap) { read_only_heap_ = ro_heap; }
// Page allocator that must be used for allocating V8 heap pages.
v8::PageAllocator* page_allocator();
v8::PageAllocator* page_allocator() const;
// Returns the PerIsolateThreadData for the current thread (or nullptr if one
// is not currently set).
......@@ -659,12 +659,12 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
base::SharedMutex* map_updater_access() { return &map_updater_access_; }
// The isolate's string table.
StringTable* string_table() { return string_table_.get(); }
StringTable* string_table() const { return string_table_.get(); }
Address get_address_from_id(IsolateAddressId id);
// Access to top context (where the current function object was created).
Context context() { return thread_local_top()->context_; }
Context context() const { return thread_local_top()->context_; }
inline void set_context(Context context);
Context* context_address() { return &thread_local_top()->context_; }
......@@ -1057,7 +1057,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
sizeof(IsolateData));
}
Object root(RootIndex index) { return Object(roots_table()[index]); }
Object root(RootIndex index) const { return Object(roots_table()[index]); }
Handle<Object> root_handle(RootIndex index) {
return Handle<Object>(&roots_table()[index]);
......@@ -1073,8 +1073,8 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
bool IsBuiltinsTableHandleLocation(Address* handle_location);
StubCache* load_stub_cache() { return load_stub_cache_; }
StubCache* store_stub_cache() { return store_stub_cache_; }
StubCache* load_stub_cache() const { return load_stub_cache_; }
StubCache* store_stub_cache() const { return store_stub_cache_; }
Deoptimizer* GetAndClearCurrentDeoptimizer() {
Deoptimizer* result = current_deoptimizer_;
CHECK_NOT_NULL(result);
......@@ -1111,32 +1111,32 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
THREAD_LOCAL_TOP_ADDRESS(Address, thread_in_wasm_flag_address)
MaterializedObjectStore* materialized_object_store() {
MaterializedObjectStore* materialized_object_store() const {
return materialized_object_store_;
}
DescriptorLookupCache* descriptor_lookup_cache() {
DescriptorLookupCache* descriptor_lookup_cache() const {
return descriptor_lookup_cache_;
}
HandleScopeData* handle_scope_data() { return &handle_scope_data_; }
HandleScopeImplementer* handle_scope_implementer() {
HandleScopeImplementer* handle_scope_implementer() const {
DCHECK(handle_scope_implementer_);
return handle_scope_implementer_;
}
UnicodeCache* unicode_cache() { return unicode_cache_; }
UnicodeCache* unicode_cache() const { return unicode_cache_; }
InnerPointerToCodeCache* inner_pointer_to_code_cache() {
return inner_pointer_to_code_cache_;
}
GlobalHandles* global_handles() { return global_handles_; }
GlobalHandles* global_handles() const { return global_handles_; }
EternalHandles* eternal_handles() { return eternal_handles_; }
EternalHandles* eternal_handles() const { return eternal_handles_; }
ThreadManager* thread_manager() { return thread_manager_; }
ThreadManager* thread_manager() const { return thread_manager_; }
#ifndef V8_INTL_SUPPORT
unibrow::Mapping<unibrow::Ecma262UnCanonicalize>* jsregexp_uncanonicalize() {
......@@ -1157,14 +1157,16 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
Builtins* builtins() { return &builtins_; }
RegExpStack* regexp_stack() { return regexp_stack_; }
RegExpStack* regexp_stack() const { return regexp_stack_; }
size_t total_regexp_code_generated() { return total_regexp_code_generated_; }
size_t total_regexp_code_generated() const {
return total_regexp_code_generated_;
}
void IncreaseTotalRegexpCodeGenerated(Handle<HeapObject> code);
std::vector<int>* regexp_indices() { return &regexp_indices_; }
Debug* debug() { return debug_; }
Debug* debug() const { return debug_; }
void* is_profiling_address() { return &is_profiling_; }
......@@ -1202,7 +1204,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
DCHECK_LT(slot, Internals::kNumIsolateDataSlots);
isolate_data_.embedder_data_[slot] = data;
}
void* GetData(uint32_t slot) {
void* GetData(uint32_t slot) const {
DCHECK_LT(slot, Internals::kNumIsolateDataSlots);
return isolate_data_.embedder_data_[slot];
}
......@@ -1215,7 +1217,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
return snapshot_blob_ != nullptr && snapshot_blob_->raw_size != 0;
}
bool IsDead() { return has_fatal_error_; }
bool IsDead() const { return has_fatal_error_; }
void SignalFatalError() { has_fatal_error_ = true; }
bool use_optimizer();
......@@ -1271,11 +1273,11 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
void MaybeInitializeVectorListFromHeap();
double time_millis_since_init() {
double time_millis_since_init() const {
return heap_.MonotonicallyIncreasingTimeInMs() - time_millis_at_init_;
}
DateCache* date_cache() { return date_cache_; }
DateCache* date_cache() const { return date_cache_; }
void set_date_cache(DateCache* date_cache);
......@@ -1329,7 +1331,7 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
std::unique_ptr<PersistentHandles> NewPersistentHandles();
PersistentHandlesList* persistent_handles_list() {
PersistentHandlesList* persistent_handles_list() const {
return persistent_handles_list_.get();
}
......
......@@ -3681,7 +3681,7 @@ void Heap::IdleNotificationEpilogue(GCIdleTimeAction action,
}
}
double Heap::MonotonicallyIncreasingTimeInMs() {
double Heap::MonotonicallyIncreasingTimeInMs() const {
return V8::GetCurrentPlatform()->MonotonicallyIncreasingTime() *
static_cast<double>(base::Time::kMillisecondsPerSecond);
}
......
......@@ -696,7 +696,7 @@ class Heap {
GlobalSafepoint* safepoint() { return safepoint_.get(); }
V8_EXPORT_PRIVATE double MonotonicallyIncreasingTimeInMs();
V8_EXPORT_PRIVATE double MonotonicallyIncreasingTimeInMs() const;
void VerifyNewSpaceTop();
......@@ -857,6 +857,7 @@ class Heap {
}
inline Isolate* isolate();
inline const Isolate* isolate() const;
MarkCompactCollector* mark_compact_collector() {
return mark_compact_collector_.get();
......@@ -1074,17 +1075,19 @@ class Heap {
void CompleteSweepingFull();
void CompleteSweepingYoung(GarbageCollector collector);
IncrementalMarking* incremental_marking() {
IncrementalMarking* incremental_marking() const {
return incremental_marking_.get();
}
MarkingBarrier* marking_barrier() { return marking_barrier_.get(); }
MarkingBarrier* marking_barrier() const { return marking_barrier_.get(); }
// ===========================================================================
// Concurrent marking API. ===================================================
// ===========================================================================
ConcurrentMarking* concurrent_marking() { return concurrent_marking_.get(); }
ConcurrentMarking* concurrent_marking() const {
return concurrent_marking_.get();
}
// The runtime uses this function to notify potentially unsafe object layout
// changes that require special synchronization with the concurrent marker.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment