| 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/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
| 10 #include "src/compiler/machine-operator.h" | 10 #include "src/compiler/machine-operator.h" |
| (...skipping 2108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 // TODO(titzer): this should be in a JSOperatorReducer. | 2119 // TODO(titzer): this should be in a JSOperatorReducer. |
| 2120 switch (input->opcode()) { | 2120 switch (input->opcode()) { |
| 2121 case IrOpcode::kInt32Constant: | 2121 case IrOpcode::kInt32Constant: |
| 2122 return jsgraph_->BooleanConstant(!Int32Matcher(input).Is(0)); | 2122 return jsgraph_->BooleanConstant(!Int32Matcher(input).Is(0)); |
| 2123 case IrOpcode::kFloat64Constant: | 2123 case IrOpcode::kFloat64Constant: |
| 2124 return jsgraph_->BooleanConstant(!Float64Matcher(input).Is(0)); | 2124 return jsgraph_->BooleanConstant(!Float64Matcher(input).Is(0)); |
| 2125 case IrOpcode::kNumberConstant: | 2125 case IrOpcode::kNumberConstant: |
| 2126 return jsgraph_->BooleanConstant(!NumberMatcher(input).Is(0)); | 2126 return jsgraph_->BooleanConstant(!NumberMatcher(input).Is(0)); |
| 2127 case IrOpcode::kHeapConstant: { | 2127 case IrOpcode::kHeapConstant: { |
| 2128 Handle<Object> object = HeapObjectMatcher<Object>(input).Value().handle(); | 2128 Handle<Object> object = HeapObjectMatcher<Object>(input).Value().handle(); |
| 2129 if (object->IsTrue()) return jsgraph_->TrueConstant(); | 2129 return jsgraph_->BooleanConstant(object->BooleanValue()); |
| 2130 if (object->IsFalse()) return jsgraph_->FalseConstant(); | |
| 2131 // TODO(turbofan): other constants. | |
| 2132 break; | |
| 2133 } | 2130 } |
| 2134 default: | 2131 default: |
| 2135 break; | 2132 break; |
| 2136 } | 2133 } |
| 2137 if (NodeProperties::IsTyped(input)) { | 2134 if (NodeProperties::IsTyped(input)) { |
| 2138 Type* upper = NodeProperties::GetBounds(input).upper; | 2135 Type* upper = NodeProperties::GetBounds(input).upper; |
| 2139 if (upper->Is(Type::Boolean())) return input; | 2136 if (upper->Is(Type::Boolean())) return input; |
| 2140 } | 2137 } |
| 2141 | 2138 |
| 2142 return NewNode(javascript()->ToBoolean(), input); | 2139 return NewNode(javascript()->ToBoolean(), input); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2245 | 2242 |
| 2246 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( | 2243 BitVector* AstGraphBuilder::GetVariablesAssignedInLoop( |
| 2247 IterationStatement* stmt) { | 2244 IterationStatement* stmt) { |
| 2248 if (loop_assignment_analysis_ == NULL) return NULL; | 2245 if (loop_assignment_analysis_ == NULL) return NULL; |
| 2249 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); | 2246 return loop_assignment_analysis_->GetVariablesAssignedInLoop(stmt); |
| 2250 } | 2247 } |
| 2251 | 2248 |
| 2252 } // namespace compiler | 2249 } // namespace compiler |
| 2253 } // namespace internal | 2250 } // namespace internal |
| 2254 } // namespace v8 | 2251 } // namespace v8 |
| OLD | NEW |