| 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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 #include "src/compiler/graph-inl.h" | 6 #include "src/compiler/graph-inl.h" |
| 7 #include "src/compiler/js-typed-lowering.h" | 7 #include "src/compiler/js-typed-lowering.h" |
| 8 #include "src/compiler/node-aux-data-inl.h" | 8 #include "src/compiler/node-aux-data-inl.h" |
| 9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
| 10 #include "src/types.h" | 10 #include "src/types.h" |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 } | 484 } |
| 485 if (input_type->Is(Type::Undetectable())) { | 485 if (input_type->Is(Type::Undetectable())) { |
| 486 // JSToBoolean(undetectable) => #false | 486 // JSToBoolean(undetectable) => #false |
| 487 return ReplaceWith(jsgraph()->FalseConstant()); | 487 return ReplaceWith(jsgraph()->FalseConstant()); |
| 488 } | 488 } |
| 489 if (input_type->Is(Type::Number())) { | 489 if (input_type->Is(Type::Number())) { |
| 490 // JSToBoolean(number) => BooleanNot(NumberEqual(x, #0)) | 490 // JSToBoolean(number) => BooleanNot(NumberEqual(x, #0)) |
| 491 Node* cmp = graph()->NewNode(simplified()->NumberEqual(), input, | 491 Node* cmp = graph()->NewNode(simplified()->NumberEqual(), input, |
| 492 jsgraph()->ZeroConstant()); | 492 jsgraph()->ZeroConstant()); |
| 493 Node* inv = graph()->NewNode(simplified()->BooleanNot(), cmp); | 493 Node* inv = graph()->NewNode(simplified()->BooleanNot(), cmp); |
| 494 ReplaceEagerly(input, inv); | 494 return ReplaceWith(inv); |
| 495 // TODO(titzer): Ugly. ReplaceEagerly smashes all uses. Smash it back here. | |
| 496 cmp->ReplaceInput(0, input); | |
| 497 return Changed(inv); | |
| 498 } | 495 } |
| 499 // TODO(turbofan): js-typed-lowering of ToBoolean(string) | 496 // TODO(turbofan): js-typed-lowering of ToBoolean(string) |
| 500 return NoChange(); | 497 return NoChange(); |
| 501 } | 498 } |
| 502 | 499 |
| 503 | 500 |
| 504 Reduction JSTypedLowering::ReduceJSPropertyLoad(Node* node) { | 501 Reduction JSTypedLowering::ReduceJSPropertyLoad(Node* node) { |
| 505 Node* key = NodeProperties::GetValueInput(node, 1); | 502 Node* key = NodeProperties::GetValueInput(node, 1); |
| 506 Node* base = NodeProperties::GetValueInput(node, 0); | 503 Node* base = NodeProperties::GetValueInput(node, 0); |
| 507 Type* key_type = NodeProperties::GetBounds(key).upper; | 504 Type* key_type = NodeProperties::GetBounds(key).upper; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 case IrOpcode::kJSLoadProperty: | 612 case IrOpcode::kJSLoadProperty: |
| 616 return ReduceJSPropertyLoad(node); | 613 return ReduceJSPropertyLoad(node); |
| 617 default: | 614 default: |
| 618 break; | 615 break; |
| 619 } | 616 } |
| 620 return NoChange(); | 617 return NoChange(); |
| 621 } | 618 } |
| 622 } | 619 } |
| 623 } | 620 } |
| 624 } // namespace v8::internal::compiler | 621 } // namespace v8::internal::compiler |
| OLD | NEW |