summaryrefslogtreecommitdiff
path: root/deps/v8/src/compiler/js-heap-broker.h
diff options
context:
space:
mode:
authorMatheus Marchini <mmarchini@netflix.com>2020-03-05 10:49:19 -0800
committerMatheus Marchini <mmarchini@netflix.com>2020-03-18 16:23:22 -0700
commit2883c855e0105b51e5c8020d21458af109ffe3d4 (patch)
tree26777aad0a398e9f7755c8b65ac76827fe352a81 /deps/v8/src/compiler/js-heap-broker.h
parent5f0af2af2a67216e00fe07ccda11e889d14abfcd (diff)
downloadnode-new-2883c855e0105b51e5c8020d21458af109ffe3d4.tar.gz
deps: update V8 to 8.1.307.20
PR-URL: https://github.com/nodejs/node/pull/32116 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'deps/v8/src/compiler/js-heap-broker.h')
-rw-r--r--deps/v8/src/compiler/js-heap-broker.h47
1 files changed, 40 insertions, 7 deletions
diff --git a/deps/v8/src/compiler/js-heap-broker.h b/deps/v8/src/compiler/js-heap-broker.h
index c9667a2fed..0cd5df2944 100644
--- a/deps/v8/src/compiler/js-heap-broker.h
+++ b/deps/v8/src/compiler/js-heap-broker.h
@@ -12,11 +12,13 @@
#include "src/compiler/feedback-source.h"
#include "src/compiler/processed-feedback.h"
#include "src/compiler/refs-map.h"
+#include "src/compiler/serializer-hints.h"
#include "src/handles/handles.h"
#include "src/interpreter/bytecode-array-accessor.h"
#include "src/objects/feedback-vector.h"
#include "src/objects/function-kind.h"
#include "src/objects/objects.h"
+#include "src/utils/address-map.h"
#include "src/utils/ostreams.h"
#include "src/zone/zone-containers.h"
@@ -71,7 +73,8 @@ struct PropertyAccessTarget {
class V8_EXPORT_PRIVATE JSHeapBroker {
public:
- JSHeapBroker(Isolate* isolate, Zone* broker_zone, bool tracing_enabled);
+ JSHeapBroker(Isolate* isolate, Zone* broker_zone, bool tracing_enabled,
+ bool is_concurrent_inlining);
// The compilation target's native context. We need the setter because at
// broker construction time we don't yet have the canonical handle.
@@ -83,8 +86,9 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
void InitializeAndStartSerializing(Handle<NativeContext> native_context);
Isolate* isolate() const { return isolate_; }
- Zone* zone() const { return current_zone_; }
+ Zone* zone() const { return zone_; }
bool tracing_enabled() const { return tracing_enabled_; }
+ bool is_concurrent_inlining() const { return is_concurrent_inlining_; }
enum BrokerMode { kDisabled, kSerializing, kSerialized, kRetired };
BrokerMode mode() const { return mode_; }
@@ -96,8 +100,9 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
void PrintRefsAnalysis() const;
#endif // DEBUG
- // Returns nullptr iff handle unknown.
- ObjectData* GetData(Handle<Object>) const;
+ // Retruns the handle from root index table for read only heap objects.
+ Handle<Object> GetRootHandle(Object object);
+
// Never returns nullptr.
ObjectData* GetOrCreateData(Handle<Object>);
// Like the previous but wraps argument in handle first (for convenience).
@@ -179,10 +184,21 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
StringRef GetTypedArrayStringTag(ElementsKind kind);
+ bool ShouldBeSerializedForCompilation(const SharedFunctionInfoRef& shared,
+ const FeedbackVectorRef& feedback,
+ const HintsVector& arguments) const;
+ void SetSerializedForCompilation(const SharedFunctionInfoRef& shared,
+ const FeedbackVectorRef& feedback,
+ const HintsVector& arguments);
+ bool IsSerializedForCompilation(const SharedFunctionInfoRef& shared,
+ const FeedbackVectorRef& feedback) const;
+
std::ostream& Trace() const;
void IncrementTracingIndentation();
void DecrementTracingIndentation();
+ RootIndexMap const& root_index_map() { return root_index_map_; }
+
private:
friend class HeapObjectRef;
friend class ObjectRef;
@@ -211,22 +227,22 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
ProcessedFeedback const& ReadFeedbackForTemplateObject(
FeedbackSource const& source);
- void InitializeRefsMap();
void CollectArrayAndObjectPrototypes();
void SerializeTypedArrayStringTags();
PerIsolateCompilerCache* compiler_cache() const { return compiler_cache_; }
Isolate* const isolate_;
- Zone* const broker_zone_;
- Zone* current_zone_ = nullptr;
+ Zone* const zone_ = nullptr;
base::Optional<NativeContextRef> target_native_context_;
RefsMap* refs_;
+ RootIndexMap root_index_map_;
ZoneUnorderedSet<Handle<JSObject>, Handle<JSObject>::hash,
Handle<JSObject>::equal_to>
array_and_object_prototypes_;
BrokerMode mode_ = kDisabled;
bool const tracing_enabled_;
+ bool const is_concurrent_inlining_;
mutable StdoutStream trace_out_;
unsigned trace_indentation_ = 0;
PerIsolateCompilerCache* compiler_cache_ = nullptr;
@@ -240,6 +256,23 @@ class V8_EXPORT_PRIVATE JSHeapBroker {
ZoneVector<ObjectData*> typed_array_string_tags_;
+ struct SerializedFunction {
+ SharedFunctionInfoRef shared;
+ FeedbackVectorRef feedback;
+
+ bool operator<(const SerializedFunction& other) const {
+ if (shared.object().address() < other.shared.object().address()) {
+ return true;
+ }
+ if (shared.object().address() == other.shared.object().address()) {
+ return feedback.object().address() < other.feedback.object().address();
+ }
+ return false;
+ }
+ };
+ ZoneMultimap<SerializedFunction, HintsVector> serialized_functions_;
+
+ static const size_t kMaxSerializedFunctionsCacheSize = 200;
static const size_t kMinimalRefsBucketCount = 8; // must be power of 2
static const size_t kInitialRefsBucketCount = 1024; // must be power of 2
};