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

Unified Diff: src/compiler/change-lowering.cc

Issue 1922443002: [turbofan] Introduce Oddball::to_number_raw and use it for change lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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 | « include/v8.h ('k') | src/objects.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/change-lowering.cc
diff --git a/src/compiler/change-lowering.cc b/src/compiler/change-lowering.cc
index 0e0dd1ccd6034bac5e85eacfe79c722cbfd60f76..28a1fafcec617229a58e908d04b051fe1c943d90 100644
--- a/src/compiler/change-lowering.cc
+++ b/src/compiler/change-lowering.cc
@@ -294,29 +294,8 @@ Reduction ChangeLowering::ChangeTaggedToUI32(Node* value, Node* control,
Node* if_not_smi = graph()->NewNode(common()->IfTrue(), branch);
- Node* vnot_smi;
- if (NodeProperties::GetType(value)->Maybe(Type::Undefined())) {
- Node* check_undefined = graph()->NewNode(machine()->WordEqual(), value,
- jsgraph()->UndefinedConstant());
- Node* branch_undefined = graph()->NewNode(
- common()->Branch(BranchHint::kFalse), check_undefined, if_not_smi);
-
- Node* if_undefined = graph()->NewNode(common()->IfTrue(), branch_undefined);
- Node* vundefined = jsgraph()->Int32Constant(0);
-
- Node* if_not_undefined =
- graph()->NewNode(common()->IfFalse(), branch_undefined);
- Node* vheap_number =
- graph()->NewNode(op, LoadHeapNumberValue(value, if_not_undefined));
-
- if_not_smi =
- graph()->NewNode(common()->Merge(2), if_undefined, if_not_undefined);
- vnot_smi =
- graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
- vundefined, vheap_number, if_not_smi);
- } else {
- vnot_smi = graph()->NewNode(op, LoadHeapNumberValue(value, if_not_smi));
- }
+ STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
+ Node* vnot_smi = graph()->NewNode(op, LoadHeapNumberValue(value, if_not_smi));
Node* if_smi = graph()->NewNode(common()->IfFalse(), branch);
Node* vfrom_smi = ChangeSmiToWord32(value);
@@ -336,29 +315,8 @@ Reduction ChangeLowering::ChangeTaggedToFloat64(Node* value, Node* control) {
Node* if_not_smi = graph()->NewNode(common()->IfTrue(), branch);
- Node* vnot_smi;
- if (NodeProperties::GetType(value)->Maybe(Type::Undefined())) {
- Node* check_undefined = graph()->NewNode(machine()->WordEqual(), value,
- jsgraph()->UndefinedConstant());
- Node* branch_undefined = graph()->NewNode(
- common()->Branch(BranchHint::kFalse), check_undefined, if_not_smi);
-
- Node* if_undefined = graph()->NewNode(common()->IfTrue(), branch_undefined);
- Node* vundefined =
- jsgraph()->Float64Constant(std::numeric_limits<double>::quiet_NaN());
-
- Node* if_not_undefined =
- graph()->NewNode(common()->IfFalse(), branch_undefined);
- Node* vheap_number = LoadHeapNumberValue(value, if_not_undefined);
-
- if_not_smi =
- graph()->NewNode(common()->Merge(2), if_undefined, if_not_undefined);
- vnot_smi =
- graph()->NewNode(common()->Phi(MachineRepresentation::kFloat64, 2),
- vundefined, vheap_number, if_not_smi);
- } else {
- vnot_smi = LoadHeapNumberValue(value, if_not_smi);
- }
+ STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
+ Node* vnot_smi = LoadHeapNumberValue(value, if_not_smi);
Node* if_smi = graph()->NewNode(common()->IfFalse(), branch);
Node* vfrom_smi = ChangeSmiToFloat64(value);
@@ -399,31 +357,9 @@ Reduction ChangeLowering::TruncateTaggedToWord32(Node* value, Node* control) {
Node* if_not_smi = graph()->NewNode(common()->IfTrue(), branch);
- Node* vnot_smi;
- if (NodeProperties::GetType(value)->Maybe(Type::Undefined())) {
- Node* check_undefined = graph()->NewNode(machine()->WordEqual(), value,
- jsgraph()->UndefinedConstant());
- Node* branch_undefined = graph()->NewNode(
- common()->Branch(BranchHint::kFalse), check_undefined, if_not_smi);
-
- Node* if_undefined = graph()->NewNode(common()->IfTrue(), branch_undefined);
- Node* vundefined = jsgraph()->Int32Constant(0);
-
- Node* if_not_undefined =
- graph()->NewNode(common()->IfFalse(), branch_undefined);
- Node* vheap_number =
- graph()->NewNode(machine()->TruncateFloat64ToWord32(),
- LoadHeapNumberValue(value, if_not_undefined));
-
- if_not_smi =
- graph()->NewNode(common()->Merge(2), if_undefined, if_not_undefined);
- vnot_smi =
- graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
- vundefined, vheap_number, if_not_smi);
- } else {
- vnot_smi = graph()->NewNode(machine()->TruncateFloat64ToWord32(),
- LoadHeapNumberValue(value, if_not_smi));
- }
+ STATIC_ASSERT(HeapNumber::kValueOffset == Oddball::kToNumberRawOffset);
+ Node* vnot_smi = graph()->NewNode(machine()->TruncateFloat64ToWord32(),
+ LoadHeapNumberValue(value, if_not_smi));
Node* if_smi = graph()->NewNode(common()->IfFalse(), branch);
Node* vfrom_smi = ChangeSmiToWord32(value);
« no previous file with comments | « include/v8.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698