Commit e1bab0b6 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[explicit isolates] Convert CSA to use ReadOnlyRoots

In future the RO_SPACE root accessors in Heap will become private, so
instead convert them all to use ReadOnlyRoots.

Splits HEAP_CONSTANT_LIST into HEAP_MUTABLE_IMMOVABLE_OBJECT_LIST and
HEAP_IMMUTABLE_IMMOVABLE_OBJECT_LIST. The CSA accessors then use the
appropiate ReadOnlyRoots or Heap accessor to get hold of the object.

Bug: v8:7786
Change-Id: I3bdf868b5e224f8794c85307e1b4569480cebd1c
Reviewed-on: https://chromium-review.googlesource.com/1125725Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54199}
parent 2265a852
...@@ -218,7 +218,18 @@ TNode<Object> CodeStubAssembler::NoContextConstant() { ...@@ -218,7 +218,18 @@ TNode<Object> CodeStubAssembler::NoContextConstant() {
*std::declval<Heap>().rootAccessorName())>::type>( \ *std::declval<Heap>().rootAccessorName())>::type>( \
LoadRoot(Heap::k##rootIndexName##RootIndex)); \ LoadRoot(Heap::k##rootIndexName##RootIndex)); \
} }
HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR); HEAP_MUTABLE_IMMOVABLE_OBJECT_LIST(HEAP_CONSTANT_ACCESSOR);
#undef HEAP_CONSTANT_ACCESSOR
#define HEAP_CONSTANT_ACCESSOR(rootIndexName, rootAccessorName, name) \
compiler::TNode<std::remove_reference<decltype( \
*std::declval<ReadOnlyRoots>().rootAccessorName())>::type> \
CodeStubAssembler::name##Constant() { \
return UncheckedCast<std::remove_reference<decltype( \
*std::declval<ReadOnlyRoots>().rootAccessorName())>::type>( \
LoadRoot(Heap::k##rootIndexName##RootIndex)); \
}
HEAP_IMMUTABLE_IMMOVABLE_OBJECT_LIST(HEAP_CONSTANT_ACCESSOR);
#undef HEAP_CONSTANT_ACCESSOR #undef HEAP_CONSTANT_ACCESSOR
#define HEAP_CONSTANT_TEST(rootIndexName, rootAccessorName, name) \ #define HEAP_CONSTANT_TEST(rootIndexName, rootAccessorName, name) \
...@@ -230,7 +241,7 @@ HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR); ...@@ -230,7 +241,7 @@ HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR);
SloppyTNode<Object> value) { \ SloppyTNode<Object> value) { \
return WordNotEqual(value, name##Constant()); \ return WordNotEqual(value, name##Constant()); \
} }
HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST); HEAP_IMMOVABLE_OBJECT_LIST(HEAP_CONSTANT_TEST);
#undef HEAP_CONSTANT_TEST #undef HEAP_CONSTANT_TEST
TNode<Int32T> CodeStubAssembler::HashSeed() { TNode<Int32T> CodeStubAssembler::HashSeed() {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "src/compiler/code-assembler.h" #include "src/compiler/code-assembler.h"
#include "src/globals.h" #include "src/globals.h"
#include "src/objects.h" #include "src/objects.h"
#include "src/roots.h"
namespace v8 { namespace v8 {
namespace internal { namespace internal {
...@@ -23,18 +24,25 @@ class StubCache; ...@@ -23,18 +24,25 @@ class StubCache;
enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
#define HEAP_CONSTANT_LIST(V) \ #define HEAP_MUTABLE_IMMOVABLE_OBJECT_LIST(V) \
V(ArraySpeciesProtector, array_species_protector, ArraySpeciesProtector) \
V(EmptyPropertyDictionary, empty_property_dictionary, \
EmptyPropertyDictionary) \
V(PromiseSpeciesProtector, promise_species_protector, \
PromiseSpeciesProtector) \
V(TypedArraySpeciesProtector, typed_array_species_protector, \
TypedArraySpeciesProtector) \
V(StoreHandler0Map, store_handler0_map, StoreHandler0Map)
#define HEAP_IMMUTABLE_IMMOVABLE_OBJECT_LIST(V) \
V(AccessorInfoMap, accessor_info_map, AccessorInfoMap) \ V(AccessorInfoMap, accessor_info_map, AccessorInfoMap) \
V(AccessorPairMap, accessor_pair_map, AccessorPairMap) \ V(AccessorPairMap, accessor_pair_map, AccessorPairMap) \
V(AllocationSiteWithWeakNextMap, allocation_site_map, AllocationSiteMap) \ V(AllocationSiteWithWeakNextMap, allocation_site_map, AllocationSiteMap) \
V(AllocationSiteWithoutWeakNextMap, allocation_site_without_weaknext_map, \ V(AllocationSiteWithoutWeakNextMap, allocation_site_without_weaknext_map, \
AllocationSiteWithoutWeakNextMap) \ AllocationSiteWithoutWeakNextMap) \
V(ArraySpeciesProtector, array_species_protector, ArraySpeciesProtector) \
V(BooleanMap, boolean_map, BooleanMap) \ V(BooleanMap, boolean_map, BooleanMap) \
V(CodeMap, code_map, CodeMap) \ V(CodeMap, code_map, CodeMap) \
V(EmptyFixedArray, empty_fixed_array, EmptyFixedArray) \ V(EmptyFixedArray, empty_fixed_array, EmptyFixedArray) \
V(EmptyPropertyDictionary, empty_property_dictionary, \
EmptyPropertyDictionary) \
V(EmptySlowElementDictionary, empty_slow_element_dictionary, \ V(EmptySlowElementDictionary, empty_slow_element_dictionary, \
EmptySlowElementDictionary) \ EmptySlowElementDictionary) \
V(empty_string, empty_string, EmptyString) \ V(empty_string, empty_string, EmptyString) \
...@@ -59,23 +67,22 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; ...@@ -59,23 +67,22 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
V(NoClosuresCellMap, no_closures_cell_map, NoClosuresCellMap) \ V(NoClosuresCellMap, no_closures_cell_map, NoClosuresCellMap) \
V(NullValue, null_value, Null) \ V(NullValue, null_value, Null) \
V(OneClosureCellMap, one_closure_cell_map, OneClosureCellMap) \ V(OneClosureCellMap, one_closure_cell_map, OneClosureCellMap) \
V(PromiseSpeciesProtector, promise_species_protector, \
PromiseSpeciesProtector) \
V(prototype_string, prototype_string, PrototypeString) \ V(prototype_string, prototype_string, PrototypeString) \
V(SharedFunctionInfoMap, shared_function_info_map, SharedFunctionInfoMap) \ V(SharedFunctionInfoMap, shared_function_info_map, SharedFunctionInfoMap) \
V(StoreHandler0Map, store_handler0_map, StoreHandler0Map) \
V(SymbolMap, symbol_map, SymbolMap) \ V(SymbolMap, symbol_map, SymbolMap) \
V(TheHoleValue, the_hole_value, TheHole) \ V(TheHoleValue, the_hole_value, TheHole) \
V(TransitionArrayMap, transition_array_map, TransitionArrayMap) \ V(TransitionArrayMap, transition_array_map, TransitionArrayMap) \
V(TrueValue, true_value, True) \ V(TrueValue, true_value, True) \
V(Tuple2Map, tuple2_map, Tuple2Map) \ V(Tuple2Map, tuple2_map, Tuple2Map) \
V(Tuple3Map, tuple3_map, Tuple3Map) \ V(Tuple3Map, tuple3_map, Tuple3Map) \
V(TypedArraySpeciesProtector, typed_array_species_protector, \
TypedArraySpeciesProtector) \
V(UndefinedValue, undefined_value, Undefined) \ V(UndefinedValue, undefined_value, Undefined) \
V(WeakCellMap, weak_cell_map, WeakCellMap) \ V(WeakCellMap, weak_cell_map, WeakCellMap) \
V(WeakFixedArrayMap, weak_fixed_array_map, WeakFixedArrayMap) V(WeakFixedArrayMap, weak_fixed_array_map, WeakFixedArrayMap)
#define HEAP_IMMOVABLE_OBJECT_LIST(V) \
HEAP_MUTABLE_IMMOVABLE_OBJECT_LIST(V) \
HEAP_IMMUTABLE_IMMOVABLE_OBJECT_LIST(V)
// Returned from IteratorBuiltinsAssembler::GetIterator(). Struct is declared // Returned from IteratorBuiltinsAssembler::GetIterator(). Struct is declared
// here to simplify use in other generated builtins. // here to simplify use in other generated builtins.
struct IteratorRecord { struct IteratorRecord {
...@@ -401,17 +408,25 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -401,17 +408,25 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
#undef PARAMETER_BINOP #undef PARAMETER_BINOP
TNode<Object> NoContextConstant(); TNode<Object> NoContextConstant();
#define HEAP_CONSTANT_ACCESSOR(rootIndexName, rootAccessorName, name) \
compiler::TNode<std::remove_reference<decltype( \
*std::declval<ReadOnlyRoots>().rootAccessorName())>::type> \
name##Constant();
HEAP_IMMUTABLE_IMMOVABLE_OBJECT_LIST(HEAP_CONSTANT_ACCESSOR)
#undef HEAP_CONSTANT_ACCESSOR
#define HEAP_CONSTANT_ACCESSOR(rootIndexName, rootAccessorName, name) \ #define HEAP_CONSTANT_ACCESSOR(rootIndexName, rootAccessorName, name) \
compiler::TNode<std::remove_reference<decltype( \ compiler::TNode<std::remove_reference<decltype( \
*std::declval<Heap>().rootAccessorName())>::type> \ *std::declval<Heap>().rootAccessorName())>::type> \
name##Constant(); name##Constant();
HEAP_CONSTANT_LIST(HEAP_CONSTANT_ACCESSOR) HEAP_MUTABLE_IMMOVABLE_OBJECT_LIST(HEAP_CONSTANT_ACCESSOR)
#undef HEAP_CONSTANT_ACCESSOR #undef HEAP_CONSTANT_ACCESSOR
#define HEAP_CONSTANT_TEST(rootIndexName, rootAccessorName, name) \ #define HEAP_CONSTANT_TEST(rootIndexName, rootAccessorName, name) \
TNode<BoolT> Is##name(SloppyTNode<Object> value); \ TNode<BoolT> Is##name(SloppyTNode<Object> value); \
TNode<BoolT> IsNot##name(SloppyTNode<Object> value); TNode<BoolT> IsNot##name(SloppyTNode<Object> value);
HEAP_CONSTANT_LIST(HEAP_CONSTANT_TEST) HEAP_IMMOVABLE_OBJECT_LIST(HEAP_CONSTANT_TEST)
#undef HEAP_CONSTANT_TEST #undef HEAP_CONSTANT_TEST
TNode<Int32T> HashSeed(); TNode<Int32T> HashSeed();
......
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