Line data Source code
1 : // Copyright 2018 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #ifndef V8_COMPILER_JS_HEAP_BROKER_H_
6 : #define V8_COMPILER_JS_HEAP_BROKER_H_
7 :
8 : #include "src/base/compiler-specific.h"
9 : #include "src/base/optional.h"
10 : #include "src/compiler/refs-map.h"
11 : #include "src/globals.h"
12 : #include "src/handles.h"
13 : #include "src/objects.h"
14 : #include "src/objects/builtin-function-id.h"
15 : #include "src/objects/instance-type.h"
16 : #include "src/zone/zone-containers.h"
17 :
18 : namespace v8 {
19 : namespace internal {
20 :
21 : class BytecodeArray;
22 : class FixedDoubleArray;
23 : class HeapNumber;
24 : class InternalizedString;
25 : class JSBoundFunction;
26 : class JSDataView;
27 : class JSGlobalProxy;
28 : class JSRegExp;
29 : class JSTypedArray;
30 : class NativeContext;
31 : class ScriptContextTable;
32 :
33 : namespace compiler {
34 :
35 : enum class OddballType : uint8_t {
36 : kNone, // Not an Oddball.
37 : kBoolean, // True or False.
38 : kUndefined,
39 : kNull,
40 : kHole,
41 : kUninitialized,
42 : kOther // Oddball, but none of the above.
43 : };
44 :
45 : // This list is sorted such that subtypes appear before their supertypes.
46 : // DO NOT VIOLATE THIS PROPERTY!
47 : #define HEAP_BROKER_OBJECT_LIST(V) \
48 : /* Subtypes of JSObject */ \
49 : V(JSArray) \
50 : V(JSBoundFunction) \
51 : V(JSDataView) \
52 : V(JSFunction) \
53 : V(JSGlobalProxy) \
54 : V(JSRegExp) \
55 : V(JSTypedArray) \
56 : /* Subtypes of Context */ \
57 : V(NativeContext) \
58 : /* Subtypes of FixedArray */ \
59 : V(Context) \
60 : V(ScopeInfo) \
61 : V(ScriptContextTable) \
62 : /* Subtypes of FixedArrayBase */ \
63 : V(BytecodeArray) \
64 : V(FixedArray) \
65 : V(FixedDoubleArray) \
66 : /* Subtypes of Name */ \
67 : V(InternalizedString) \
68 : V(String) \
69 : V(Symbol) \
70 : /* Subtypes of HeapObject */ \
71 : V(AllocationSite) \
72 : V(Cell) \
73 : V(Code) \
74 : V(DescriptorArray) \
75 : V(FeedbackVector) \
76 : V(FixedArrayBase) \
77 : V(HeapNumber) \
78 : V(JSObject) \
79 : V(Map) \
80 : V(Module) \
81 : V(MutableHeapNumber) \
82 : V(Name) \
83 : V(PropertyCell) \
84 : V(SharedFunctionInfo) \
85 : /* Subtypes of Object */ \
86 : V(HeapObject)
87 :
88 : class CompilationDependencies;
89 : class JSHeapBroker;
90 : class ObjectData;
91 : class PerIsolateCompilerCache;
92 : #define FORWARD_DECL(Name) class Name##Ref;
93 : HEAP_BROKER_OBJECT_LIST(FORWARD_DECL)
94 : #undef FORWARD_DECL
95 :
96 : class ObjectRef {
97 : public:
98 : ObjectRef(JSHeapBroker* broker, Handle<Object> object);
99 : ObjectRef(JSHeapBroker* broker, ObjectData* data)
100 458152 : : data_(data), broker_(broker) {
101 90237567 : CHECK_NOT_NULL(data_);
102 : }
103 :
104 : Handle<Object> object() const;
105 :
106 : bool equals(const ObjectRef& other) const;
107 :
108 : bool IsSmi() const;
109 : int AsSmi() const;
110 :
111 : #define HEAP_IS_METHOD_DECL(Name) bool Is##Name() const;
112 : HEAP_BROKER_OBJECT_LIST(HEAP_IS_METHOD_DECL)
113 : #undef HEAP_IS_METHOD_DECL
114 :
115 : #define HEAP_AS_METHOD_DECL(Name) Name##Ref As##Name() const;
116 : HEAP_BROKER_OBJECT_LIST(HEAP_AS_METHOD_DECL)
117 : #undef HEAP_AS_METHOD_DECL
118 :
119 : bool IsNullOrUndefined() const;
120 :
121 : bool BooleanValue() const;
122 : double OddballToNumber() const;
123 :
124 : Isolate* isolate() const;
125 :
126 : protected:
127 : JSHeapBroker* broker() const;
128 : ObjectData* data() const;
129 : ObjectData* data_; // Should be used only by object() getters.
130 :
131 : private:
132 : JSHeapBroker* broker_;
133 : };
134 :
135 : // Temporary class that carries information from a Map. We'd like to remove
136 : // this class and use MapRef instead, but we can't as long as we support the
137 : // kDisabled broker mode. That's because obtaining the MapRef via
138 : // HeapObjectRef::map() requires a HandleScope when the broker is disabled.
139 : // During OptimizeGraph we generally don't have a HandleScope, however. There
140 : // are two places where we therefore use GetHeapObjectType() instead. Both that
141 : // function and this class should eventually be removed.
142 : class HeapObjectType {
143 : public:
144 : enum Flag : uint8_t { kUndetectable = 1 << 0, kCallable = 1 << 1 };
145 :
146 : typedef base::Flags<Flag> Flags;
147 :
148 : HeapObjectType(InstanceType instance_type, Flags flags,
149 : OddballType oddball_type)
150 : : instance_type_(instance_type),
151 : oddball_type_(oddball_type),
152 : flags_(flags) {
153 : DCHECK_EQ(instance_type == ODDBALL_TYPE,
154 : oddball_type != OddballType::kNone);
155 : }
156 :
157 : OddballType oddball_type() const { return oddball_type_; }
158 : InstanceType instance_type() const { return instance_type_; }
159 : Flags flags() const { return flags_; }
160 :
161 : bool is_callable() const { return flags_ & kCallable; }
162 : bool is_undetectable() const { return flags_ & kUndetectable; }
163 :
164 : private:
165 : InstanceType const instance_type_;
166 : OddballType const oddball_type_;
167 : Flags const flags_;
168 : };
169 :
170 : class HeapObjectRef : public ObjectRef {
171 : public:
172 53291455 : using ObjectRef::ObjectRef;
173 : Handle<HeapObject> object() const;
174 :
175 : MapRef map() const;
176 :
177 : // See the comment on the HeapObjectType class.
178 : HeapObjectType GetHeapObjectType() const;
179 : };
180 :
181 : class PropertyCellRef : public HeapObjectRef {
182 : public:
183 : using HeapObjectRef::HeapObjectRef;
184 : Handle<PropertyCell> object() const;
185 :
186 : PropertyDetails property_details() const;
187 : ObjectRef value() const;
188 : };
189 :
190 : class JSObjectRef : public HeapObjectRef {
191 : public:
192 : using HeapObjectRef::HeapObjectRef;
193 : Handle<JSObject> object() const;
194 :
195 : double RawFastDoublePropertyAt(FieldIndex index) const;
196 : ObjectRef RawFastPropertyAt(FieldIndex index) const;
197 :
198 : FixedArrayBaseRef elements() const;
199 : void EnsureElementsTenured();
200 : ElementsKind GetElementsKind() const;
201 :
202 : void SerializeObjectCreateMap();
203 : base::Optional<MapRef> GetObjectCreateMap() const;
204 : };
205 :
206 : class JSDataViewRef : public JSObjectRef {
207 : public:
208 : using JSObjectRef::JSObjectRef;
209 : Handle<JSDataView> object() const;
210 :
211 : size_t byte_length() const;
212 : size_t byte_offset() const;
213 : };
214 :
215 : class JSBoundFunctionRef : public JSObjectRef {
216 : public:
217 : using JSObjectRef::JSObjectRef;
218 : Handle<JSBoundFunction> object() const;
219 :
220 : void Serialize();
221 :
222 : // The following are available only after calling Serialize().
223 : ObjectRef bound_target_function() const;
224 : ObjectRef bound_this() const;
225 : FixedArrayRef bound_arguments() const;
226 : };
227 :
228 : class JSFunctionRef : public JSObjectRef {
229 : public:
230 : using JSObjectRef::JSObjectRef;
231 : Handle<JSFunction> object() const;
232 :
233 : bool has_initial_map() const;
234 : bool has_prototype() const;
235 : bool PrototypeRequiresRuntimeLookup() const;
236 :
237 : void Serialize();
238 : void SetSerializedForCompilation();
239 :
240 : bool serialized_for_compilation() const;
241 :
242 : // The following are available only after calling Serialize().
243 : ObjectRef prototype() const;
244 : MapRef initial_map() const;
245 : ContextRef context() const;
246 : NativeContextRef native_context() const;
247 : SharedFunctionInfoRef shared() const;
248 : int InitialMapInstanceSizeWithMinSlack() const;
249 : };
250 :
251 : class JSRegExpRef : public JSObjectRef {
252 : public:
253 : using JSObjectRef::JSObjectRef;
254 : Handle<JSRegExp> object() const;
255 :
256 : ObjectRef raw_properties_or_hash() const;
257 : ObjectRef data() const;
258 : ObjectRef source() const;
259 : ObjectRef flags() const;
260 : ObjectRef last_index() const;
261 : };
262 :
263 : class HeapNumberRef : public HeapObjectRef {
264 : public:
265 : using HeapObjectRef::HeapObjectRef;
266 : Handle<HeapNumber> object() const;
267 :
268 : double value() const;
269 : };
270 :
271 : class MutableHeapNumberRef : public HeapObjectRef {
272 : public:
273 : using HeapObjectRef::HeapObjectRef;
274 : Handle<MutableHeapNumber> object() const;
275 :
276 : double value() const;
277 : };
278 :
279 : class ContextRef : public HeapObjectRef {
280 : public:
281 : using HeapObjectRef::HeapObjectRef;
282 : Handle<Context> object() const;
283 :
284 : void Serialize();
285 : ContextRef previous() const;
286 : ObjectRef get(int index) const;
287 : };
288 :
289 : #define BROKER_COMPULSORY_NATIVE_CONTEXT_FIELDS(V) \
290 : V(JSFunction, array_function) \
291 : V(JSFunction, boolean_function) \
292 : V(JSFunction, bigint_function) \
293 : V(JSFunction, number_function) \
294 : V(JSFunction, object_function) \
295 : V(JSFunction, promise_function) \
296 : V(JSFunction, promise_then) \
297 : V(JSFunction, string_function) \
298 : V(JSFunction, symbol_function) \
299 : V(JSGlobalProxy, global_proxy_object) \
300 : V(JSObject, promise_prototype) \
301 : V(Map, bound_function_with_constructor_map) \
302 : V(Map, bound_function_without_constructor_map) \
303 : V(Map, fast_aliased_arguments_map) \
304 : V(Map, initial_array_iterator_map) \
305 : V(Map, initial_string_iterator_map) \
306 : V(Map, iterator_result_map) \
307 : V(Map, js_array_holey_double_elements_map) \
308 : V(Map, js_array_holey_elements_map) \
309 : V(Map, js_array_holey_smi_elements_map) \
310 : V(Map, js_array_packed_double_elements_map) \
311 : V(Map, js_array_packed_elements_map) \
312 : V(Map, js_array_packed_smi_elements_map) \
313 : V(Map, sloppy_arguments_map) \
314 : V(Map, slow_object_with_null_prototype_map) \
315 : V(Map, strict_arguments_map) \
316 : V(ScriptContextTable, script_context_table) \
317 : V(SharedFunctionInfo, promise_capability_default_reject_shared_fun) \
318 : V(SharedFunctionInfo, promise_catch_finally_shared_fun) \
319 : V(SharedFunctionInfo, promise_then_finally_shared_fun) \
320 : V(SharedFunctionInfo, promise_capability_default_resolve_shared_fun)
321 :
322 : // Those are set by Bootstrapper::ExportFromRuntime, which may not yet have
323 : // happened when Turbofan is invoked via --always-opt.
324 : #define BROKER_OPTIONAL_NATIVE_CONTEXT_FIELDS(V) \
325 : V(Map, async_function_object_map) \
326 : V(Map, map_key_iterator_map) \
327 : V(Map, map_key_value_iterator_map) \
328 : V(Map, map_value_iterator_map) \
329 : V(Map, set_key_value_iterator_map) \
330 : V(Map, set_value_iterator_map)
331 :
332 : #define BROKER_NATIVE_CONTEXT_FIELDS(V) \
333 : BROKER_COMPULSORY_NATIVE_CONTEXT_FIELDS(V) \
334 : BROKER_OPTIONAL_NATIVE_CONTEXT_FIELDS(V)
335 :
336 : class NativeContextRef : public ContextRef {
337 : public:
338 : using ContextRef::ContextRef;
339 : Handle<NativeContext> object() const;
340 :
341 : void Serialize();
342 :
343 : #define DECL_ACCESSOR(type, name) type##Ref name() const;
344 : BROKER_NATIVE_CONTEXT_FIELDS(DECL_ACCESSOR)
345 : #undef DECL_ACCESSOR
346 :
347 : MapRef GetFunctionMapFromIndex(int index) const;
348 : MapRef GetInitialJSArrayMap(ElementsKind kind) const;
349 : base::Optional<JSFunctionRef> GetConstructorFunction(const MapRef& map) const;
350 : };
351 :
352 : class NameRef : public HeapObjectRef {
353 : public:
354 : using HeapObjectRef::HeapObjectRef;
355 : Handle<Name> object() const;
356 : };
357 :
358 : class ScriptContextTableRef : public HeapObjectRef {
359 : public:
360 : using HeapObjectRef::HeapObjectRef;
361 : Handle<ScriptContextTable> object() const;
362 :
363 : struct LookupResult {
364 : ContextRef context;
365 : bool immutable;
366 : int index;
367 : };
368 :
369 : base::Optional<LookupResult> lookup(const NameRef& name) const;
370 : };
371 :
372 : class DescriptorArrayRef : public HeapObjectRef {
373 : public:
374 : using HeapObjectRef::HeapObjectRef;
375 : Handle<DescriptorArray> object() const;
376 : };
377 :
378 : class FeedbackVectorRef : public HeapObjectRef {
379 : public:
380 : using HeapObjectRef::HeapObjectRef;
381 : Handle<FeedbackVector> object() const;
382 :
383 : ObjectRef get(FeedbackSlot slot) const;
384 :
385 : void SerializeSlots();
386 : };
387 :
388 : class AllocationSiteRef : public HeapObjectRef {
389 : public:
390 : using HeapObjectRef::HeapObjectRef;
391 : Handle<AllocationSite> object() const;
392 :
393 : bool PointsToLiteral() const;
394 : PretenureFlag GetPretenureMode() const;
395 : ObjectRef nested_site() const;
396 :
397 : // {IsFastLiteral} determines whether the given array or object literal
398 : // boilerplate satisfies all limits to be considered for fast deep-copying
399 : // and computes the total size of all objects that are part of the graph.
400 : //
401 : // If PointsToLiteral() is false, then IsFastLiteral() is also false.
402 : bool IsFastLiteral() const;
403 : // We only serialize boilerplate if IsFastLiteral is true.
404 : base::Optional<JSObjectRef> boilerplate() const;
405 :
406 : ElementsKind GetElementsKind() const;
407 : bool CanInlineCall() const;
408 : };
409 :
410 : class MapRef : public HeapObjectRef {
411 : public:
412 : using HeapObjectRef::HeapObjectRef;
413 : Handle<Map> object() const;
414 :
415 : int instance_size() const;
416 : InstanceType instance_type() const;
417 : int GetInObjectProperties() const;
418 : int GetInObjectPropertiesStartInWords() const;
419 : int NumberOfOwnDescriptors() const;
420 : int GetInObjectPropertyOffset(int index) const;
421 : int constructor_function_index() const;
422 : int NextFreePropertyIndex() const;
423 : int UnusedPropertyFields() const;
424 : ElementsKind elements_kind() const;
425 : bool is_stable() const;
426 : bool is_extensible() const;
427 : bool is_constructor() const;
428 : bool has_prototype_slot() const;
429 : bool is_access_check_needed() const;
430 : bool is_deprecated() const;
431 : bool CanBeDeprecated() const;
432 : bool CanTransition() const;
433 : bool IsInobjectSlackTrackingInProgress() const;
434 : bool is_dictionary_map() const;
435 : bool IsFixedCowArrayMap() const;
436 : bool IsPrimitiveMap() const;
437 : bool is_undetectable() const;
438 : bool is_callable() const;
439 : bool has_hidden_prototype() const;
440 : bool supports_fast_array_iteration() const;
441 : bool supports_fast_array_resize() const;
442 :
443 : #define DEF_TESTER(Type, ...) bool Is##Type##Map() const;
444 : INSTANCE_TYPE_CHECKERS(DEF_TESTER)
445 : #undef DEF_TESTER
446 :
447 : ObjectRef GetConstructor() const;
448 :
449 : void SerializePrototype();
450 : ObjectRef prototype() const;
451 :
452 : OddballType oddball_type() const;
453 :
454 : base::Optional<MapRef> AsElementsKind(ElementsKind kind) const;
455 :
456 : // Concerning the underlying instance_descriptors:
457 : void SerializeOwnDescriptors();
458 : MapRef FindFieldOwner(int descriptor_index) const;
459 : PropertyDetails GetPropertyDetails(int descriptor_index) const;
460 : NameRef GetPropertyKey(int descriptor_index) const;
461 : FieldIndex GetFieldIndexFor(int descriptor_index) const;
462 : ObjectRef GetFieldType(int descriptor_index) const;
463 : bool IsUnboxedDoubleField(int descriptor_index) const;
464 : };
465 :
466 : class FixedArrayBaseRef : public HeapObjectRef {
467 : public:
468 : using HeapObjectRef::HeapObjectRef;
469 : Handle<FixedArrayBase> object() const;
470 :
471 : int length() const;
472 : };
473 :
474 : class FixedArrayRef : public FixedArrayBaseRef {
475 : public:
476 : using FixedArrayBaseRef::FixedArrayBaseRef;
477 : Handle<FixedArray> object() const;
478 :
479 : ObjectRef get(int i) const;
480 : };
481 :
482 : class FixedDoubleArrayRef : public FixedArrayBaseRef {
483 : public:
484 : using FixedArrayBaseRef::FixedArrayBaseRef;
485 : Handle<FixedDoubleArray> object() const;
486 :
487 : double get_scalar(int i) const;
488 : bool is_the_hole(int i) const;
489 : };
490 :
491 : class BytecodeArrayRef : public FixedArrayBaseRef {
492 : public:
493 : using FixedArrayBaseRef::FixedArrayBaseRef;
494 : Handle<BytecodeArray> object() const;
495 :
496 : int register_count() const;
497 : };
498 :
499 : class JSArrayRef : public JSObjectRef {
500 : public:
501 : using JSObjectRef::JSObjectRef;
502 : Handle<JSArray> object() const;
503 :
504 : ObjectRef length() const;
505 : };
506 :
507 : class ScopeInfoRef : public HeapObjectRef {
508 : public:
509 : using HeapObjectRef::HeapObjectRef;
510 : Handle<ScopeInfo> object() const;
511 :
512 : int ContextLength() const;
513 : };
514 :
515 : #define BROKER_SFI_FIELDS(V) \
516 : V(int, internal_formal_parameter_count) \
517 : V(bool, has_duplicate_parameters) \
518 : V(int, function_map_index) \
519 : V(FunctionKind, kind) \
520 : V(LanguageMode, language_mode) \
521 : V(bool, native) \
522 : V(bool, HasBreakInfo) \
523 : V(bool, HasBuiltinFunctionId) \
524 : V(bool, HasBuiltinId) \
525 : V(BuiltinFunctionId, builtin_function_id) \
526 : V(bool, construct_as_builtin) \
527 : V(bool, HasBytecodeArray)
528 :
529 : class SharedFunctionInfoRef : public HeapObjectRef {
530 : public:
531 : using HeapObjectRef::HeapObjectRef;
532 : Handle<SharedFunctionInfo> object() const;
533 :
534 : int builtin_id() const;
535 : BytecodeArrayRef GetBytecodeArray() const;
536 : #define DECL_ACCESSOR(type, name) type name() const;
537 : BROKER_SFI_FIELDS(DECL_ACCESSOR)
538 : #undef DECL_ACCESSOR
539 : };
540 :
541 : class StringRef : public NameRef {
542 : public:
543 : using NameRef::NameRef;
544 : Handle<String> object() const;
545 :
546 : int length() const;
547 : uint16_t GetFirstChar();
548 : base::Optional<double> ToNumber();
549 : bool IsSeqString() const;
550 : bool IsExternalString() const;
551 : };
552 :
553 : class SymbolRef : public NameRef {
554 : public:
555 : using NameRef::NameRef;
556 : Handle<Symbol> object() const;
557 : };
558 :
559 : class JSTypedArrayRef : public JSObjectRef {
560 : public:
561 : using JSObjectRef::JSObjectRef;
562 : Handle<JSTypedArray> object() const;
563 :
564 : bool is_on_heap() const;
565 : size_t length_value() const;
566 : void* elements_external_pointer() const;
567 :
568 : void Serialize();
569 :
570 : HeapObjectRef buffer() const;
571 : };
572 :
573 : class ModuleRef : public HeapObjectRef {
574 : public:
575 : using HeapObjectRef::HeapObjectRef;
576 : Handle<Module> object() const;
577 :
578 : void Serialize();
579 :
580 : CellRef GetCell(int cell_index) const;
581 : };
582 :
583 : class CellRef : public HeapObjectRef {
584 : public:
585 : using HeapObjectRef::HeapObjectRef;
586 : Handle<Cell> object() const;
587 :
588 : ObjectRef value() const;
589 : };
590 :
591 : class JSGlobalProxyRef : public JSObjectRef {
592 : public:
593 : using JSObjectRef::JSObjectRef;
594 : Handle<JSGlobalProxy> object() const;
595 : };
596 :
597 : class CodeRef : public HeapObjectRef {
598 : public:
599 : using HeapObjectRef::HeapObjectRef;
600 : Handle<Code> object() const;
601 : };
602 :
603 : class InternalizedStringRef : public StringRef {
604 : public:
605 : using StringRef::StringRef;
606 : Handle<InternalizedString> object() const;
607 :
608 : uint32_t array_index() const;
609 : static const uint32_t kNotAnArrayIndex = -1; // 2^32-1 is not a valid index.
610 : };
611 :
612 : class V8_EXPORT_PRIVATE JSHeapBroker : public NON_EXPORTED_BASE(ZoneObject) {
613 : public:
614 : JSHeapBroker(Isolate* isolate, Zone* broker_zone);
615 : void SetNativeContextRef();
616 : void SerializeStandardObjects();
617 :
618 : Isolate* isolate() const { return isolate_; }
619 : Zone* zone() const { return current_zone_; }
620 2503266 : NativeContextRef native_context() const { return native_context_.value(); }
621 : PerIsolateCompilerCache* compiler_cache() const { return compiler_cache_; }
622 :
623 : enum BrokerMode { kDisabled, kSerializing, kSerialized, kRetired };
624 : BrokerMode mode() const { return mode_; }
625 : void StartSerializing();
626 : void StopSerializing();
627 : void Retire();
628 : bool SerializingAllowed() const;
629 :
630 : // Returns nullptr iff handle unknown.
631 : ObjectData* GetData(Handle<Object>) const;
632 : // Never returns nullptr.
633 : ObjectData* GetOrCreateData(Handle<Object>);
634 : // Like the previous but wraps argument in handle first (for convenience).
635 : ObjectData* GetOrCreateData(Object);
636 :
637 : // Check if {object} is any native context's %ArrayPrototype% or
638 : // %ObjectPrototype%.
639 : bool IsArrayOrObjectPrototype(const JSObjectRef& object) const;
640 :
641 : std::ostream& Trace() const;
642 :
643 : void IncrementTracingIndentation();
644 : void DecrementTracingIndentation();
645 :
646 : private:
647 : friend class HeapObjectRef;
648 : friend class ObjectRef;
649 : friend class ObjectData;
650 :
651 : void SerializeShareableObjects();
652 : void CollectArrayAndObjectPrototypes();
653 :
654 : Isolate* const isolate_;
655 : Zone* const broker_zone_;
656 : Zone* current_zone_;
657 : base::Optional<NativeContextRef> native_context_;
658 : RefsMap* refs_;
659 : ZoneUnorderedSet<Handle<JSObject>, Handle<JSObject>::hash,
660 : Handle<JSObject>::equal_to>
661 : array_and_object_prototypes_;
662 :
663 : BrokerMode mode_ = kDisabled;
664 : unsigned trace_indentation_ = 0;
665 : PerIsolateCompilerCache* compiler_cache_;
666 :
667 : static const size_t kMinimalRefsBucketCount = 8; // must be power of 2
668 : static const size_t kInitialRefsBucketCount = 1024; // must be power of 2
669 : };
670 :
671 : #define ASSIGN_RETURN_NO_CHANGE_IF_DATA_MISSING(something_var, \
672 : optionally_something) \
673 : auto optionally_something_ = optionally_something; \
674 : if (!optionally_something_) \
675 : return NoChangeBecauseOfMissingData(broker(), __FUNCTION__, __LINE__); \
676 : something_var = *optionally_something_;
677 :
678 : class Reduction;
679 : Reduction NoChangeBecauseOfMissingData(JSHeapBroker* broker,
680 : const char* function, int line);
681 :
682 : #define TRACE_BROKER(broker, x) \
683 : do { \
684 : if (FLAG_trace_heap_broker) broker->Trace() << x << '\n'; \
685 : } while (false)
686 :
687 : } // namespace compiler
688 : } // namespace internal
689 : } // namespace v8
690 :
691 : #endif // V8_COMPILER_JS_HEAP_BROKER_H_
|