diff options
author | Michaƫl Zasso <targos@protonmail.com> | 2018-01-24 20:16:06 +0100 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-01-24 15:02:20 -0800 |
commit | 4c4af643e5042d615a60c6bbc05aee9d81b903e5 (patch) | |
tree | 3fb0a97988fe4439ae3ae06f26915d1dcf8cab92 /deps/v8/src/isolate.h | |
parent | fa9f31a4fda5a3782c652e56e394465805ebb50f (diff) | |
download | node-new-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.gz |
deps: update V8 to 6.4.388.40
PR-URL: https://github.com/nodejs/node/pull/17489
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/src/isolate.h')
-rw-r--r-- | deps/v8/src/isolate.h | 129 |
1 files changed, 80 insertions, 49 deletions
diff --git a/deps/v8/src/isolate.h b/deps/v8/src/isolate.h index 44a5250808..9e3de53675 100644 --- a/deps/v8/src/isolate.h +++ b/deps/v8/src/isolate.h @@ -23,6 +23,7 @@ #include "src/handles.h" #include "src/heap/heap.h" #include "src/messages.h" +#include "src/objects/code.h" #include "src/regexp/regexp-stack.h" #include "src/runtime/runtime.h" #include "src/zone/zone.h" @@ -109,6 +110,7 @@ class Interpreter; namespace wasm { class CompilationManager; +class WasmCodeManager; } #define RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate) \ @@ -297,14 +299,14 @@ class ThreadLocalTop BASE_EMBEDDED { // Initialize the thread data. void Initialize(); - // Get the top C++ try catch handler or NULL if none are registered. + // Get the top C++ try catch handler or nullptr if none are registered. // // This method is not guaranteed to return an address that can be // used for comparison with addresses into the JS stack. If such an // address is needed, use try_catch_handler_address. FIELD_ACCESSOR(v8::TryCatch*, try_catch_handler) - // Get the address of the top C++ try catch handler or NULL if + // Get the address of the top C++ try catch handler or nullptr if // none are registered. // // This method always returns an address that can be compared to @@ -333,8 +335,8 @@ class ThreadLocalTop BASE_EMBEDDED { // Communication channel between Isolate::FindHandler and the CEntryStub. Context* pending_handler_context_; - Code* pending_handler_code_; - intptr_t pending_handler_offset_; + Address pending_handler_entrypoint_; + Address pending_handler_constant_pool_; Address pending_handler_fp_; Address pending_handler_sp_; @@ -380,10 +382,10 @@ class ThreadLocalTop BASE_EMBEDDED { #if USE_SIMULATOR -#define ISOLATE_INIT_SIMULATOR_LIST(V) \ - V(bool, simulator_initialized, false) \ - V(base::CustomMatcherHashMap*, simulator_i_cache, NULL) \ - V(Redirection*, simulator_redirection, NULL) +#define ISOLATE_INIT_SIMULATOR_LIST(V) \ + V(bool, simulator_initialized, false) \ + V(base::CustomMatcherHashMap*, simulator_i_cache, nullptr) \ + V(Redirection*, simulator_redirection, nullptr) #else #define ISOLATE_INIT_SIMULATOR_LIST(V) @@ -419,6 +421,7 @@ typedef std::vector<HeapObject*> DebugObjectCache; V(OOMErrorCallback, oom_behavior, nullptr) \ V(LogEventCallback, event_logger, nullptr) \ V(AllowCodeGenerationFromStringsCallback, allow_code_gen_callback, nullptr) \ + V(AllowWasmCodeGenerationCallback, allow_wasm_code_gen_callback, nullptr) \ V(ExtensionCallback, wasm_module_callback, &NoExtension) \ V(ExtensionCallback, wasm_instance_callback, &NoExtension) \ V(ApiImplementationCallback, wasm_compile_streaming_callback, nullptr) \ @@ -478,12 +481,13 @@ class Isolate { : isolate_(isolate), thread_id_(thread_id), stack_limit_(0), - thread_state_(NULL), + thread_state_(nullptr), #if USE_SIMULATOR - simulator_(NULL), + simulator_(nullptr), #endif - next_(NULL), - prev_(NULL) { } + next_(nullptr), + prev_(nullptr) { + } ~PerIsolateThreadData(); Isolate* isolate() const { return isolate_; } ThreadId thread_id() const { return thread_id_; } @@ -521,8 +525,8 @@ class Isolate { static void InitializeOncePerProcess(); - // Returns the PerIsolateThreadData for the current thread (or NULL if one is - // not currently set). + // Returns the PerIsolateThreadData for the current thread (or nullptr if one + // is not currently set). static PerIsolateThreadData* CurrentPerIsolateThreadData() { return reinterpret_cast<PerIsolateThreadData*>( base::Thread::GetThreadLocal(per_isolate_thread_data_key_)); @@ -530,7 +534,7 @@ class Isolate { // Returns the isolate inside which the current thread is running. INLINE(static Isolate* Current()) { - DCHECK(base::Relaxed_Load(&isolate_key_created_) == 1); + DCHECK_EQ(base::Relaxed_Load(&isolate_key_created_), 1); Isolate* isolate = reinterpret_cast<Isolate*>( base::Thread::GetExistingThreadLocal(isolate_key_)); DCHECK_NOT_NULL(isolate); @@ -548,7 +552,7 @@ class Isolate { bool Init(StartupDeserializer* des); // True if at least one thread Enter'ed this isolate. - bool IsInUse() { return entry_stack_ != NULL; } + bool IsInUse() { return entry_stack_ != nullptr; } // Destroys the non-default isolates. // Sets default isolate into "has_been_disposed" state rather then destroying, @@ -617,8 +621,8 @@ class Isolate { inline bool has_pending_exception(); THREAD_LOCAL_TOP_ADDRESS(Context*, pending_handler_context) - THREAD_LOCAL_TOP_ADDRESS(Code*, pending_handler_code) - THREAD_LOCAL_TOP_ADDRESS(intptr_t, pending_handler_offset) + THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_entrypoint) + THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_constant_pool) THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_fp) THREAD_LOCAL_TOP_ADDRESS(Address, pending_handler_sp) @@ -722,7 +726,8 @@ class Isolate { void PrintCurrentStackTrace(FILE* out); void PrintStack(StringStream* accumulator, PrintStackMode mode = kPrintStackVerbose); - void PrintStack(FILE* out, PrintStackMode mode = kPrintStackVerbose); + V8_EXPORT_PRIVATE void PrintStack(FILE* out, + PrintStackMode mode = kPrintStackVerbose); Handle<String> StackTraceString(); // Stores a stack trace in a stack-allocated temporary buffer which will // end up in the minidump for debugging purposes. @@ -748,6 +753,8 @@ class Isolate { Handle<Object> caller); Handle<FixedArray> GetDetailedStackTrace(Handle<JSObject> error_object); + Address GetAbstractPC(int* line, int* column); + // Returns if the given context may access the given global object. If // the result is false, the pending exception is guaranteed to be // set. @@ -758,12 +765,12 @@ class Isolate { // Exception throwing support. The caller should use the result // of Throw() as its return value. - Object* Throw(Object* exception, MessageLocation* location = NULL); + Object* Throw(Object* exception, MessageLocation* location = nullptr); Object* ThrowIllegalOperation(); template <typename T> MUST_USE_RESULT MaybeHandle<T> Throw(Handle<Object> exception, - MessageLocation* location = NULL) { + MessageLocation* location = nullptr) { Throw(*exception, location); return MaybeHandle<T>(); } @@ -899,6 +906,7 @@ class Isolate { } StackGuard* stack_guard() { return &stack_guard_; } Heap* heap() { return &heap_; } + V8_EXPORT_PRIVATE wasm::WasmCodeManager* wasm_code_manager(); StubCache* load_stub_cache() { return load_stub_cache_; } StubCache* store_stub_cache() { return store_stub_cache_; } DeoptimizerData* deoptimizer_data() { return deoptimizer_data_; } @@ -980,6 +988,10 @@ class Isolate { HeapProfiler* heap_profiler() const { return heap_profiler_; } #ifdef DEBUG + static size_t non_disposed_isolates() { + return non_disposed_isolates_.Value(); + } + HistogramInfo* heap_histograms() { return heap_histograms_; } JSObject::SpillInformation* js_spill_information() { @@ -996,20 +1008,17 @@ class Isolate { THREAD_LOCAL_TOP_ACCESSOR(StateTag, current_vm_state) void SetData(uint32_t slot, void* data) { - DCHECK(slot < Internals::kNumIsolateDataSlots); + DCHECK_LT(slot, Internals::kNumIsolateDataSlots); embedder_data_[slot] = data; } void* GetData(uint32_t slot) { - DCHECK(slot < Internals::kNumIsolateDataSlots); + DCHECK_LT(slot, Internals::kNumIsolateDataSlots); return embedder_data_[slot]; } bool serializer_enabled() const { return serializer_enabled_; } - void set_serializer_enabled_for_test(bool serializer_enabled) { - serializer_enabled_ = serializer_enabled; - } bool snapshot_available() const { - return snapshot_blob_ != NULL && snapshot_blob_->raw_size != 0; + return snapshot_blob_ != nullptr && snapshot_blob_->raw_size != 0; } bool IsDead() { return has_fatal_error_; } @@ -1049,7 +1058,14 @@ class Isolate { return type_profile_mode() == debug::TypeProfile::kCollect; } - void SetCodeCoverageList(Object* value); + // Collect feedback vectors with data for code coverage or type profile. + // Reset the list, when both code coverage and type profile are not + // needed anymore. This keeps many feedback vectors alive, but code + // coverage or type profile are used for debugging only and increase in + // memory usage is expected. + void SetFeedbackVectorsForProfilingTools(Object* value); + + void InitializeVectorListFromHeap(); double time_millis_since_init() { return heap_.MonotonicallyIncreasingTimeInMs() - time_millis_at_init_; @@ -1074,8 +1090,8 @@ class Isolate { // The version with an explicit context parameter can be used when // Isolate::context is not set up, e.g. when calling directly into C++ from // CSA. - bool IsFastArrayConstructorPrototypeChainIntact(Context* context); - bool IsFastArrayConstructorPrototypeChainIntact(); + bool IsNoElementsProtectorIntact(Context* context); + bool IsNoElementsProtectorIntact(); inline bool IsArraySpeciesLookupChainIntact(); bool IsIsConcatSpreadableLookupChainIntact(); @@ -1093,15 +1109,15 @@ class Isolate { // notifications occur if the set is on the elements of the array or // object prototype. Also ensure that changes to prototype chain between // Array and Object fire notifications. - void UpdateArrayProtectorOnSetElement(Handle<JSObject> object); - void UpdateArrayProtectorOnSetLength(Handle<JSObject> object) { - UpdateArrayProtectorOnSetElement(object); + void UpdateNoElementsProtectorOnSetElement(Handle<JSObject> object); + void UpdateNoElementsProtectorOnSetLength(Handle<JSObject> object) { + UpdateNoElementsProtectorOnSetElement(object); } - void UpdateArrayProtectorOnSetPrototype(Handle<JSObject> object) { - UpdateArrayProtectorOnSetElement(object); + void UpdateNoElementsProtectorOnSetPrototype(Handle<JSObject> object) { + UpdateNoElementsProtectorOnSetElement(object); } - void UpdateArrayProtectorOnNormalizeElements(Handle<JSObject> object) { - UpdateArrayProtectorOnSetElement(object); + void UpdateNoElementsProtectorOnNormalizeElements(Handle<JSObject> object) { + UpdateNoElementsProtectorOnSetElement(object); } void InvalidateArrayConstructorProtector(); void InvalidateArraySpeciesProtector(); @@ -1116,8 +1132,6 @@ class Isolate { V8_EXPORT_PRIVATE CallInterfaceDescriptorData* call_descriptor_data( int index); - AccessCompilerData* access_compiler_data() { return access_compiler_data_; } - void IterateDeferredHandles(RootVisitor* visitor); void LinkDeferredHandles(DeferredHandles* deferred_handles); void UnlinkDeferredHandles(DeferredHandles* deferred_handles); @@ -1128,9 +1142,9 @@ class Isolate { bool concurrent_recompilation_enabled() { // Thread is only available with flag enabled. - DCHECK(optimizing_compile_dispatcher_ == NULL || + DCHECK(optimizing_compile_dispatcher_ == nullptr || FLAG_concurrent_recompilation); - return optimizing_compile_dispatcher_ != NULL; + return optimizing_compile_dispatcher_ != nullptr; } OptimizingCompileDispatcher* optimizing_compile_dispatcher() { @@ -1151,8 +1165,14 @@ class Isolate { void* stress_deopt_count_address() { return &stress_deopt_count_; } + bool force_slow_path() { return force_slow_path_; } + + bool* force_slow_path_address() { return &force_slow_path_; } + V8_EXPORT_PRIVATE base::RandomNumberGenerator* random_number_generator(); + V8_EXPORT_PRIVATE base::RandomNumberGenerator* fuzzer_rng(); + // Generates a random number that is non-zero when masked // with the provided mask. int GenerateIdentityHash(uint32_t mask); @@ -1262,6 +1282,11 @@ class Isolate { MaybeHandle<JSPromise> RunHostImportModuleDynamicallyCallback( Handle<Script> referrer, Handle<Object> specifier); + void SetHostInitializeImportMetaObjectCallback( + HostInitializeImportMetaObjectCallback callback); + Handle<JSObject> RunHostInitializeImportMetaObjectCallback( + Handle<Module> module); + void SetRAILMode(RAILMode rail_mode); RAILMode rail_mode() { return rail_mode_.Value(); } @@ -1337,7 +1362,7 @@ class Isolate { protected: explicit Isolate(bool enable_serializer); - bool IsArrayOrObjectPrototype(Object* object); + bool IsArrayOrObjectOrStringPrototype(Object* object); private: friend struct GlobalState; @@ -1500,12 +1525,14 @@ class Isolate { std::vector<int> regexp_indices_; DateCache* date_cache_; CallInterfaceDescriptorData* call_descriptor_data_; - AccessCompilerData* access_compiler_data_; base::RandomNumberGenerator* random_number_generator_; + base::RandomNumberGenerator* fuzzer_rng_; base::AtomicValue<RAILMode> rail_mode_; bool promise_hook_or_debug_is_active_; PromiseHook promise_hook_; HostImportModuleDynamicallyCallback host_import_module_dynamically_callback_; + HostInitializeImportMetaObjectCallback + host_initialize_import_meta_object_callback_; base::Mutex rail_mutex_; double load_start_time_ms_; @@ -1529,6 +1556,8 @@ class Isolate { double time_millis_at_init_; #ifdef DEBUG + static base::AtomicNumber<size_t> non_disposed_isolates_; + // A static array of histogram info for each type. HistogramInfo heap_histograms_[LAST_TYPE + 1]; JSObject::SpillInformation js_spill_information_; @@ -1576,6 +1605,8 @@ class Isolate { // Counts deopt points if deopt_every_n_times is enabled. unsigned int stress_deopt_count_; + bool force_slow_path_; + int next_optimization_id_; #if V8_SFI_HAS_UNIQUE_ID @@ -1623,6 +1654,8 @@ class Isolate { size_t elements_deletion_counter_ = 0; + std::unique_ptr<wasm::WasmCodeManager> wasm_code_manager_; + // The top entry of the v8::Context::BackupIncumbentScope stack. const v8::Context::BackupIncumbentScope* top_backup_incumbent_scope_ = nullptr; @@ -1792,15 +1825,13 @@ class PostponeInterruptsScope BASE_EMBEDDED { class CodeTracer final : public Malloced { public: - explicit CodeTracer(int isolate_id) - : file_(NULL), - scope_depth_(0) { + explicit CodeTracer(int isolate_id) : file_(nullptr), scope_depth_(0) { if (!ShouldRedirect()) { file_ = stdout; return; } - if (FLAG_redirect_code_traces_to == NULL) { + if (FLAG_redirect_code_traces_to == nullptr) { SNPrintF(filename_, "code-%d-%d.asm", base::OS::GetCurrentProcessId(), @@ -1828,7 +1859,7 @@ class CodeTracer final : public Malloced { return; } - if (file_ == NULL) { + if (file_ == nullptr) { file_ = base::OS::FOpen(filename_.start(), "ab"); } @@ -1842,7 +1873,7 @@ class CodeTracer final : public Malloced { if (--scope_depth_ == 0) { fclose(file_); - file_ = NULL; + file_ = nullptr; } } |