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,
MaybeHandle<Map>(), Type::Any(), MachineType::AnyTagged(),
kFullWriteBarrier};
Node* value;
if (boilerplate.IsUnboxedDoubleField(index)) {
if (boilerplate.map().IsUnboxedDoubleField(index)) {
access.machine_type = MachineType::Float64();
access.type = Type::Number();
value = jsgraph()->Constant(boilerplate.RawFastDoublePropertyAt(index));
......@@ -1744,16 +1744,12 @@ Node* JSCreateLowering::AllocateFastLiteralElements(Node* effect, Node* control,
} else {
FixedArrayRef elements = boilerplate_elements.AsFixedArray();
for (int i = 0; i < elements_length; ++i) {
if (elements.is_the_hole(i)) {
elements_values[i] = jsgraph()->TheHoleConstant();
ObjectRef element_value = elements.get(i);
if (element_value.IsJSObject()) {
elements_values[i] = effect = AllocateFastLiteral(
effect, control, element_value.AsJSObject(), pretenure);
} else {
ObjectRef element_value = elements.get(i);
if (element_value.IsJSObject()) {
elements_values[i] = effect = AllocateFastLiteral(
effect, control, element_value.AsJSObject(), pretenure);
} else {
elements_values[i] = jsgraph()->Constant(element_value);
}
elements_values[i] = jsgraph()->Constant(element_value);
}
}
}
......
This diff is collapsed.
......@@ -163,7 +163,6 @@ class JSObjectRef : public HeapObjectRef {
public:
using HeapObjectRef::HeapObjectRef;
bool IsUnboxedDoubleField(FieldIndex index) const;
double RawFastDoublePropertyAt(FieldIndex index) const;
ObjectRef RawFastPropertyAt(FieldIndex index) const;
......@@ -278,6 +277,8 @@ class FeedbackVectorRef : public HeapObjectRef {
using HeapObjectRef::HeapObjectRef;
ObjectRef get(FeedbackSlot slot) const;
void SerializeSlots();
};
class AllocationSiteRef : public HeapObjectRef {
......@@ -332,6 +333,7 @@ class MapRef : public HeapObjectRef {
NameRef GetPropertyKey(int i) const;
FieldIndex GetFieldIndexFor(int i) const;
ObjectRef GetFieldType(int descriptor) const;
bool IsUnboxedDoubleField(FieldIndex index) const;
};
class FixedArrayBaseRef : public HeapObjectRef {
......@@ -346,7 +348,6 @@ class FixedArrayRef : public FixedArrayBaseRef {
using FixedArrayBaseRef::FixedArrayBaseRef;
ObjectRef get(int i) const;
bool is_the_hole(int i) const;
};
class FixedDoubleArrayRef : public FixedArrayBaseRef {
......
......@@ -46,14 +46,8 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
break;
}
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());
FeedbackVectorRef(broker(), p.feedback().vector());
Handle<Object> feedback(
p.feedback().vector()->Get(p.feedback().slot())->ToObject(),
broker()->isolate());
ObjectRef(broker(), feedback);
FeedbackVectorRef(broker(), p.feedback().vector()).SerializeSlots();
break;
}
case IrOpcode::kJSCreateFunctionContext: {
......@@ -65,7 +59,12 @@ Reduction JSHeapCopyReducer::Reduce(Node* node) {
case IrOpcode::kJSCreateLiteralArray:
case IrOpcode::kJSCreateLiteralObject: {
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;
}
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