Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1198993009: [turbofan] NaN is never truish. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Test for &&. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-4207.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/js-type-feedback.h" 10 #include "src/compiler/js-type-feedback.h"
(...skipping 3623 matching lines...) Expand 10 before | Expand all | Expand 10 after
3634 return NewNode(jsgraph()->machine()->Store(representation), 3634 return NewNode(jsgraph()->machine()->Store(representation),
3635 jsgraph()->ExternalConstant(reference), 3635 jsgraph()->ExternalConstant(reference),
3636 jsgraph()->IntPtrConstant(0), value); 3636 jsgraph()->IntPtrConstant(0), value);
3637 } 3637 }
3638 3638
3639 3639
3640 Node* AstGraphBuilder::BuildToBoolean(Node* input) { 3640 Node* AstGraphBuilder::BuildToBoolean(Node* input) {
3641 // TODO(bmeurer, mstarzinger): Refactor this into a separate optimization 3641 // TODO(bmeurer, mstarzinger): Refactor this into a separate optimization
3642 // method. 3642 // method.
3643 switch (input->opcode()) { 3643 switch (input->opcode()) {
3644 case IrOpcode::kNumberConstant: 3644 case IrOpcode::kNumberConstant: {
3645 return jsgraph_->BooleanConstant(!NumberMatcher(input).Is(0)); 3645 NumberMatcher m(input);
3646 return jsgraph_->BooleanConstant(!m.Is(0) && !m.IsNaN());
3647 }
3646 case IrOpcode::kHeapConstant: { 3648 case IrOpcode::kHeapConstant: {
3647 Handle<HeapObject> object = HeapObjectMatcher(input).Value().handle(); 3649 Handle<HeapObject> object = HeapObjectMatcher(input).Value().handle();
3648 return jsgraph_->BooleanConstant(object->BooleanValue()); 3650 return jsgraph_->BooleanConstant(object->BooleanValue());
3649 } 3651 }
3650 case IrOpcode::kJSEqual: 3652 case IrOpcode::kJSEqual:
3651 case IrOpcode::kJSNotEqual: 3653 case IrOpcode::kJSNotEqual:
3652 case IrOpcode::kJSStrictEqual: 3654 case IrOpcode::kJSStrictEqual:
3653 case IrOpcode::kJSStrictNotEqual: 3655 case IrOpcode::kJSStrictNotEqual:
3654 case IrOpcode::kJSLessThan: 3656 case IrOpcode::kJSLessThan:
3655 case IrOpcode::kJSLessThanOrEqual: 3657 case IrOpcode::kJSLessThanOrEqual:
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
4134 // Phi does not exist yet, introduce one. 4136 // Phi does not exist yet, introduce one.
4135 value = NewPhi(inputs, value, control); 4137 value = NewPhi(inputs, value, control);
4136 value->ReplaceInput(inputs - 1, other); 4138 value->ReplaceInput(inputs - 1, other);
4137 } 4139 }
4138 return value; 4140 return value;
4139 } 4141 }
4140 4142
4141 } // namespace compiler 4143 } // namespace compiler
4142 } // namespace internal 4144 } // namespace internal
4143 } // namespace v8 4145 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/compiler/regress-4207.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698