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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 operand = environment()->Pop(); | 3004 operand = environment()->Pop(); |
3005 } | 3005 } |
3006 Node* value = NewNode(javascript()->TypeOf(), operand); | 3006 Node* value = NewNode(javascript()->TypeOf(), operand); |
3007 ast_context()->ProduceValue(value); | 3007 ast_context()->ProduceValue(value); |
3008 } | 3008 } |
3009 | 3009 |
3010 | 3010 |
3011 void AstGraphBuilder::VisitNot(UnaryOperation* expr) { | 3011 void AstGraphBuilder::VisitNot(UnaryOperation* expr) { |
3012 VisitForValue(expr->expression()); | 3012 VisitForValue(expr->expression()); |
3013 Node* operand = environment()->Pop(); | 3013 Node* operand = environment()->Pop(); |
3014 // TODO(mstarzinger): Possible optimization when we are in effect context. | 3014 Node* input = BuildToBoolean(operand); |
3015 Node* value = NewNode(javascript()->UnaryNot(), operand); | 3015 Node* value = NewNode(common()->Select(kMachAnyTagged), input, |
| 3016 jsgraph()->FalseConstant(), jsgraph()->TrueConstant()); |
3016 ast_context()->ProduceValue(value); | 3017 ast_context()->ProduceValue(value); |
3017 } | 3018 } |
3018 | 3019 |
3019 | 3020 |
3020 void AstGraphBuilder::VisitComma(BinaryOperation* expr) { | 3021 void AstGraphBuilder::VisitComma(BinaryOperation* expr) { |
3021 VisitForEffect(expr->left()); | 3022 VisitForEffect(expr->left()); |
3022 Visit(expr->right()); | 3023 Visit(expr->right()); |
3023 ast_context()->ReplaceValue(); | 3024 ast_context()->ReplaceValue(); |
3024 } | 3025 } |
3025 | 3026 |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3953 return jsgraph_->BooleanConstant(object->BooleanValue()); | 3954 return jsgraph_->BooleanConstant(object->BooleanValue()); |
3954 } | 3955 } |
3955 case IrOpcode::kJSEqual: | 3956 case IrOpcode::kJSEqual: |
3956 case IrOpcode::kJSNotEqual: | 3957 case IrOpcode::kJSNotEqual: |
3957 case IrOpcode::kJSStrictEqual: | 3958 case IrOpcode::kJSStrictEqual: |
3958 case IrOpcode::kJSStrictNotEqual: | 3959 case IrOpcode::kJSStrictNotEqual: |
3959 case IrOpcode::kJSLessThan: | 3960 case IrOpcode::kJSLessThan: |
3960 case IrOpcode::kJSLessThanOrEqual: | 3961 case IrOpcode::kJSLessThanOrEqual: |
3961 case IrOpcode::kJSGreaterThan: | 3962 case IrOpcode::kJSGreaterThan: |
3962 case IrOpcode::kJSGreaterThanOrEqual: | 3963 case IrOpcode::kJSGreaterThanOrEqual: |
3963 case IrOpcode::kJSUnaryNot: | |
3964 case IrOpcode::kJSToBoolean: | 3964 case IrOpcode::kJSToBoolean: |
3965 case IrOpcode::kJSDeleteProperty: | 3965 case IrOpcode::kJSDeleteProperty: |
3966 case IrOpcode::kJSHasProperty: | 3966 case IrOpcode::kJSHasProperty: |
3967 case IrOpcode::kJSInstanceOf: | 3967 case IrOpcode::kJSInstanceOf: |
3968 return input; | 3968 return input; |
3969 default: | 3969 default: |
3970 break; | 3970 break; |
3971 } | 3971 } |
3972 return nullptr; | 3972 return nullptr; |
3973 } | 3973 } |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4317 // Phi does not exist yet, introduce one. | 4317 // Phi does not exist yet, introduce one. |
4318 value = NewPhi(inputs, value, control); | 4318 value = NewPhi(inputs, value, control); |
4319 value->ReplaceInput(inputs - 1, other); | 4319 value->ReplaceInput(inputs - 1, other); |
4320 } | 4320 } |
4321 return value; | 4321 return value; |
4322 } | 4322 } |
4323 | 4323 |
4324 } // namespace compiler | 4324 } // namespace compiler |
4325 } // namespace internal | 4325 } // namespace internal |
4326 } // namespace v8 | 4326 } // namespace v8 |
OLD | NEW |