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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 579723004: Introduce simplified BooleanToNumber operator. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments. Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/compiler/opcodes.h » ('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/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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 return Changed(input); 437 return Changed(input);
438 } 438 }
439 if (input_type->Is(Type::Undefined())) { 439 if (input_type->Is(Type::Undefined())) {
440 // JSToNumber(undefined) => #NaN 440 // JSToNumber(undefined) => #NaN
441 return ReplaceWith(jsgraph()->NaNConstant()); 441 return ReplaceWith(jsgraph()->NaNConstant());
442 } 442 }
443 if (input_type->Is(Type::Null())) { 443 if (input_type->Is(Type::Null())) {
444 // JSToNumber(null) => #0 444 // JSToNumber(null) => #0
445 return ReplaceWith(jsgraph()->ZeroConstant()); 445 return ReplaceWith(jsgraph()->ZeroConstant());
446 } 446 }
447 // TODO(turbofan): js-typed-lowering of ToNumber(x:boolean) 447 if (input_type->Is(Type::Boolean())) {
448 // JSToNumber(x:boolean) => BooleanToNumber(x)
449 return ReplaceWith(
450 graph()->NewNode(simplified()->BooleanToNumber(), input));
451 }
448 // TODO(turbofan): js-typed-lowering of ToNumber(x:string) 452 // TODO(turbofan): js-typed-lowering of ToNumber(x:string)
449 return NoChange(); 453 return NoChange();
450 } 454 }
451 455
452 456
453 Reduction JSTypedLowering::ReduceJSToStringInput(Node* input) { 457 Reduction JSTypedLowering::ReduceJSToStringInput(Node* input) {
454 if (input->opcode() == IrOpcode::kJSToString) { 458 if (input->opcode() == IrOpcode::kJSToString) {
455 // Recursively try to reduce the input first. 459 // Recursively try to reduce the input first.
456 Reduction result = ReduceJSToStringInput(input->InputAt(0)); 460 Reduction result = ReduceJSToStringInput(input->InputAt(0));
457 if (result.Changed()) { 461 if (result.Changed()) {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return ReduceJSStoreProperty(node); 680 return ReduceJSStoreProperty(node);
677 default: 681 default:
678 break; 682 break;
679 } 683 }
680 return NoChange(); 684 return NoChange();
681 } 685 }
682 686
683 } // namespace compiler 687 } // namespace compiler
684 } // namespace internal 688 } // namespace internal
685 } // namespace v8 689 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698