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

Side by Side Diff: src/compiler/effect-control-linearizer.cc

Issue 2236443004: [turbofan] Introduce a dedicated ConvertTaggedHoleToUndefined operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix verify heap. Created 4 years, 4 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
OLDNEW
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/effect-control-linearizer.h" 5 #include "src/compiler/effect-control-linearizer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/js-graph.h" 9 #include "src/compiler/js-graph.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 break; 707 break;
708 case IrOpcode::kStringCharCodeAt: 708 case IrOpcode::kStringCharCodeAt:
709 state = LowerStringCharCodeAt(node, *effect, *control); 709 state = LowerStringCharCodeAt(node, *effect, *control);
710 break; 710 break;
711 case IrOpcode::kCheckFloat64Hole: 711 case IrOpcode::kCheckFloat64Hole:
712 state = LowerCheckFloat64Hole(node, frame_state, *effect, *control); 712 state = LowerCheckFloat64Hole(node, frame_state, *effect, *control);
713 break; 713 break;
714 case IrOpcode::kCheckTaggedHole: 714 case IrOpcode::kCheckTaggedHole:
715 state = LowerCheckTaggedHole(node, frame_state, *effect, *control); 715 state = LowerCheckTaggedHole(node, frame_state, *effect, *control);
716 break; 716 break;
717 case IrOpcode::kConvertTaggedHoleToUndefined:
718 state = LowerConvertTaggedHoleToUndefined(node, *effect, *control);
719 break;
717 case IrOpcode::kPlainPrimitiveToNumber: 720 case IrOpcode::kPlainPrimitiveToNumber:
718 state = LowerPlainPrimitiveToNumber(node, *effect, *control); 721 state = LowerPlainPrimitiveToNumber(node, *effect, *control);
719 break; 722 break;
720 case IrOpcode::kPlainPrimitiveToWord32: 723 case IrOpcode::kPlainPrimitiveToWord32:
721 state = LowerPlainPrimitiveToWord32(node, *effect, *control); 724 state = LowerPlainPrimitiveToWord32(node, *effect, *control);
722 break; 725 break;
723 case IrOpcode::kPlainPrimitiveToFloat64: 726 case IrOpcode::kPlainPrimitiveToFloat64:
724 state = LowerPlainPrimitiveToFloat64(node, *effect, *control); 727 state = LowerPlainPrimitiveToFloat64(node, *effect, *control);
725 break; 728 break;
726 case IrOpcode::kEnsureWritableFastElements: 729 case IrOpcode::kEnsureWritableFastElements:
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
2411 control = effect = 2414 control = effect =
2412 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kHole), check, 2415 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kHole), check,
2413 frame_state, effect, control); 2416 frame_state, effect, control);
2414 2417
2415 return ValueEffectControl(value, effect, control); 2418 return ValueEffectControl(value, effect, control);
2416 } 2419 }
2417 2420
2418 EffectControlLinearizer::ValueEffectControl 2421 EffectControlLinearizer::ValueEffectControl
2419 EffectControlLinearizer::LowerCheckTaggedHole(Node* node, Node* frame_state, 2422 EffectControlLinearizer::LowerCheckTaggedHole(Node* node, Node* frame_state,
2420 Node* effect, Node* control) { 2423 Node* effect, Node* control) {
2421 CheckTaggedHoleMode mode = CheckTaggedHoleModeOf(node->op());
2422 Node* value = node->InputAt(0); 2424 Node* value = node->InputAt(0);
2423 Node* check = graph()->NewNode(machine()->WordEqual(), value, 2425 Node* check = graph()->NewNode(machine()->WordEqual(), value,
2424 jsgraph()->TheHoleConstant()); 2426 jsgraph()->TheHoleConstant());
2425 switch (mode) { 2427 control = effect =
2426 case CheckTaggedHoleMode::kConvertHoleToUndefined: 2428 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kHole), check,
2427 value = graph()->NewNode( 2429 frame_state, effect, control);
2428 common()->Select(MachineRepresentation::kTagged, BranchHint::kFalse),
2429 check, jsgraph()->UndefinedConstant(), value);
2430 break;
2431 case CheckTaggedHoleMode::kNeverReturnHole:
2432 control = effect =
2433 graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kHole),
2434 check, frame_state, effect, control);
2435 break;
2436 }
2437 2430
2438 return ValueEffectControl(value, effect, control); 2431 return ValueEffectControl(value, effect, control);
2439 } 2432 }
2433
2434 EffectControlLinearizer::ValueEffectControl
2435 EffectControlLinearizer::LowerConvertTaggedHoleToUndefined(Node* node,
2436 Node* effect,
2437 Node* control) {
2438 Node* value = node->InputAt(0);
2439 Node* check = graph()->NewNode(machine()->WordEqual(), value,
2440 jsgraph()->TheHoleConstant());
2441 Node* branch =
2442 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
2443
2444 Node* if_true = graph()->NewNode(common()->IfTrue(), branch);
2445 Node* vtrue = jsgraph()->UndefinedConstant();
2446
2447 Node* if_false = graph()->NewNode(common()->IfFalse(), branch);
2448 Node* vfalse = value;
2449
2450 control = graph()->NewNode(common()->Merge(2), if_true, if_false);
2451 value = graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 2),
2452 vtrue, vfalse, control);
2453
2454 return ValueEffectControl(value, effect, control);
2455 }
2440 2456
2441 EffectControlLinearizer::ValueEffectControl 2457 EffectControlLinearizer::ValueEffectControl
2442 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect, 2458 EffectControlLinearizer::AllocateHeapNumberWithValue(Node* value, Node* effect,
2443 Node* control) { 2459 Node* control) {
2444 Node* result = effect = graph()->NewNode( 2460 Node* result = effect = graph()->NewNode(
2445 simplified()->Allocate(NOT_TENURED), 2461 simplified()->Allocate(NOT_TENURED),
2446 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control); 2462 jsgraph()->Int32Constant(HeapNumber::kSize), effect, control);
2447 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()), 2463 effect = graph()->NewNode(simplified()->StoreField(AccessBuilder::ForMap()),
2448 result, jsgraph()->HeapNumberMapConstant(), effect, 2464 result, jsgraph()->HeapNumberMapConstant(), effect,
2449 control); 2465 control);
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
3289 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3305 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3290 Operator::kNoThrow); 3306 Operator::kNoThrow);
3291 to_number_operator_.set(common()->Call(desc)); 3307 to_number_operator_.set(common()->Call(desc));
3292 } 3308 }
3293 return to_number_operator_.get(); 3309 return to_number_operator_.get();
3294 } 3310 }
3295 3311
3296 } // namespace compiler 3312 } // namespace compiler
3297 } // namespace internal 3313 } // namespace internal
3298 } // namespace v8 3314 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698