OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 Node* ChangeLowering::SmiShiftBitsConstant() { | 58 Node* ChangeLowering::SmiShiftBitsConstant() { |
59 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); | 59 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); |
60 } | 60 } |
61 | 61 |
62 | 62 |
63 Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) { | 63 Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) { |
64 // The AllocateHeapNumberStub does not use the context, so we can safely pass | 64 // The AllocateHeapNumberStub does not use the context, so we can safely pass |
65 // in Smi zero here. | 65 // in Smi zero here. |
66 Callable callable = CodeFactory::AllocateHeapNumber(isolate()); | 66 Callable callable = CodeFactory::AllocateHeapNumber(isolate()); |
67 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | |
68 isolate(), jsgraph()->zone(), callable.descriptor(), 0, | |
69 CallDescriptor::kNoFlags); | |
70 Node* target = jsgraph()->HeapConstant(callable.code()); | 67 Node* target = jsgraph()->HeapConstant(callable.code()); |
71 Node* context = jsgraph()->NoContextConstant(); | 68 Node* context = jsgraph()->NoContextConstant(); |
72 Node* effect = graph()->NewNode(common()->ValueEffect(1), value); | 69 Node* effect = graph()->NewNode(common()->ValueEffect(1), value); |
73 Node* heap_number = graph()->NewNode(common()->Call(descriptor), target, | 70 if (!allocate_heap_number_operator_.is_set()) { |
74 context, effect, control); | 71 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 72 isolate(), jsgraph()->zone(), callable.descriptor(), 0, |
| 73 CallDescriptor::kNoFlags, Operator::kNoThrow); |
| 74 allocate_heap_number_operator_.set(common()->Call(descriptor)); |
| 75 } |
| 76 Node* heap_number = graph()->NewNode(allocate_heap_number_operator_.get(), |
| 77 target, context, effect, control); |
75 Node* store = graph()->NewNode( | 78 Node* store = graph()->NewNode( |
76 machine()->Store(StoreRepresentation(kMachFloat64, kNoWriteBarrier)), | 79 machine()->Store(StoreRepresentation(kMachFloat64, kNoWriteBarrier)), |
77 heap_number, HeapNumberValueIndexConstant(), value, heap_number, control); | 80 heap_number, HeapNumberValueIndexConstant(), value, heap_number, control); |
78 return graph()->NewNode(common()->Finish(1), heap_number, store); | 81 return graph()->NewNode(common()->Finish(1), heap_number, store); |
79 } | 82 } |
80 | 83 |
81 | 84 |
82 Node* ChangeLowering::ChangeInt32ToFloat64(Node* value) { | 85 Node* ChangeLowering::ChangeInt32ToFloat64(Node* value) { |
83 return graph()->NewNode(machine()->ChangeInt32ToFloat64(), value); | 86 return graph()->NewNode(machine()->ChangeInt32ToFloat64(), value); |
84 } | 87 } |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 340 } |
338 | 341 |
339 | 342 |
340 MachineOperatorBuilder* ChangeLowering::machine() const { | 343 MachineOperatorBuilder* ChangeLowering::machine() const { |
341 return jsgraph()->machine(); | 344 return jsgraph()->machine(); |
342 } | 345 } |
343 | 346 |
344 } // namespace compiler | 347 } // namespace compiler |
345 } // namespace internal | 348 } // namespace internal |
346 } // namespace v8 | 349 } // namespace v8 |
OLD | NEW |