[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}
This commit is contained in:
bmeurer 2015-03-18 01:45:47 -07:00 committed by Commit bot
parent 8685219066
commit 1f6c284a6c
2 changed files with 11 additions and 6 deletions

View File

@ -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);

View File

@ -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