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