Commit 1f6c284a authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Cache Call operator for AllocateHeapNumberStub in change lowering.

R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/1015953002

Cr-Commit-Position: refs/heads/master@{#27256}
parent 86852190
...@@ -64,14 +64,17 @@ Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) { ...@@ -64,14 +64,17 @@ Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) {
// The AllocateHeapNumberStub does not use the context, so we can safely pass // The AllocateHeapNumberStub does not use the context, so we can safely pass
// in Smi zero here. // in Smi zero here.
Callable callable = CodeFactory::AllocateHeapNumber(isolate()); Callable callable = CodeFactory::AllocateHeapNumber(isolate());
CallDescriptor* descriptor = Linkage::GetStubCallDescriptor(
isolate(), jsgraph()->zone(), callable.descriptor(), 0,
CallDescriptor::kNoFlags);
Node* target = jsgraph()->HeapConstant(callable.code()); Node* target = jsgraph()->HeapConstant(callable.code());
Node* context = jsgraph()->NoContextConstant(); Node* context = jsgraph()->NoContextConstant();
Node* effect = graph()->NewNode(common()->ValueEffect(1), value); Node* effect = graph()->NewNode(common()->ValueEffect(1), value);
Node* heap_number = graph()->NewNode(common()->Call(descriptor), target, if (!allocate_heap_number_operator_.is_set()) {
context, effect, control); CallDescriptor* descriptor = Linkage::GetStubCallDescriptor(
isolate(), jsgraph()->zone(), callable.descriptor(), 0,
CallDescriptor::kNoFlags, Operator::kNoThrow);
allocate_heap_number_operator_.set(common()->Call(descriptor));
}
Node* heap_number = graph()->NewNode(allocate_heap_number_operator_.get(),
target, context, effect, control);
Node* store = graph()->NewNode( Node* store = graph()->NewNode(
machine()->Store(StoreRepresentation(kMachFloat64, kNoWriteBarrier)), machine()->Store(StoreRepresentation(kMachFloat64, kNoWriteBarrier)),
heap_number, HeapNumberValueIndexConstant(), value, heap_number, control); heap_number, HeapNumberValueIndexConstant(), value, heap_number, control);
......
...@@ -16,6 +16,7 @@ class CommonOperatorBuilder; ...@@ -16,6 +16,7 @@ class CommonOperatorBuilder;
class JSGraph; class JSGraph;
class Linkage; class Linkage;
class MachineOperatorBuilder; class MachineOperatorBuilder;
class Operator;
class ChangeLowering FINAL : public Reducer { class ChangeLowering FINAL : public Reducer {
public: public:
...@@ -54,7 +55,8 @@ class ChangeLowering FINAL : public Reducer { ...@@ -54,7 +55,8 @@ class ChangeLowering FINAL : public Reducer {
CommonOperatorBuilder* common() const; CommonOperatorBuilder* common() const;
MachineOperatorBuilder* machine() const; MachineOperatorBuilder* machine() const;
JSGraph* jsgraph_; JSGraph* const jsgraph_;
SetOncePointer<const Operator> allocate_heap_number_operator_;
}; };
} // namespace compiler } // namespace compiler
......
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