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

Unified Diff: src/compiler/js-typed-lowering.cc

Issue 565493003: Fix typed lowering of ToBoolean on NaN input. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index c4e7b2b7ccc75f3261b925f1ccf05e48416ef355..869096232ffac2c1d3d93f1474068f8d308add49 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -416,7 +416,7 @@ Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) {
}
Type* input_type = NodeProperties::GetBounds(input).upper;
if (input_type->Is(Type::Number())) {
- // JSToNumber(number) => x
+ // JSToNumber(x:number) => x
return Changed(input);
}
if (input_type->Is(Type::Undefined())) {
@@ -427,8 +427,8 @@ Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) {
// JSToNumber(null) => #0
return ReplaceWith(jsgraph()->ZeroConstant());
}
- // TODO(turbofan): js-typed-lowering of ToNumber(boolean)
- // TODO(turbofan): js-typed-lowering of ToNumber(string)
+ // TODO(turbofan): js-typed-lowering of ToNumber(x:boolean)
+ // TODO(turbofan): js-typed-lowering of ToNumber(x:string)
return NoChange();
}
@@ -445,7 +445,7 @@ Reduction JSTypedLowering::ReduceJSToStringInput(Node* input) {
}
Type* input_type = NodeProperties::GetBounds(input).upper;
if (input_type->Is(Type::String())) {
- return Changed(input); // JSToString(string) => x
+ return Changed(input); // JSToString(x:string) => x
}
if (input_type->Is(Type::Undefined())) {
return ReplaceWith(jsgraph()->HeapConstant(
@@ -455,8 +455,8 @@ Reduction JSTypedLowering::ReduceJSToStringInput(Node* input) {
return ReplaceWith(jsgraph()->HeapConstant(
graph()->zone()->isolate()->factory()->null_string()));
}
- // TODO(turbofan): js-typed-lowering of ToString(boolean)
- // TODO(turbofan): js-typed-lowering of ToString(number)
+ // TODO(turbofan): js-typed-lowering of ToString(x:boolean)
+ // TODO(turbofan): js-typed-lowering of ToString(x:number)
return NoChange();
}
@@ -473,7 +473,7 @@ Reduction JSTypedLowering::ReduceJSToBooleanInput(Node* input) {
}
Type* input_type = NodeProperties::GetBounds(input).upper;
if (input_type->Is(Type::Boolean())) {
- return Changed(input); // JSToBoolean(boolean) => x
+ return Changed(input); // JSToBoolean(x:boolean) => x
}
if (input_type->Is(Type::Undefined())) {
// JSToBoolean(undefined) => #false
@@ -484,15 +484,15 @@ Reduction JSTypedLowering::ReduceJSToBooleanInput(Node* input) {
return ReplaceWith(jsgraph()->FalseConstant());
}
if (input_type->Is(Type::DetectableReceiver())) {
- // JSToBoolean(detectable) => #true
+ // JSToBoolean(x:detectable) => #true
return ReplaceWith(jsgraph()->TrueConstant());
}
if (input_type->Is(Type::Undetectable())) {
- // JSToBoolean(undetectable) => #false
+ // JSToBoolean(x:undetectable) => #false
return ReplaceWith(jsgraph()->FalseConstant());
}
- if (input_type->Is(Type::Number())) {
- // JSToBoolean(number) => BooleanNot(NumberEqual(x, #0))
+ if (input_type->Is(Type::OrderedNumber())) {
+ // JSToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x, #0))
Node* cmp = graph()->NewNode(simplified()->NumberEqual(), input,
jsgraph()->ZeroConstant());
Node* inv = graph()->NewNode(simplified()->BooleanNot(), cmp);
@@ -629,7 +629,7 @@ Reduction JSTypedLowering::Reduce(Node* node) {
Reduction result = ReduceJSToBooleanInput(node->InputAt(0));
Node* value;
if (result.Changed()) {
- // JSUnaryNot(x) => BooleanNot(x)
+ // JSUnaryNot(x:boolean) => BooleanNot(x)
value =
graph()->NewNode(simplified()->BooleanNot(), result.replacement());
NodeProperties::ReplaceWithValue(node, value);
« no previous file with comments | « no previous file | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698