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

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

Issue 2239923004: [turbofan] The PlainPrimitiveToNumber operator cannot have side effects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 Node* EffectControlLinearizer::SmiShiftBitsConstant() { 2517 Node* EffectControlLinearizer::SmiShiftBitsConstant() {
2518 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize); 2518 return jsgraph()->IntPtrConstant(kSmiShiftSize + kSmiTagSize);
2519 } 2519 }
2520 2520
2521 EffectControlLinearizer::ValueEffectControl 2521 EffectControlLinearizer::ValueEffectControl
2522 EffectControlLinearizer::LowerPlainPrimitiveToNumber(Node* node, Node* effect, 2522 EffectControlLinearizer::LowerPlainPrimitiveToNumber(Node* node, Node* effect,
2523 Node* control) { 2523 Node* control) {
2524 Node* value = node->InputAt(0); 2524 Node* value = node->InputAt(0);
2525 Node* result = effect = 2525 Node* result = effect =
2526 graph()->NewNode(ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(), 2526 graph()->NewNode(ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(),
2527 value, jsgraph()->NoContextConstant(), effect, control); 2527 value, jsgraph()->NoContextConstant(), effect);
2528 return ValueEffectControl(result, effect, control); 2528 return ValueEffectControl(result, effect, control);
2529 } 2529 }
2530 2530
2531 EffectControlLinearizer::ValueEffectControl 2531 EffectControlLinearizer::ValueEffectControl
2532 EffectControlLinearizer::LowerPlainPrimitiveToWord32(Node* node, Node* effect, 2532 EffectControlLinearizer::LowerPlainPrimitiveToWord32(Node* node, Node* effect,
2533 Node* control) { 2533 Node* control) {
2534 Node* value = node->InputAt(0); 2534 Node* value = node->InputAt(0);
2535 2535
2536 Node* check0 = ObjectIsSmi(value); 2536 Node* check0 = ObjectIsSmi(value);
2537 Node* branch0 = 2537 Node* branch0 =
2538 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control); 2538 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control);
2539 2539
2540 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0); 2540 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
2541 Node* etrue0 = effect; 2541 Node* etrue0 = effect;
2542 Node* vtrue0 = ChangeSmiToInt32(value); 2542 Node* vtrue0 = ChangeSmiToInt32(value);
2543 2543
2544 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); 2544 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2545 Node* efalse0 = effect; 2545 Node* efalse0 = effect;
2546 Node* vfalse0; 2546 Node* vfalse0;
2547 { 2547 {
2548 vfalse0 = efalse0 = graph()->NewNode( 2548 vfalse0 = efalse0 = graph()->NewNode(
2549 ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(), value, 2549 ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(), value,
2550 jsgraph()->NoContextConstant(), efalse0, if_false0); 2550 jsgraph()->NoContextConstant(), efalse0);
2551 2551
2552 Node* check1 = ObjectIsSmi(vfalse0); 2552 Node* check1 = ObjectIsSmi(vfalse0);
2553 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0); 2553 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0);
2554 2554
2555 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); 2555 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2556 Node* etrue1 = efalse0; 2556 Node* etrue1 = efalse0;
2557 Node* vtrue1 = ChangeSmiToInt32(vfalse0); 2557 Node* vtrue1 = ChangeSmiToInt32(vfalse0);
2558 2558
2559 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1); 2559 Node* if_false1 = graph()->NewNode(common()->IfFalse(), branch1);
2560 Node* efalse1 = efalse0; 2560 Node* efalse1 = efalse0;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2596 vtrue0 = ChangeSmiToInt32(value); 2596 vtrue0 = ChangeSmiToInt32(value);
2597 vtrue0 = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue0); 2597 vtrue0 = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue0);
2598 } 2598 }
2599 2599
2600 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0); 2600 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
2601 Node* efalse0 = effect; 2601 Node* efalse0 = effect;
2602 Node* vfalse0; 2602 Node* vfalse0;
2603 { 2603 {
2604 vfalse0 = efalse0 = graph()->NewNode( 2604 vfalse0 = efalse0 = graph()->NewNode(
2605 ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(), value, 2605 ToNumberOperator(), jsgraph()->ToNumberBuiltinConstant(), value,
2606 jsgraph()->NoContextConstant(), efalse0, if_false0); 2606 jsgraph()->NoContextConstant(), efalse0);
2607 2607
2608 Node* check1 = ObjectIsSmi(vfalse0); 2608 Node* check1 = ObjectIsSmi(vfalse0);
2609 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0); 2609 Node* branch1 = graph()->NewNode(common()->Branch(), check1, if_false0);
2610 2610
2611 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1); 2611 Node* if_true1 = graph()->NewNode(common()->IfTrue(), branch1);
2612 Node* etrue1 = efalse0; 2612 Node* etrue1 = efalse0;
2613 Node* vtrue1; 2613 Node* vtrue1;
2614 { 2614 {
2615 vtrue1 = ChangeSmiToInt32(vfalse0); 2615 vtrue1 = ChangeSmiToInt32(vfalse0);
2616 vtrue1 = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue1); 2616 vtrue1 = graph()->NewNode(machine()->ChangeInt32ToFloat64(), vtrue1);
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
3300 Isolate* EffectControlLinearizer::isolate() const { 3300 Isolate* EffectControlLinearizer::isolate() const {
3301 return jsgraph()->isolate(); 3301 return jsgraph()->isolate();
3302 } 3302 }
3303 3303
3304 Operator const* EffectControlLinearizer::ToNumberOperator() { 3304 Operator const* EffectControlLinearizer::ToNumberOperator() {
3305 if (!to_number_operator_.is_set()) { 3305 if (!to_number_operator_.is_set()) {
3306 Callable callable = CodeFactory::ToNumber(isolate()); 3306 Callable callable = CodeFactory::ToNumber(isolate());
3307 CallDescriptor::Flags flags = CallDescriptor::kNoFlags; 3307 CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
3308 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 3308 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
3309 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3309 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3310 Operator::kNoThrow); 3310 Operator::kEliminatable);
3311 to_number_operator_.set(common()->Call(desc)); 3311 to_number_operator_.set(common()->Call(desc));
3312 } 3312 }
3313 return to_number_operator_.get(); 3313 return to_number_operator_.get();
3314 } 3314 }
3315 3315
3316 } // namespace compiler 3316 } // namespace compiler
3317 } // namespace internal 3317 } // namespace internal
3318 } // namespace v8 3318 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698