| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/code-assembler.h" | 5 #include "src/compiler/code-assembler.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| 11 #include "src/compiler/instruction-selector.h" | 11 #include "src/compiler/instruction-selector.h" |
| 12 #include "src/compiler/linkage.h" | 12 #include "src/compiler/linkage.h" |
| 13 #include "src/compiler/node-matchers.h" |
| 13 #include "src/compiler/pipeline.h" | 14 #include "src/compiler/pipeline.h" |
| 14 #include "src/compiler/raw-machine-assembler.h" | 15 #include "src/compiler/raw-machine-assembler.h" |
| 15 #include "src/compiler/schedule.h" | 16 #include "src/compiler/schedule.h" |
| 16 #include "src/frames.h" | 17 #include "src/frames.h" |
| 17 #include "src/interface-descriptors.h" | 18 #include "src/interface-descriptors.h" |
| 18 #include "src/interpreter/bytecodes.h" | 19 #include "src/interpreter/bytecodes.h" |
| 19 #include "src/machine-type.h" | 20 #include "src/machine-type.h" |
| 20 #include "src/macro-assembler.h" | 21 #include "src/macro-assembler.h" |
| 21 #include "src/zone.h" | 22 #include "src/zone.h" |
| 22 | 23 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 81 } |
| 81 | 82 |
| 82 bool CodeAssembler::IsFloat64RoundDownSupported() const { | 83 bool CodeAssembler::IsFloat64RoundDownSupported() const { |
| 83 return raw_assembler_->machine()->Float64RoundDown().IsSupported(); | 84 return raw_assembler_->machine()->Float64RoundDown().IsSupported(); |
| 84 } | 85 } |
| 85 | 86 |
| 86 bool CodeAssembler::IsFloat64RoundTruncateSupported() const { | 87 bool CodeAssembler::IsFloat64RoundTruncateSupported() const { |
| 87 return raw_assembler_->machine()->Float64RoundTruncate().IsSupported(); | 88 return raw_assembler_->machine()->Float64RoundTruncate().IsSupported(); |
| 88 } | 89 } |
| 89 | 90 |
| 90 Node* CodeAssembler::Int32Constant(int value) { | 91 Node* CodeAssembler::Int32Constant(int32_t value) { |
| 91 return raw_assembler_->Int32Constant(value); | 92 return raw_assembler_->Int32Constant(value); |
| 92 } | 93 } |
| 93 | 94 |
| 95 Node* CodeAssembler::Int64Constant(int64_t value) { |
| 96 return raw_assembler_->Int64Constant(value); |
| 97 } |
| 98 |
| 94 Node* CodeAssembler::IntPtrConstant(intptr_t value) { | 99 Node* CodeAssembler::IntPtrConstant(intptr_t value) { |
| 95 return raw_assembler_->IntPtrConstant(value); | 100 return raw_assembler_->IntPtrConstant(value); |
| 96 } | 101 } |
| 97 | 102 |
| 98 Node* CodeAssembler::NumberConstant(double value) { | 103 Node* CodeAssembler::NumberConstant(double value) { |
| 99 return raw_assembler_->NumberConstant(value); | 104 return raw_assembler_->NumberConstant(value); |
| 100 } | 105 } |
| 101 | 106 |
| 102 Node* CodeAssembler::SmiConstant(Smi* value) { | 107 Node* CodeAssembler::SmiConstant(Smi* value) { |
| 103 return IntPtrConstant(bit_cast<intptr_t>(value)); | 108 return IntPtrConstant(bit_cast<intptr_t>(value)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 116 } | 121 } |
| 117 | 122 |
| 118 Node* CodeAssembler::Float64Constant(double value) { | 123 Node* CodeAssembler::Float64Constant(double value) { |
| 119 return raw_assembler_->Float64Constant(value); | 124 return raw_assembler_->Float64Constant(value); |
| 120 } | 125 } |
| 121 | 126 |
| 122 Node* CodeAssembler::NaNConstant() { | 127 Node* CodeAssembler::NaNConstant() { |
| 123 return LoadRoot(Heap::kNanValueRootIndex); | 128 return LoadRoot(Heap::kNanValueRootIndex); |
| 124 } | 129 } |
| 125 | 130 |
| 131 bool CodeAssembler::ToInt32Constant(Node* node, int32_t& out_value) { |
| 132 Int64Matcher m(node); |
| 133 if (m.HasValue() && |
| 134 m.IsInRange(std::numeric_limits<int32_t>::min(), |
| 135 std::numeric_limits<int32_t>::max())) { |
| 136 out_value = static_cast<int32_t>(m.Value()); |
| 137 return true; |
| 138 } |
| 139 |
| 140 return false; |
| 141 } |
| 142 |
| 143 bool CodeAssembler::ToInt64Constant(Node* node, int64_t& out_value) { |
| 144 Int64Matcher m(node); |
| 145 if (m.HasValue()) out_value = m.Value(); |
| 146 return m.HasValue(); |
| 147 } |
| 148 |
| 149 bool CodeAssembler::ToIntPtrConstant(Node* node, intptr_t& out_value) { |
| 150 IntPtrMatcher m(node); |
| 151 if (m.HasValue()) out_value = m.Value(); |
| 152 return m.HasValue(); |
| 153 } |
| 154 |
| 126 Node* CodeAssembler::Parameter(int value) { | 155 Node* CodeAssembler::Parameter(int value) { |
| 127 return raw_assembler_->Parameter(value); | 156 return raw_assembler_->Parameter(value); |
| 128 } | 157 } |
| 129 | 158 |
| 130 void CodeAssembler::Return(Node* value) { | 159 void CodeAssembler::Return(Node* value) { |
| 131 return raw_assembler_->Return(value); | 160 return raw_assembler_->Return(value); |
| 132 } | 161 } |
| 133 | 162 |
| 134 void CodeAssembler::DebugBreak() { raw_assembler_->DebugBreak(); } | 163 void CodeAssembler::DebugBreak() { raw_assembler_->DebugBreak(); } |
| 135 | 164 |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 } | 730 } |
| 702 } | 731 } |
| 703 } | 732 } |
| 704 | 733 |
| 705 bound_ = true; | 734 bound_ = true; |
| 706 } | 735 } |
| 707 | 736 |
| 708 } // namespace compiler | 737 } // namespace compiler |
| 709 } // namespace internal | 738 } // namespace internal |
| 710 } // namespace v8 | 739 } // namespace v8 |
| OLD | NEW |