Commit 0c917327 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Serialize JSObject boilerplates for create lowering.

Adds recursive serialization of boilerplate JSObjects. It also hooks up
serialization of FixedArrays (shallow copy of all elements).

Bug: v8:7790
Change-Id: I458133961918617ab7bdae8d14712a4e5a7d9cb5
Reviewed-on: https://chromium-review.googlesource.com/1188903Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55475}
parent ffcee2d6
...@@ -1648,7 +1648,7 @@ Node* JSCreateLowering::AllocateFastLiteral(Node* effect, Node* control, ...@@ -1648,7 +1648,7 @@ Node* JSCreateLowering::AllocateFastLiteral(Node* effect, Node* control,
MaybeHandle<Map>(), Type::Any(), MachineType::AnyTagged(), MaybeHandle<Map>(), Type::Any(), MachineType::AnyTagged(),
kFullWriteBarrier}; kFullWriteBarrier};
Node* value; Node* value;
if (boilerplate.IsUnboxedDoubleField(index)) { if (boilerplate.map().IsUnboxedDoubleField(index)) {
access.machine_type = MachineType::Float64(); access.machine_type = MachineType::Float64();
access.type = Type::Number(); access.type = Type::Number();
value = jsgraph()->Constant(boilerplate.RawFastDoublePropertyAt(index)); value = jsgraph()->Constant(boilerplate.RawFastDoublePropertyAt(index));
...@@ -1744,16 +1744,12 @@ Node* JSCreateLowering::AllocateFastLiteralElements(Node* effect, Node* control, ...@@ -1744,16 +1744,12 @@ Node* JSCreateLowering::AllocateFastLiteralElements(Node* effect, Node* control,
} else { } else {
FixedArrayRef elements = boilerplate_elements.AsFixedArray(); FixedArrayRef elements = boilerplate_elements.AsFixedArray();
for (int i = 0; i < elements_length; ++i) { for (int i = 0; i < elements_length; ++i) {
if (elements.is_the_hole(i)) { ObjectRef element_value = elements.get(i);
elements_values[i] = jsgraph()->TheHoleConstant(); if (element_value.IsJSObject()) {
elements_values[i] = effect = AllocateFastLiteral(
effect, control, element_value.AsJSObject(), pretenure);
} else { } else {
ObjectRef element_value = elements.get(i); elements_values[i] = jsgraph()->Constant(element_value);
if (element_value.IsJSObject()) {
elements_values[i] = effect = AllocateFastLiteral(
effect, control, element_value.AsJSObject(), pretenure);
} else {
elements_values[i] = jsgraph()->Constant(element_value);
}
} }
} }
} }
......
This diff is collapsed.
...@@ -163,7 +163,6 @@ class JSObjectRef : public HeapObjectRef { ...@@ -163,7 +163,6 @@ class JSObjectRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
bool IsUnboxedDoubleField(FieldIndex index) const;
double RawFastDoublePropertyAt(FieldIndex index) const; double RawFastDoublePropertyAt(FieldIndex index) const;
ObjectRef RawFastPropertyAt(FieldIndex index) const; ObjectRef RawFastPropertyAt(FieldIndex index) const;
...@@ -278,6 +277,8 @@ class FeedbackVectorRef : public HeapObjectRef { ...@@ -278,6 +277,8 @@ class FeedbackVectorRef : public HeapObjectRef {
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
ObjectRef get(FeedbackSlot slot) const; ObjectRef get(FeedbackSlot slot) const;
void SerializeSlots();
}; };
class AllocationSiteRef : public HeapObjectRef { class AllocationSiteRef : public HeapObjectRef {
...@@ -332,6 +333,7 @@ class MapRef : public HeapObjectRef { ...@@ -332,6 +333,7 @@ class MapRef : public HeapObjectRef {
NameRef GetPropertyKey(int i) const; NameRef GetPropertyKey(int i) const;
FieldIndex GetFieldIndexFor(int i) const; FieldIndex GetFieldIndexFor(int i) const;
ObjectRef GetFieldType(int descriptor) const; ObjectRef GetFieldType(int descriptor) const;
bool IsUnboxedDoubleField(FieldIndex index) const;
}; };
class FixedArrayBaseRef : public HeapObjectRef { class FixedArrayBaseRef : public HeapObjectRef {
...@@ -346,7 +348,6 @@ class FixedArrayRef : public FixedArrayBaseRef { ...@@ -346,7 +348,6 @@ class FixedArrayRef : public FixedArrayBaseRef {
using FixedArrayBaseRef::FixedArrayBaseRef; using FixedArrayBaseRef::FixedArrayBaseRef;
ObjectRef get(int i) const; ObjectRef get(int i) const;
bool is_the_hole(int i) const;
}; };
class FixedDoubleArrayRef : public FixedArrayBaseRef { class FixedDoubleArrayRef : public FixedArrayBaseRef {
......
...@@ -46,14 +46,8 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) { ...@@ -46,14 +46,8 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
break; break;
} }
case IrOpcode::kJSCreateEmptyLiteralArray: { case IrOpcode::kJSCreateEmptyLiteralArray: {
// TODO(neis, jarin) Force serialization of the entire feedback vector
// rather than just the one element.
FeedbackParameter const& p = FeedbackParameterOf(node->op()); FeedbackParameter const& p = FeedbackParameterOf(node->op());
FeedbackVectorRef(broker(), p.feedback().vector()); FeedbackVectorRef(broker(), p.feedback().vector()).SerializeSlots();
Handle<Object> feedback(
p.feedback().vector()->Get(p.feedback().slot())->ToObject(),
broker()->isolate());
ObjectRef(broker(), feedback);
break; break;
} }
case IrOpcode::kJSCreateFunctionContext: { case IrOpcode::kJSCreateFunctionContext: {
...@@ -65,7 +59,12 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) { ...@@ -65,7 +59,12 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
case IrOpcode::kJSCreateLiteralArray: case IrOpcode::kJSCreateLiteralArray:
case IrOpcode::kJSCreateLiteralObject: { case IrOpcode::kJSCreateLiteralObject: {
CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op()); CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
ObjectRef(broker(), p.feedback().vector()); FeedbackVectorRef(broker(), p.feedback().vector()).SerializeSlots();
break;
}
case IrOpcode::kJSCreateLiteralRegExp: {
CreateLiteralParameters const& p = CreateLiteralParametersOf(node->op());
FeedbackVectorRef(broker(), p.feedback().vector()).SerializeSlots();
break; break;
} }
case IrOpcode::kJSLoadNamed: case IrOpcode::kJSLoadNamed:
......
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