| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-intrinsic-lowering.h" | 5 #include "src/compiler/js-intrinsic-lowering.h" |
| 6 | 6 |
| 7 #include <stack> | 7 #include <stack> |
| 8 | 8 |
| 9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| 11 #include "src/compiler/node-matchers.h" | 11 #include "src/compiler/node-matchers.h" |
| 12 #include "src/compiler/node-properties.h" | 12 #include "src/compiler/node-properties.h" |
| 13 #include "src/compiler/operator-properties.h" | 13 #include "src/compiler/operator-properties.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 namespace internal { | 16 namespace internal { |
| 17 namespace compiler { | 17 namespace compiler { |
| 18 | 18 |
| 19 JSIntrinsicLowering::JSIntrinsicLowering(JSGraph* jsgraph) | 19 JSIntrinsicLowering::JSIntrinsicLowering(Editor* editor, JSGraph* jsgraph) |
| 20 : jsgraph_(jsgraph), simplified_(jsgraph->zone()) {} | 20 : AdvancedReducer(editor), |
| 21 jsgraph_(jsgraph), |
| 22 simplified_(jsgraph->zone()) {} |
| 21 | 23 |
| 22 | 24 |
| 23 Reduction JSIntrinsicLowering::Reduce(Node* node) { | 25 Reduction JSIntrinsicLowering::Reduce(Node* node) { |
| 24 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); | 26 if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange(); |
| 25 const Runtime::Function* const f = | 27 const Runtime::Function* const f = |
| 26 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); | 28 Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id()); |
| 27 if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange(); | 29 if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange(); |
| 28 switch (f->function_id) { | 30 switch (f->function_id) { |
| 29 case Runtime::kInlineConstructDouble: | 31 case Runtime::kInlineConstructDouble: |
| 30 return ReduceConstructDouble(node); | 32 return ReduceConstructDouble(node); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 90 |
| 89 | 91 |
| 90 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) { | 92 Reduction JSIntrinsicLowering::ReduceConstructDouble(Node* node) { |
| 91 Node* high = NodeProperties::GetValueInput(node, 0); | 93 Node* high = NodeProperties::GetValueInput(node, 0); |
| 92 Node* low = NodeProperties::GetValueInput(node, 1); | 94 Node* low = NodeProperties::GetValueInput(node, 1); |
| 93 Node* value = | 95 Node* value = |
| 94 graph()->NewNode(machine()->Float64InsertHighWord32(), | 96 graph()->NewNode(machine()->Float64InsertHighWord32(), |
| 95 graph()->NewNode(machine()->Float64InsertLowWord32(), | 97 graph()->NewNode(machine()->Float64InsertLowWord32(), |
| 96 jsgraph()->Constant(0), low), | 98 jsgraph()->Constant(0), low), |
| 97 high); | 99 high); |
| 98 NodeProperties::ReplaceWithValue(node, value); | 100 ReplaceWithValue(node, value); |
| 99 return Replace(value); | 101 return Replace(value); |
| 100 } | 102 } |
| 101 | 103 |
| 102 | 104 |
| 103 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { | 105 Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) { |
| 104 // TODO(jarin): This should not depend on the global flag. | 106 // TODO(jarin): This should not depend on the global flag. |
| 105 if (!FLAG_turbo_deoptimization) return NoChange(); | 107 if (!FLAG_turbo_deoptimization) return NoChange(); |
| 106 | 108 |
| 107 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); | 109 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); |
| 108 DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState); | 110 DCHECK_EQ(frame_state->opcode(), IrOpcode::kFrameState); |
| 109 | 111 |
| 110 Node* effect = NodeProperties::GetEffectInput(node); | 112 Node* effect = NodeProperties::GetEffectInput(node); |
| 111 Node* control = NodeProperties::GetControlInput(node); | 113 Node* control = NodeProperties::GetControlInput(node); |
| 112 | 114 |
| 113 // We are making the continuation after the call dead. To | 115 // We are making the continuation after the call dead. To |
| 114 // model this, we generate if (true) statement with deopt | 116 // model this, we generate if (true) statement with deopt |
| 115 // in the true branch and continuation in the false branch. | 117 // in the true branch and continuation in the false branch. |
| 116 Node* branch = | 118 Node* branch = |
| 117 graph()->NewNode(common()->Branch(), jsgraph()->TrueConstant(), control); | 119 graph()->NewNode(common()->Branch(), jsgraph()->TrueConstant(), control); |
| 118 | 120 |
| 119 // False branch - the original continuation. | 121 // False branch - the original continuation. |
| 120 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 122 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
| 121 NodeProperties::ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect, | 123 ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect, if_false); |
| 122 if_false); | |
| 123 | 124 |
| 124 // True branch: deopt. | 125 // True branch: deopt. |
| 125 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 126 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
| 126 Node* deopt = | 127 Node* deopt = |
| 127 graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_true); | 128 graph()->NewNode(common()->Deoptimize(), frame_state, effect, if_true); |
| 128 | 129 |
| 129 // Connect the deopt to the merge exiting the graph. | 130 // Connect the deopt to the merge exiting the graph. |
| 130 NodeProperties::MergeControlToEnd(graph(), common(), deopt); | 131 NodeProperties::MergeControlToEnd(graph(), common(), deopt); |
| 131 | 132 |
| 132 return Changed(deopt); | 133 return Changed(deopt); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), value, | 203 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), value, |
| 203 effect, if_false), | 204 effect, if_false), |
| 204 effect, if_false); | 205 effect, if_false); |
| 205 Node* vfalse = graph()->NewNode(machine()->Word32Equal(), efalse, | 206 Node* vfalse = graph()->NewNode(machine()->Word32Equal(), efalse, |
| 206 jsgraph()->Int32Constant(instance_type)); | 207 jsgraph()->Int32Constant(instance_type)); |
| 207 | 208 |
| 208 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); | 209 Node* merge = graph()->NewNode(common()->Merge(2), if_true, if_false); |
| 209 | 210 |
| 210 // Replace all effect uses of {node} with the {ephi}. | 211 // Replace all effect uses of {node} with the {ephi}. |
| 211 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); | 212 Node* ephi = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, merge); |
| 212 NodeProperties::ReplaceWithValue(node, node, ephi); | 213 ReplaceWithValue(node, node, ephi); |
| 213 | 214 |
| 214 // Turn the {node} into a Phi. | 215 // Turn the {node} into a Phi. |
| 215 return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge); | 216 return Change(node, common()->Phi(type, 2), vtrue, vfalse, merge); |
| 216 } | 217 } |
| 217 | 218 |
| 218 | 219 |
| 219 Reduction JSIntrinsicLowering::ReduceIsNonNegativeSmi(Node* node) { | 220 Reduction JSIntrinsicLowering::ReduceIsNonNegativeSmi(Node* node) { |
| 220 return Change(node, simplified()->ObjectIsNonNegativeSmi()); | 221 return Change(node, simplified()->ObjectIsNonNegativeSmi()); |
| 221 } | 222 } |
| 222 | 223 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 264 |
| 264 Reduction JSIntrinsicLowering::ReduceSeqStringGetChar( | 265 Reduction JSIntrinsicLowering::ReduceSeqStringGetChar( |
| 265 Node* node, String::Encoding encoding) { | 266 Node* node, String::Encoding encoding) { |
| 266 Node* effect = NodeProperties::GetEffectInput(node); | 267 Node* effect = NodeProperties::GetEffectInput(node); |
| 267 Node* control = NodeProperties::GetControlInput(node); | 268 Node* control = NodeProperties::GetControlInput(node); |
| 268 node->set_op( | 269 node->set_op( |
| 269 simplified()->LoadElement(AccessBuilder::ForSeqStringChar(encoding))); | 270 simplified()->LoadElement(AccessBuilder::ForSeqStringChar(encoding))); |
| 270 node->ReplaceInput(2, effect); | 271 node->ReplaceInput(2, effect); |
| 271 node->ReplaceInput(3, control); | 272 node->ReplaceInput(3, control); |
| 272 node->TrimInputCount(4); | 273 node->TrimInputCount(4); |
| 273 NodeProperties::ReplaceWithValue(node, node, node); | 274 RelaxControls(node); |
| 274 return Changed(node); | 275 return Changed(node); |
| 275 } | 276 } |
| 276 | 277 |
| 277 | 278 |
| 278 Reduction JSIntrinsicLowering::ReduceSeqStringSetChar( | 279 Reduction JSIntrinsicLowering::ReduceSeqStringSetChar( |
| 279 Node* node, String::Encoding encoding) { | 280 Node* node, String::Encoding encoding) { |
| 280 // Note: The intrinsic has a strange argument order, so we need to reshuffle. | 281 // Note: The intrinsic has a strange argument order, so we need to reshuffle. |
| 281 Node* index = NodeProperties::GetValueInput(node, 0); | 282 Node* index = NodeProperties::GetValueInput(node, 0); |
| 282 Node* chr = NodeProperties::GetValueInput(node, 1); | 283 Node* chr = NodeProperties::GetValueInput(node, 1); |
| 283 Node* string = NodeProperties::GetValueInput(node, 2); | 284 Node* string = NodeProperties::GetValueInput(node, 2); |
| 284 Node* effect = NodeProperties::GetEffectInput(node); | 285 Node* effect = NodeProperties::GetEffectInput(node); |
| 285 Node* control = NodeProperties::GetControlInput(node); | 286 Node* control = NodeProperties::GetControlInput(node); |
| 286 node->set_op( | 287 node->set_op( |
| 287 simplified()->StoreElement(AccessBuilder::ForSeqStringChar(encoding))); | 288 simplified()->StoreElement(AccessBuilder::ForSeqStringChar(encoding))); |
| 288 node->ReplaceInput(0, string); | 289 node->ReplaceInput(0, string); |
| 289 node->ReplaceInput(1, index); | 290 node->ReplaceInput(1, index); |
| 290 node->ReplaceInput(2, chr); | 291 node->ReplaceInput(2, chr); |
| 291 node->ReplaceInput(3, effect); | 292 node->ReplaceInput(3, effect); |
| 292 node->ReplaceInput(4, control); | 293 node->ReplaceInput(4, control); |
| 293 node->TrimInputCount(5); | 294 node->TrimInputCount(5); |
| 294 NodeProperties::RemoveBounds(node); | 295 NodeProperties::RemoveBounds(node); |
| 295 NodeProperties::ReplaceWithValue(node, string, node); | 296 ReplaceWithValue(node, string, node); |
| 296 return Changed(node); | 297 return Changed(node); |
| 297 } | 298 } |
| 298 | 299 |
| 299 | 300 |
| 300 Reduction JSIntrinsicLowering::ReduceStringGetLength(Node* node) { | 301 Reduction JSIntrinsicLowering::ReduceStringGetLength(Node* node) { |
| 301 Node* value = NodeProperties::GetValueInput(node, 0); | 302 Node* value = NodeProperties::GetValueInput(node, 0); |
| 302 Node* effect = NodeProperties::GetEffectInput(node); | 303 Node* effect = NodeProperties::GetEffectInput(node); |
| 303 Node* control = NodeProperties::GetControlInput(node); | 304 Node* control = NodeProperties::GetControlInput(node); |
| 304 return Change(node, simplified()->LoadField( | 305 return Change(node, simplified()->LoadField( |
| 305 AccessBuilder::ForStringLength(graph()->zone())), | 306 AccessBuilder::ForStringLength(graph()->zone())), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 318 // We have to "look through" ToBoolean calls. | 319 // We have to "look through" ToBoolean calls. |
| 319 nodes_to_visit.push(use); | 320 nodes_to_visit.push(use); |
| 320 } else if (use->opcode() == IrOpcode::kBranch) { | 321 } else if (use->opcode() == IrOpcode::kBranch) { |
| 321 // Actually set the hint on any branch using the intrinsic node. | 322 // Actually set the hint on any branch using the intrinsic node. |
| 322 use->set_op(common()->Branch(hint)); | 323 use->set_op(common()->Branch(hint)); |
| 323 } | 324 } |
| 324 } | 325 } |
| 325 } | 326 } |
| 326 // Apart from adding hints to branchs nodes, this is the identity function. | 327 // Apart from adding hints to branchs nodes, this is the identity function. |
| 327 Node* value = NodeProperties::GetValueInput(node, 0); | 328 Node* value = NodeProperties::GetValueInput(node, 0); |
| 328 NodeProperties::ReplaceWithValue(node, value); | 329 ReplaceWithValue(node, value); |
| 329 return Changed(value); | 330 return Changed(value); |
| 330 } | 331 } |
| 331 | 332 |
| 332 | 333 |
| 333 Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) { | 334 Reduction JSIntrinsicLowering::ReduceValueOf(Node* node) { |
| 334 // if (%_IsSmi(value)) { | 335 // if (%_IsSmi(value)) { |
| 335 // return value; | 336 // return value; |
| 336 // } else if (%_GetInstanceType(%_GetMap(value)) == JS_VALUE_TYPE) { | 337 // } else if (%_GetInstanceType(%_GetMap(value)) == JS_VALUE_TYPE) { |
| 337 // return %_GetValue(value); | 338 // return %_GetValue(value); |
| 338 // } else { | 339 // } else { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 380 |
| 380 Node* merge1 = graph()->NewNode(merge_op, if_true1, if_false1); | 381 Node* merge1 = graph()->NewNode(merge_op, if_true1, if_false1); |
| 381 efalse0 = graph()->NewNode(ephi_op, etrue1, efalse1, merge1); | 382 efalse0 = graph()->NewNode(ephi_op, etrue1, efalse1, merge1); |
| 382 vfalse0 = graph()->NewNode(phi_op, vtrue1, vfalse1, merge1); | 383 vfalse0 = graph()->NewNode(phi_op, vtrue1, vfalse1, merge1); |
| 383 } | 384 } |
| 384 | 385 |
| 385 Node* merge0 = graph()->NewNode(merge_op, if_true0, if_false0); | 386 Node* merge0 = graph()->NewNode(merge_op, if_true0, if_false0); |
| 386 | 387 |
| 387 // Replace all effect uses of {node} with the {ephi0}. | 388 // Replace all effect uses of {node} with the {ephi0}. |
| 388 Node* ephi0 = graph()->NewNode(ephi_op, etrue0, efalse0, merge0); | 389 Node* ephi0 = graph()->NewNode(ephi_op, etrue0, efalse0, merge0); |
| 389 NodeProperties::ReplaceWithValue(node, node, ephi0); | 390 ReplaceWithValue(node, node, ephi0); |
| 390 | 391 |
| 391 // Turn the {node} into a Phi. | 392 // Turn the {node} into a Phi. |
| 392 return Change(node, phi_op, vtrue0, vfalse0, merge0); | 393 return Change(node, phi_op, vtrue0, vfalse0, merge0); |
| 393 } | 394 } |
| 394 | 395 |
| 395 | 396 |
| 396 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op) { | 397 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op) { |
| 397 // Replace all effect uses of {node} with the effect dependency. | 398 // Replace all effect uses of {node} with the effect dependency. |
| 398 NodeProperties::ReplaceWithValue(node, node); | 399 RelaxEffectsAndControls(node); |
| 399 // Remove the inputs corresponding to context, effect and control. | 400 // Remove the inputs corresponding to context, effect and control. |
| 400 NodeProperties::RemoveNonValueInputs(node); | 401 NodeProperties::RemoveNonValueInputs(node); |
| 401 // Finally update the operator to the new one. | 402 // Finally update the operator to the new one. |
| 402 node->set_op(op); | 403 node->set_op(op); |
| 403 return Changed(node); | 404 return Changed(node); |
| 404 } | 405 } |
| 405 | 406 |
| 406 | 407 |
| 407 Reduction JSIntrinsicLowering::ReduceIsMinusZero(Node* node) { | 408 Reduction JSIntrinsicLowering::ReduceIsMinusZero(Node* node) { |
| 408 Node* value = NodeProperties::GetValueInput(node, 0); | 409 Node* value = NodeProperties::GetValueInput(node, 0); |
| 409 Node* effect = NodeProperties::GetEffectInput(node); | 410 Node* effect = NodeProperties::GetEffectInput(node); |
| 410 | 411 |
| 411 Node* double_lo = | 412 Node* double_lo = |
| 412 graph()->NewNode(machine()->Float64ExtractLowWord32(), value); | 413 graph()->NewNode(machine()->Float64ExtractLowWord32(), value); |
| 413 Node* check1 = graph()->NewNode(machine()->Word32Equal(), double_lo, | 414 Node* check1 = graph()->NewNode(machine()->Word32Equal(), double_lo, |
| 414 jsgraph()->ZeroConstant()); | 415 jsgraph()->ZeroConstant()); |
| 415 | 416 |
| 416 Node* double_hi = | 417 Node* double_hi = |
| 417 graph()->NewNode(machine()->Float64ExtractHighWord32(), value); | 418 graph()->NewNode(machine()->Float64ExtractHighWord32(), value); |
| 418 Node* check2 = graph()->NewNode( | 419 Node* check2 = graph()->NewNode( |
| 419 machine()->Word32Equal(), double_hi, | 420 machine()->Word32Equal(), double_hi, |
| 420 jsgraph()->Int32Constant(static_cast<int32_t>(0x80000000))); | 421 jsgraph()->Int32Constant(static_cast<int32_t>(0x80000000))); |
| 421 | 422 |
| 422 NodeProperties::ReplaceWithValue(node, node, effect); | 423 ReplaceWithValue(node, node, effect); |
| 423 | 424 |
| 424 Node* and_result = graph()->NewNode(machine()->Word32And(), check1, check2); | 425 Node* and_result = graph()->NewNode(machine()->Word32And(), check1, check2); |
| 425 | 426 |
| 426 return Change(node, machine()->Word32Equal(), and_result, | 427 return Change(node, machine()->Word32Equal(), and_result, |
| 427 jsgraph()->Int32Constant(1)); | 428 jsgraph()->Int32Constant(1)); |
| 428 } | 429 } |
| 429 | 430 |
| 430 | 431 |
| 431 Reduction JSIntrinsicLowering::ReduceFixedArraySet(Node* node) { | 432 Reduction JSIntrinsicLowering::ReduceFixedArraySet(Node* node) { |
| 432 Node* base = node->InputAt(0); | 433 Node* base = node->InputAt(0); |
| 433 Node* index = node->InputAt(1); | 434 Node* index = node->InputAt(1); |
| 434 Node* value = node->InputAt(2); | 435 Node* value = node->InputAt(2); |
| 435 Node* effect = NodeProperties::GetEffectInput(node); | 436 Node* effect = NodeProperties::GetEffectInput(node); |
| 436 Node* control = NodeProperties::GetControlInput(node); | 437 Node* control = NodeProperties::GetControlInput(node); |
| 437 Node* store = (graph()->NewNode( | 438 Node* store = (graph()->NewNode( |
| 438 simplified()->StoreElement(AccessBuilder::ForFixedArrayElement()), base, | 439 simplified()->StoreElement(AccessBuilder::ForFixedArrayElement()), base, |
| 439 index, value, effect, control)); | 440 index, value, effect, control)); |
| 440 NodeProperties::ReplaceWithValue(node, value, store); | 441 ReplaceWithValue(node, value, store); |
| 441 return Changed(store); | 442 return Changed(store); |
| 442 } | 443 } |
| 443 | 444 |
| 444 | 445 |
| 445 Reduction JSIntrinsicLowering::ReduceGetTypeFeedbackVector(Node* node) { | 446 Reduction JSIntrinsicLowering::ReduceGetTypeFeedbackVector(Node* node) { |
| 446 Node* func = node->InputAt(0); | 447 Node* func = node->InputAt(0); |
| 447 Node* effect = NodeProperties::GetEffectInput(node); | 448 Node* effect = NodeProperties::GetEffectInput(node); |
| 448 Node* control = NodeProperties::GetControlInput(node); | 449 Node* control = NodeProperties::GetControlInput(node); |
| 449 FieldAccess access = AccessBuilder::ForJSFunctionSharedFunctionInfo(); | 450 FieldAccess access = AccessBuilder::ForJSFunctionSharedFunctionInfo(); |
| 450 Node* load = | 451 Node* load = |
| 451 graph()->NewNode(simplified()->LoadField(access), func, effect, control); | 452 graph()->NewNode(simplified()->LoadField(access), func, effect, control); |
| 452 access = AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector(); | 453 access = AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector(); |
| 453 return Change(node, simplified()->LoadField(access), load, load, control); | 454 return Change(node, simplified()->LoadField(access), load, load, control); |
| 454 } | 455 } |
| 455 | 456 |
| 456 | 457 |
| 457 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, | 458 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, |
| 458 Node* b) { | 459 Node* b) { |
| 459 node->set_op(op); | 460 node->set_op(op); |
| 460 node->ReplaceInput(0, a); | 461 node->ReplaceInput(0, a); |
| 461 node->ReplaceInput(1, b); | 462 node->ReplaceInput(1, b); |
| 462 node->TrimInputCount(2); | 463 node->TrimInputCount(2); |
| 463 NodeProperties::ReplaceWithValue(node, node, node); | 464 RelaxControls(node); |
| 464 return Changed(node); | 465 return Changed(node); |
| 465 } | 466 } |
| 466 | 467 |
| 467 | 468 |
| 468 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, | 469 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, |
| 469 Node* b, Node* c) { | 470 Node* b, Node* c) { |
| 470 node->set_op(op); | 471 node->set_op(op); |
| 471 node->ReplaceInput(0, a); | 472 node->ReplaceInput(0, a); |
| 472 node->ReplaceInput(1, b); | 473 node->ReplaceInput(1, b); |
| 473 node->ReplaceInput(2, c); | 474 node->ReplaceInput(2, c); |
| 474 node->TrimInputCount(3); | 475 node->TrimInputCount(3); |
| 475 NodeProperties::ReplaceWithValue(node, node, node); | 476 RelaxControls(node); |
| 476 return Changed(node); | 477 return Changed(node); |
| 477 } | 478 } |
| 478 | 479 |
| 479 | 480 |
| 480 Reduction JSIntrinsicLowering::ChangeToUndefined(Node* node, Node* effect) { | 481 Reduction JSIntrinsicLowering::ChangeToUndefined(Node* node, Node* effect) { |
| 481 NodeProperties::ReplaceWithValue(node, jsgraph()->UndefinedConstant(), | 482 ReplaceWithValue(node, jsgraph()->UndefinedConstant(), effect); |
| 482 effect); | |
| 483 return Changed(node); | 483 return Changed(node); |
| 484 } | 484 } |
| 485 | 485 |
| 486 | 486 |
| 487 Graph* JSIntrinsicLowering::graph() const { return jsgraph()->graph(); } | 487 Graph* JSIntrinsicLowering::graph() const { return jsgraph()->graph(); } |
| 488 | 488 |
| 489 | 489 |
| 490 CommonOperatorBuilder* JSIntrinsicLowering::common() const { | 490 CommonOperatorBuilder* JSIntrinsicLowering::common() const { |
| 491 return jsgraph()->common(); | 491 return jsgraph()->common(); |
| 492 } | 492 } |
| 493 | 493 |
| 494 | 494 |
| 495 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { | 495 MachineOperatorBuilder* JSIntrinsicLowering::machine() const { |
| 496 return jsgraph()->machine(); | 496 return jsgraph()->machine(); |
| 497 } | 497 } |
| 498 | 498 |
| 499 } // namespace compiler | 499 } // namespace compiler |
| 500 } // namespace internal | 500 } // namespace internal |
| 501 } // namespace v8 | 501 } // namespace v8 |
| OLD | NEW |