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

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

Issue 2517913002: [turbofan] Introduce LoadFunctionPrototype simplified operator. (Closed)
Patch Set: Created 4 years, 1 month 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/compiler-source-position-table.h" 9 #include "src/compiler/compiler-source-position-table.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 break; 777 break;
778 case IrOpcode::kTransitionElementsKind: 778 case IrOpcode::kTransitionElementsKind:
779 state = LowerTransitionElementsKind(node, *effect, *control); 779 state = LowerTransitionElementsKind(node, *effect, *control);
780 break; 780 break;
781 case IrOpcode::kLoadTypedElement: 781 case IrOpcode::kLoadTypedElement:
782 state = LowerLoadTypedElement(node, *effect, *control); 782 state = LowerLoadTypedElement(node, *effect, *control);
783 break; 783 break;
784 case IrOpcode::kStoreTypedElement: 784 case IrOpcode::kStoreTypedElement:
785 state = LowerStoreTypedElement(node, *effect, *control); 785 state = LowerStoreTypedElement(node, *effect, *control);
786 break; 786 break;
787 case IrOpcode::kLoadFunctionPrototype:
788 state = LowerLoadFunctionPrototype(node, *effect, *control);
789 break;
787 case IrOpcode::kFloat64RoundUp: 790 case IrOpcode::kFloat64RoundUp:
788 state = LowerFloat64RoundUp(node, *effect, *control); 791 state = LowerFloat64RoundUp(node, *effect, *control);
789 break; 792 break;
790 case IrOpcode::kFloat64RoundDown: 793 case IrOpcode::kFloat64RoundDown:
791 state = LowerFloat64RoundDown(node, *effect, *control); 794 state = LowerFloat64RoundDown(node, *effect, *control);
792 break; 795 break;
793 case IrOpcode::kFloat64RoundTruncate: 796 case IrOpcode::kFloat64RoundTruncate:
794 state = LowerFloat64RoundTruncate(node, *effect, *control); 797 state = LowerFloat64RoundTruncate(node, *effect, *control);
795 break; 798 break;
796 case IrOpcode::kFloat64RoundTiesEven: 799 case IrOpcode::kFloat64RoundTiesEven:
(...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 // Perform the actual typed element access. 3270 // Perform the actual typed element access.
3268 effect = graph()->NewNode( 3271 effect = graph()->NewNode(
3269 simplified()->StoreElement( 3272 simplified()->StoreElement(
3270 AccessBuilder::ForTypedArrayElement(array_type, true)), 3273 AccessBuilder::ForTypedArrayElement(array_type, true)),
3271 storage, index, value, effect, control); 3274 storage, index, value, effect, control);
3272 3275
3273 return ValueEffectControl(nullptr, effect, control); 3276 return ValueEffectControl(nullptr, effect, control);
3274 } 3277 }
3275 3278
3276 EffectControlLinearizer::ValueEffectControl 3279 EffectControlLinearizer::ValueEffectControl
3280 EffectControlLinearizer::LowerLoadFunctionPrototype(Node* node, Node* effect,
3281 Node* control) {
3282 Node* function = node->InputAt(0);
3283
3284 // Load the {JSFunction::prototype-or-initial-map} field.
3285 Node* function_prototype_or_initial_map = effect =
3286 graph()->NewNode(simplified()->LoadField(
3287 AccessBuilder::ForJSFunctionPrototypeOrInitialMap()),
3288 function, effect, control);
3289 Node* function_prototype_or_initial_map_map = effect =
3290 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
3291 function, effect, control);
3292
3293 // Check if the {function} has an initial map.
3294 Node* check0 = graph()->NewNode(
3295 machine()->WordEqual(), function_prototype_or_initial_map_map,
3296 jsgraph()->HeapConstant(factory()->meta_map()));
3297 Node* branch0 =
3298 graph()->NewNode(common()->Branch(BranchHint::kTrue), check0, control);
3299
3300 Node* if_true0 = graph()->NewNode(common()->IfTrue(), branch0);
3301 Node* etrue0 = effect;
3302 Node* vtrue0;
3303 {
3304 // Load the "prototype" from the initial map.
3305 vtrue0 = etrue0 = graph()->NewNode(
3306 simplified()->LoadField(AccessBuilder::ForMapPrototype()),
3307 function_prototype_or_initial_map, etrue0, if_true0);
3308 }
3309
3310 Node* if_false0 = graph()->NewNode(common()->IfFalse(), branch0);
3311 Node* efalse0 = effect;
3312 Node* vfalse0 = function_prototype_or_initial_map;
3313
3314 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0);
3315 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control);
3316 Node* value =
3317 graph()->NewNode(common()->Phi(MachineRepresentation::kTaggedPointer, 2),
3318 vtrue0, vfalse0, control);
3319
3320 return ValueEffectControl(value, effect, control);
3321 }
3322
3323 EffectControlLinearizer::ValueEffectControl
3277 EffectControlLinearizer::LowerFloat64RoundUp(Node* node, Node* effect, 3324 EffectControlLinearizer::LowerFloat64RoundUp(Node* node, Node* effect,
3278 Node* control) { 3325 Node* control) {
3279 // Nothing to be done if a fast hardware instruction is available. 3326 // Nothing to be done if a fast hardware instruction is available.
3280 if (machine()->Float64RoundUp().IsSupported()) { 3327 if (machine()->Float64RoundUp().IsSupported()) {
3281 return ValueEffectControl(node, effect, control); 3328 return ValueEffectControl(node, effect, control);
3282 } 3329 }
3283 3330
3284 Node* const one = jsgraph()->Float64Constant(1.0); 3331 Node* const one = jsgraph()->Float64Constant(1.0);
3285 Node* const zero = jsgraph()->Float64Constant(0.0); 3332 Node* const zero = jsgraph()->Float64Constant(0.0);
3286 Node* const minus_zero = jsgraph()->Float64Constant(-0.0); 3333 Node* const minus_zero = jsgraph()->Float64Constant(-0.0);
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
3774 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3821 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3775 Operator::kEliminatable); 3822 Operator::kEliminatable);
3776 to_number_operator_.set(common()->Call(desc)); 3823 to_number_operator_.set(common()->Call(desc));
3777 } 3824 }
3778 return to_number_operator_.get(); 3825 return to_number_operator_.get();
3779 } 3826 }
3780 3827
3781 } // namespace compiler 3828 } // namespace compiler
3782 } // namespace internal 3829 } // namespace internal
3783 } // namespace v8 3830 } // 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