Commit 1868fac7 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Serialize more native context fields.

R=jarin@chromium.org

Bug: v8:7790
Change-Id: I69dd63e0f2e42591c53fa49899bd44d05b03b852
Reviewed-on: https://chromium-review.googlesource.com/1179154
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55192}
parent a880fed5
...@@ -1097,7 +1097,7 @@ Reduction JSCreateLowering::ReduceJSCreatePromise(Node* node) { ...@@ -1097,7 +1097,7 @@ Reduction JSCreateLowering::ReduceJSCreatePromise(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreatePromise, node->opcode()); DCHECK_EQ(IrOpcode::kJSCreatePromise, node->opcode());
Node* effect = NodeProperties::GetEffectInput(node); Node* effect = NodeProperties::GetEffectInput(node);
MapRef promise_map = native_context_ref().promise_function_initial_map(); MapRef promise_map = native_context_ref().promise_function().initial_map();
AllocationBuilder a(jsgraph(), effect, graph()->start()); AllocationBuilder a(jsgraph(), effect, graph()->start());
a.Allocate(promise_map.instance_size()); a.Allocate(promise_map.instance_size());
......
...@@ -92,33 +92,18 @@ class ContextData : public HeapObjectData { ...@@ -92,33 +92,18 @@ class ContextData : public HeapObjectData {
: HeapObjectData(broker_, object_, type_) {} : HeapObjectData(broker_, object_, type_) {}
}; };
#define NATIVE_CONTEXT_DATA(V) \
V(array_function) \
V(fast_aliased_arguments_map) \
V(initial_array_iterator_map) \
V(iterator_result_map) \
V(js_array_packed_elements_map) \
V(map_key_iterator_map) \
V(map_key_value_iterator_map) \
V(map_value_iterator_map) \
V(set_key_value_iterator_map) \
V(set_value_iterator_map) \
V(sloppy_arguments_map) \
V(strict_arguments_map) \
V(string_iterator_map)
class NativeContextData : public ContextData { class NativeContextData : public ContextData {
public: public:
#define DECL_MEMBER(name) ObjectData* const name; #define DECL_MEMBER(type, name) ObjectData* const name;
NATIVE_CONTEXT_DATA(DECL_MEMBER) BROKER_NATIVE_CONTEXT_FIELDS(DECL_MEMBER)
#undef DECL_MEMBER #undef DECL_MEMBER
// There's no NativeContext class, so we take object_ as Context. // There's no NativeContext class, so we take object_ as Context.
NativeContextData(JSHeapBroker* broker_, Handle<Context> object_, NativeContextData(JSHeapBroker* broker_, Handle<Context> object_,
HeapObjectType type_) HeapObjectType type_)
: ContextData(broker_, object_, type_) : ContextData(broker_, object_, type_)
#define INIT_MEMBER(name) , name(GET_OR_CREATE(name)) #define INIT_MEMBER(type, name) , name(GET_OR_CREATE(name))
NATIVE_CONTEXT_DATA(INIT_MEMBER) BROKER_NATIVE_CONTEXT_FIELDS(INIT_MEMBER)
#undef INIT_MEMBER #undef INIT_MEMBER
{ {
CHECK(object_->IsNativeContext()); CHECK(object_->IsNativeContext());
...@@ -950,21 +935,10 @@ HANDLE_ACCESSOR(Map, Object, constructor_or_backpointer) ...@@ -950,21 +935,10 @@ HANDLE_ACCESSOR(Map, Object, constructor_or_backpointer)
HANDLE_ACCESSOR_C(MutableHeapNumber, double, value) HANDLE_ACCESSOR_C(MutableHeapNumber, double, value)
BIMODAL_ACCESSOR_(NativeContext, Context, Map, fast_aliased_arguments_map) #define DEF_NATIVE_CONTEXT_ACCESSOR(type, name) \
BIMODAL_ACCESSOR_(NativeContext, Context, Map, js_array_packed_elements_map) BIMODAL_ACCESSOR_(NativeContext, Context, type, name)
BIMODAL_ACCESSOR_(NativeContext, Context, Map, sloppy_arguments_map) BROKER_NATIVE_CONTEXT_FIELDS(DEF_NATIVE_CONTEXT_ACCESSOR)
BIMODAL_ACCESSOR_(NativeContext, Context, Map, strict_arguments_map) #undef DEF_NATIVE_CONTEXT_ACCESSOR
HANDLE_ACCESSOR_(NativeContext, Context, JSFunction, array_function)
HANDLE_ACCESSOR_(NativeContext, Context, Map, initial_array_iterator_map)
HANDLE_ACCESSOR_(NativeContext, Context, Map, iterator_result_map)
HANDLE_ACCESSOR_(NativeContext, Context, Map, map_key_iterator_map)
HANDLE_ACCESSOR_(NativeContext, Context, Map, map_key_value_iterator_map)
HANDLE_ACCESSOR_(NativeContext, Context, Map, map_value_iterator_map)
HANDLE_ACCESSOR_(NativeContext, Context, Map, set_key_value_iterator_map)
HANDLE_ACCESSOR_(NativeContext, Context, Map, set_value_iterator_map)
HANDLE_ACCESSOR_(NativeContext, Context, Map, string_iterator_map)
HANDLE_ACCESSOR_(NativeContext, Context, ScriptContextTable,
script_context_table)
HANDLE_ACCESSOR(PropertyCell, Object, value) HANDLE_ACCESSOR(PropertyCell, Object, value)
HANDLE_ACCESSOR_C(PropertyCell, PropertyDetails, property_details) HANDLE_ACCESSOR_C(PropertyCell, PropertyDetails, property_details)
...@@ -1000,14 +974,6 @@ BuiltinFunctionId JSFunctionRef::GetBuiltinFunctionId() const { ...@@ -1000,14 +974,6 @@ BuiltinFunctionId JSFunctionRef::GetBuiltinFunctionId() const {
return object<JSFunction>()->shared()->builtin_function_id(); return object<JSFunction>()->shared()->builtin_function_id();
} }
MapRef NativeContextRef::promise_function_initial_map() const {
AllowHandleAllocation handle_allocation;
AllowHandleDereference allow_handle_dereference;
return MapRef(broker(),
handle(object<Context>()->promise_function()->initial_map(),
broker()->isolate()));
}
MapRef NativeContextRef::GetFunctionMapFromIndex(int index) const { MapRef NativeContextRef::GetFunctionMapFromIndex(int index) const {
DCHECK_LE(index, Context::LAST_FUNCTION_MAP_INDEX); DCHECK_LE(index, Context::LAST_FUNCTION_MAP_INDEX);
DCHECK_GE(index, Context::FIRST_FUNCTION_MAP_INDEX); DCHECK_GE(index, Context::FIRST_FUNCTION_MAP_INDEX);
...@@ -1024,11 +990,22 @@ MapRef NativeContextRef::ObjectLiteralMapFromCache() const { ...@@ -1024,11 +990,22 @@ MapRef NativeContextRef::ObjectLiteralMapFromCache() const {
} }
MapRef NativeContextRef::GetInitialJSArrayMap(ElementsKind kind) const { MapRef NativeContextRef::GetInitialJSArrayMap(ElementsKind kind) const {
AllowHandleAllocation handle_allocation; switch (kind) {
AllowHandleDereference allow_handle_dereference; case PACKED_SMI_ELEMENTS:
Handle<Map> map(object<Context>()->GetInitialJSArrayMap(kind), return js_array_packed_smi_elements_map();
broker()->isolate()); case HOLEY_SMI_ELEMENTS:
return MapRef(broker(), map); return js_array_holey_smi_elements_map();
case PACKED_DOUBLE_ELEMENTS:
return js_array_packed_double_elements_map();
case HOLEY_DOUBLE_ELEMENTS:
return js_array_holey_double_elements_map();
case PACKED_ELEMENTS:
return js_array_packed_elements_map();
case HOLEY_ELEMENTS:
return js_array_holey_elements_map();
default:
UNREACHABLE();
}
} }
bool ObjectRef::BooleanValue() { bool ObjectRef::BooleanValue() {
...@@ -1129,7 +1106,6 @@ Reduction NoChangeBecauseOfMissingData(JSHeapBroker* broker, ...@@ -1129,7 +1106,6 @@ Reduction NoChangeBecauseOfMissingData(JSHeapBroker* broker,
#undef HANDLE_ACCESSOR_ #undef HANDLE_ACCESSOR_
#undef HANDLE_ACCESSOR_C #undef HANDLE_ACCESSOR_C
#undef IF_BROKER_DISABLED_ACCESS_HANDLE_C #undef IF_BROKER_DISABLED_ACCESS_HANDLE_C
#undef NATIVE_CONTEXT_DATA
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
......
...@@ -212,26 +212,35 @@ class ContextRef : public HeapObjectRef { ...@@ -212,26 +212,35 @@ class ContextRef : public HeapObjectRef {
ObjectRef get(int index) const; ObjectRef get(int index) const;
}; };
#define BROKER_NATIVE_CONTEXT_FIELDS(V) \
V(JSFunction, array_function) \
V(JSFunction, promise_function) \
V(Map, fast_aliased_arguments_map) \
V(Map, initial_array_iterator_map) \
V(Map, iterator_result_map) \
V(Map, js_array_holey_double_elements_map) \
V(Map, js_array_holey_elements_map) \
V(Map, js_array_holey_smi_elements_map) \
V(Map, js_array_packed_double_elements_map) \
V(Map, js_array_packed_elements_map) \
V(Map, js_array_packed_smi_elements_map) \
V(Map, map_key_iterator_map) \
V(Map, map_key_value_iterator_map) \
V(Map, map_value_iterator_map) \
V(Map, set_key_value_iterator_map) \
V(Map, set_value_iterator_map) \
V(Map, sloppy_arguments_map) \
V(Map, strict_arguments_map) \
V(Map, string_iterator_map) \
V(ScriptContextTable, script_context_table)
class NativeContextRef : public ContextRef { class NativeContextRef : public ContextRef {
public: public:
using ContextRef::ContextRef; using ContextRef::ContextRef;
ScriptContextTableRef script_context_table() const; #define DECL_ACCESSOR(type, name) type##Ref name() const;
BROKER_NATIVE_CONTEXT_FIELDS(DECL_ACCESSOR)
MapRef fast_aliased_arguments_map() const; #undef DECL_ACCESSOR
MapRef sloppy_arguments_map() const;
MapRef strict_arguments_map() const;
MapRef js_array_packed_elements_map() const;
MapRef initial_array_iterator_map() const;
MapRef set_value_iterator_map() const;
MapRef set_key_value_iterator_map() const;
MapRef map_key_iterator_map() const;
MapRef map_value_iterator_map() const;
MapRef map_key_value_iterator_map() const;
MapRef iterator_result_map() const;
MapRef string_iterator_map() const;
MapRef promise_function_initial_map() const;
JSFunctionRef array_function() const;
MapRef GetFunctionMapFromIndex(int index) const; MapRef GetFunctionMapFromIndex(int index) const;
MapRef ObjectLiteralMapFromCache() const; MapRef ObjectLiteralMapFromCache() const;
......
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