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

Side by Side Diff: src/compiler/int64-lowering.cc

Issue 1801013002: [wasm] Int64Lowering of F64ReinterpretI64. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@wasm-bit-cast
Patch Set: Rebase. Created 4 years, 9 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 | src/compiler/wasm-compiler.cc » ('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/int64-lowering.h" 5 #include "src/compiler/int64-lowering.h"
6 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-properties.h" 10 #include "src/compiler/node-properties.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 high_node = graph()->NewNode(load_op, base, index_high, effect_high, 113 high_node = graph()->NewNode(load_op, base, index_high, effect_high,
114 control_high); 114 control_high);
115 // change the effect change from old_node --> old_effect to 115 // change the effect change from old_node --> old_effect to
116 // old_node --> high_node --> old_effect. 116 // old_node --> high_node --> old_effect.
117 node->ReplaceInput(2, high_node); 117 node->ReplaceInput(2, high_node);
118 } else { 118 } else {
119 high_node = graph()->NewNode(load_op, base, index_high); 119 high_node = graph()->NewNode(load_op, base, index_high);
120 } 120 }
121 NodeProperties::ChangeOp(node, load_op); 121 NodeProperties::ChangeOp(node, load_op);
122 ReplaceNode(node, node, high_node); 122 ReplaceNode(node, node, high_node);
123 } else {
124 DefaultLowering(node);
123 } 125 }
124 break; 126 break;
125 } 127 }
126 case IrOpcode::kStore: { 128 case IrOpcode::kStore: {
127 StoreRepresentation store_rep = StoreRepresentationOf(node->op()); 129 StoreRepresentation store_rep = StoreRepresentationOf(node->op());
128 if (store_rep.representation() == MachineRepresentation::kWord64) { 130 if (store_rep.representation() == MachineRepresentation::kWord64) {
129 // We change the original store node to store the low word, and create 131 // We change the original store node to store the low word, and create
130 // a new store node to store the high word. The effect and control edges 132 // a new store node to store the high word. The effect and control edges
131 // are copied from the original store to the new store node, the effect 133 // are copied from the original store to the new store node, the effect
132 // edge of the original store is redirected to the new store. 134 // edge of the original store is redirected to the new store.
(...skipping 22 matching lines...) Expand all
155 node->ReplaceInput(3, high_node); 157 node->ReplaceInput(3, high_node);
156 158
157 } else { 159 } else {
158 high_node = graph()->NewNode(store_op, base, index_high, 160 high_node = graph()->NewNode(store_op, base, index_high,
159 GetReplacementHigh(value)); 161 GetReplacementHigh(value));
160 } 162 }
161 163
162 node->ReplaceInput(2, GetReplacementLow(value)); 164 node->ReplaceInput(2, GetReplacementLow(value));
163 NodeProperties::ChangeOp(node, store_op); 165 NodeProperties::ChangeOp(node, store_op);
164 ReplaceNode(node, node, high_node); 166 ReplaceNode(node, node, high_node);
167 } else {
168 DefaultLowering(node);
165 } 169 }
166 break; 170 break;
167 } 171 }
168 case IrOpcode::kStart: { 172 case IrOpcode::kStart: {
169 int parameter_count = GetParameterCountAfterLowering(signature()); 173 int parameter_count = GetParameterCountAfterLowering(signature());
170 // Only exchange the node if the parameter count actually changed. 174 // Only exchange the node if the parameter count actually changed.
171 if (parameter_count != signature()->parameter_count()) { 175 if (parameter_count != signature()->parameter_count()) {
172 int delta = 176 int delta =
173 parameter_count - static_cast<int>(signature()->parameter_count()); 177 parameter_count - static_cast<int>(signature()->parameter_count());
174 int new_output_count = node->op()->ValueOutputCount() + delta; 178 int new_output_count = node->op()->ValueOutputCount() + delta;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 DCHECK(node->InputCount() == 1); 440 DCHECK(node->InputCount() == 1);
437 Node* input = node->InputAt(0); 441 Node* input = node->InputAt(0);
438 if (HasReplacementLow(input)) { 442 if (HasReplacementLow(input)) {
439 input = GetReplacementLow(input); 443 input = GetReplacementLow(input);
440 } 444 }
441 ReplaceNode(node, input, graph()->NewNode(common()->Int32Constant(0))); 445 ReplaceNode(node, input, graph()->NewNode(common()->Int32Constant(0)));
442 node->NullAllInputs(); 446 node->NullAllInputs();
443 break; 447 break;
444 } 448 }
445 // kExprF64ReinterpretI64: 449 // kExprF64ReinterpretI64:
450 case IrOpcode::kBitcastInt64ToFloat64: {
451 DCHECK(node->InputCount() == 1);
452 Node* input = node->InputAt(0);
453 Node* stack_slot = graph()->NewNode(
454 machine()->StackSlot(MachineRepresentation::kWord64));
455
456 Node* store_high_word = graph()->NewNode(
457 machine()->Store(
458 StoreRepresentation(MachineRepresentation::kWord32,
459 WriteBarrierKind::kNoWriteBarrier)),
460 stack_slot, graph()->NewNode(common()->Int32Constant(4)),
461 GetReplacementHigh(input), graph()->start(), graph()->start());
462
463 Node* store_low_word = graph()->NewNode(
464 machine()->Store(
465 StoreRepresentation(MachineRepresentation::kWord32,
466 WriteBarrierKind::kNoWriteBarrier)),
467 stack_slot, graph()->NewNode(common()->Int32Constant(0)),
468 GetReplacementLow(input), store_high_word, graph()->start());
469
470 Node* load =
471 graph()->NewNode(machine()->Load(MachineType::Float64()), stack_slot,
472 graph()->NewNode(common()->Int32Constant(0)),
473 store_low_word, graph()->start());
474
475 ReplaceNode(node, load, nullptr);
476 break;
477 }
446 // kExprI64ReinterpretF64: 478 // kExprI64ReinterpretF64:
447 case IrOpcode::kBitcastFloat64ToInt64: { 479 case IrOpcode::kBitcastFloat64ToInt64: {
448 DCHECK(node->InputCount() == 1); 480 DCHECK(node->InputCount() == 1);
449 Node* input = node->InputAt(0); 481 Node* input = node->InputAt(0);
482 if (HasReplacementLow(input)) {
483 input = GetReplacementLow(input);
484 }
450 Node* stack_slot = graph()->NewNode( 485 Node* stack_slot = graph()->NewNode(
451 machine()->StackSlot(MachineRepresentation::kWord64)); 486 machine()->StackSlot(MachineRepresentation::kWord64));
452 Node* store = graph()->NewNode( 487 Node* store = graph()->NewNode(
453 machine()->Store( 488 machine()->Store(
454 StoreRepresentation(MachineRepresentation::kFloat64, 489 StoreRepresentation(MachineRepresentation::kFloat64,
455 WriteBarrierKind::kNoWriteBarrier)), 490 WriteBarrierKind::kNoWriteBarrier)),
456 stack_slot, graph()->NewNode(common()->Int32Constant(0)), input, 491 stack_slot, graph()->NewNode(common()->Int32Constant(0)), input,
457 graph()->start(), graph()->start()); 492 graph()->start(), graph()->start());
458 493
459 Node* high_node = 494 Node* high_node =
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 583 }
549 584
550 Node* Int64Lowering::GetReplacementHigh(Node* node) { 585 Node* Int64Lowering::GetReplacementHigh(Node* node) {
551 Node* result = replacements_[node->id()].high; 586 Node* result = replacements_[node->id()].high;
552 DCHECK(result); 587 DCHECK(result);
553 return result; 588 return result;
554 } 589 }
555 } // namespace compiler 590 } // namespace compiler
556 } // namespace internal 591 } // namespace internal
557 } // namespace v8 592 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698