Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/code-factory.h" | 5 #include "src/code-factory.h" |
| 6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" |
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
| 8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" |
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 DCHECK_EQ(0, op->ControlInputCount()); | 156 DCHECK_EQ(0, op->ControlInputCount()); |
| 157 DCHECK_EQ(2, op->ValueInputCount()); | 157 DCHECK_EQ(2, op->ValueInputCount()); |
| 158 | 158 |
| 159 // Remove the effects from the node, and update its effect/control usages. | 159 // Remove the effects from the node, and update its effect/control usages. |
| 160 if (node_->op()->EffectInputCount() > 0) { | 160 if (node_->op()->EffectInputCount() > 0) { |
| 161 lowering_->RelaxEffectsAndControls(node_); | 161 lowering_->RelaxEffectsAndControls(node_); |
| 162 } | 162 } |
| 163 // Remove the inputs corresponding to context, effect, and control. | 163 // Remove the inputs corresponding to context, effect, and control. |
| 164 NodeProperties::RemoveNonValueInputs(node_); | 164 NodeProperties::RemoveNonValueInputs(node_); |
| 165 // Finally, update the operator to the new one. | 165 // Finally, update the operator to the new one. |
| 166 node_->set_op(op); | 166 NodeProperties::ChangeOp(node_, op); |
| 167 | 167 |
| 168 // TODO(jarin): Replace the explicit typing hack with a call to some method | 168 // TODO(jarin): Replace the explicit typing hack with a call to some method |
| 169 // that encapsulates changing the operator and re-typing. | 169 // that encapsulates changing the operator and re-typing. |
| 170 Type* node_type = NodeProperties::GetType(node_); | 170 Type* node_type = NodeProperties::GetType(node_); |
| 171 NodeProperties::SetType(node_, Type::Intersect(node_type, type, zone())); | 171 NodeProperties::SetType(node_, Type::Intersect(node_type, type, zone())); |
| 172 | 172 |
| 173 if (invert) { | 173 if (invert) { |
| 174 // Insert an boolean not to invert the value. | 174 // Insert an boolean not to invert the value. |
| 175 Node* value = graph()->NewNode(simplified()->BooleanNot(), node_); | 175 Node* value = graph()->NewNode(simplified()->BooleanNot(), node_); |
| 176 node_->ReplaceUses(value); | 176 node_->ReplaceUses(value); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 Node* exception_effect = | 355 Node* exception_effect = |
| 356 graph()->NewNode(common()->EffectPhi(2), left_exception, | 356 graph()->NewNode(common()->EffectPhi(2), left_exception, |
| 357 right_exception, exception_merge); | 357 right_exception, exception_merge); |
| 358 for (Edge edge : exception_merge->use_edges()) { | 358 for (Edge edge : exception_merge->use_edges()) { |
| 359 if (NodeProperties::IsEffectEdge(edge)) edge.UpdateTo(exception_effect); | 359 if (NodeProperties::IsEffectEdge(edge)) edge.UpdateTo(exception_effect); |
| 360 if (NodeProperties::IsValueEdge(edge)) edge.UpdateTo(exception_value); | 360 if (NodeProperties::IsValueEdge(edge)) edge.UpdateTo(exception_value); |
| 361 } | 361 } |
| 362 NodeProperties::RemoveType(exception_merge); | 362 NodeProperties::RemoveType(exception_merge); |
| 363 exception_merge->ReplaceInput(0, left_exception); | 363 exception_merge->ReplaceInput(0, left_exception); |
| 364 exception_merge->ReplaceInput(1, right_exception); | 364 exception_merge->ReplaceInput(1, right_exception); |
| 365 exception_merge->set_op(common()->Merge(2)); | 365 NodeProperties::ChangeOp(exception_merge, common()->Merge(2)); |
| 366 | 366 |
| 367 *left_result = left_conv; | 367 *left_result = left_conv; |
| 368 *right_result = right_conv; | 368 *right_result = right_conv; |
| 369 } | 369 } |
| 370 | 370 |
| 371 Node* ConvertToUI32(Node* node, Signedness signedness) { | 371 Node* ConvertToUI32(Node* node, Signedness signedness) { |
| 372 // Avoid introducing too many eager NumberToXXnt32() operations. | 372 // Avoid introducing too many eager NumberToXXnt32() operations. |
| 373 Type* type = NodeProperties::GetType(node); | 373 Type* type = NodeProperties::GetType(node); |
| 374 if (signedness == kSigned) { | 374 if (signedness == kSigned) { |
| 375 if (!type->Is(Type::Signed32())) { | 375 if (!type->Is(Type::Signed32())) { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 406 // JSAdd(x:string, y:string) => CallStub[StringAdd](x, y) | 406 // JSAdd(x:string, y:string) => CallStub[StringAdd](x, y) |
| 407 Callable const callable = | 407 Callable const callable = |
| 408 CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); | 408 CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED); |
| 409 CallDescriptor const* const desc = Linkage::GetStubCallDescriptor( | 409 CallDescriptor const* const desc = Linkage::GetStubCallDescriptor( |
| 410 isolate(), graph()->zone(), callable.descriptor(), 0, | 410 isolate(), graph()->zone(), callable.descriptor(), 0, |
| 411 CallDescriptor::kNeedsFrameState, node->op()->properties()); | 411 CallDescriptor::kNeedsFrameState, node->op()->properties()); |
| 412 DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op())); | 412 DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op())); |
| 413 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); | 413 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1); |
| 414 node->InsertInput(graph()->zone(), 0, | 414 node->InsertInput(graph()->zone(), 0, |
| 415 jsgraph()->HeapConstant(callable.code())); | 415 jsgraph()->HeapConstant(callable.code())); |
| 416 node->set_op(common()->Call(desc)); | 416 NodeProperties::ChangeOp(node, common()->Call(desc)); |
| 417 return Changed(node); | 417 return Changed(node); |
| 418 } | 418 } |
| 419 return NoChange(); | 419 return NoChange(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 | 422 |
| 423 Reduction JSTypedLowering::ReduceJSModulus(Node* node) { | 423 Reduction JSTypedLowering::ReduceJSModulus(Node* node) { |
| 424 JSBinopReduction r(this, node); | 424 JSBinopReduction r(this, node); |
| 425 if (r.BothInputsAre(Type::Number())) { | 425 if (r.BothInputsAre(Type::Number())) { |
| 426 // JSModulus(x:number, x:number) => NumberModulus(x, y) | 426 // JSModulus(x:number, x:number) => NumberModulus(x, y) |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 622 // TODO(turbofan): js-typed-lowering of StrictEqual(mixed types) | 622 // TODO(turbofan): js-typed-lowering of StrictEqual(mixed types) |
| 623 return NoChange(); | 623 return NoChange(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 | 626 |
| 627 Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) { | 627 Reduction JSTypedLowering::ReduceJSUnaryNot(Node* node) { |
| 628 Node* const input = node->InputAt(0); | 628 Node* const input = node->InputAt(0); |
| 629 Type* const input_type = NodeProperties::GetType(input); | 629 Type* const input_type = NodeProperties::GetType(input); |
| 630 if (input_type->Is(Type::Boolean())) { | 630 if (input_type->Is(Type::Boolean())) { |
| 631 // JSUnaryNot(x:boolean) => BooleanNot(x) | 631 // JSUnaryNot(x:boolean) => BooleanNot(x) |
| 632 node->set_op(simplified()->BooleanNot()); | |
| 633 node->TrimInputCount(1); | 632 node->TrimInputCount(1); |
| 633 NodeProperties::ChangeOp(node, simplified()->BooleanNot()); | |
|
Jarin
2015/09/24 14:00:41
After ReplaceInput? (Here and below.)
Michael Starzinger
2015/09/24 14:21:28
Done.
| |
| 634 return Changed(node); | 634 return Changed(node); |
| 635 } else if (input_type->Is(Type::OrderedNumber())) { | 635 } else if (input_type->Is(Type::OrderedNumber())) { |
| 636 // JSUnaryNot(x:number) => NumberEqual(x,#0) | 636 // JSUnaryNot(x:number) => NumberEqual(x,#0) |
| 637 node->set_op(simplified()->NumberEqual()); | 637 NodeProperties::ChangeOp(node, simplified()->NumberEqual()); |
| 638 node->ReplaceInput(1, jsgraph()->ZeroConstant()); | 638 node->ReplaceInput(1, jsgraph()->ZeroConstant()); |
| 639 DCHECK_EQ(2, node->InputCount()); | 639 DCHECK_EQ(2, node->InputCount()); |
| 640 return Changed(node); | 640 return Changed(node); |
| 641 } else if (input_type->Is(Type::String())) { | 641 } else if (input_type->Is(Type::String())) { |
| 642 // JSUnaryNot(x:string) => NumberEqual(x.length,#0) | 642 // JSUnaryNot(x:string) => NumberEqual(x.length,#0) |
| 643 FieldAccess const access = AccessBuilder::ForStringLength(graph()->zone()); | 643 FieldAccess const access = AccessBuilder::ForStringLength(graph()->zone()); |
| 644 // It is safe for the load to be effect-free (i.e. not linked into effect | 644 // It is safe for the load to be effect-free (i.e. not linked into effect |
| 645 // chain) because we assume String::length to be immutable. | 645 // chain) because we assume String::length to be immutable. |
| 646 Node* length = graph()->NewNode(simplified()->LoadField(access), input, | 646 Node* length = graph()->NewNode(simplified()->LoadField(access), input, |
| 647 graph()->start(), graph()->start()); | 647 graph()->start(), graph()->start()); |
| 648 node->set_op(simplified()->NumberEqual()); | 648 NodeProperties::ChangeOp(node, simplified()->NumberEqual()); |
| 649 node->ReplaceInput(0, length); | 649 node->ReplaceInput(0, length); |
| 650 node->ReplaceInput(1, jsgraph()->ZeroConstant()); | 650 node->ReplaceInput(1, jsgraph()->ZeroConstant()); |
| 651 ReplaceWithValue(node, node, length); | 651 ReplaceWithValue(node, node, length); |
| 652 DCHECK_EQ(2, node->InputCount()); | 652 DCHECK_EQ(2, node->InputCount()); |
| 653 return Changed(node); | 653 return Changed(node); |
| 654 } | 654 } |
| 655 return NoChange(); | 655 return NoChange(); |
| 656 } | 656 } |
| 657 | 657 |
| 658 | 658 |
| 659 Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { | 659 Reduction JSTypedLowering::ReduceJSToBoolean(Node* node) { |
| 660 Node* const input = node->InputAt(0); | 660 Node* const input = node->InputAt(0); |
| 661 Type* const input_type = NodeProperties::GetType(input); | 661 Type* const input_type = NodeProperties::GetType(input); |
| 662 if (input_type->Is(Type::Boolean())) { | 662 if (input_type->Is(Type::Boolean())) { |
| 663 // JSToBoolean(x:boolean) => x | 663 // JSToBoolean(x:boolean) => x |
| 664 return Replace(input); | 664 return Replace(input); |
| 665 } else if (input_type->Is(Type::OrderedNumber())) { | 665 } else if (input_type->Is(Type::OrderedNumber())) { |
| 666 // JSToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x,#0)) | 666 // JSToBoolean(x:ordered-number) => BooleanNot(NumberEqual(x,#0)) |
| 667 node->set_op(simplified()->BooleanNot()); | |
| 668 node->ReplaceInput(0, graph()->NewNode(simplified()->NumberEqual(), input, | 667 node->ReplaceInput(0, graph()->NewNode(simplified()->NumberEqual(), input, |
| 669 jsgraph()->ZeroConstant())); | 668 jsgraph()->ZeroConstant())); |
| 670 node->TrimInputCount(1); | 669 node->TrimInputCount(1); |
| 670 NodeProperties::ChangeOp(node, simplified()->BooleanNot()); | |
| 671 return Changed(node); | 671 return Changed(node); |
| 672 } else if (input_type->Is(Type::String())) { | 672 } else if (input_type->Is(Type::String())) { |
| 673 // JSToBoolean(x:string) => NumberLessThan(#0,x.length) | 673 // JSToBoolean(x:string) => NumberLessThan(#0,x.length) |
| 674 FieldAccess const access = AccessBuilder::ForStringLength(graph()->zone()); | 674 FieldAccess const access = AccessBuilder::ForStringLength(graph()->zone()); |
| 675 // It is safe for the load to be effect-free (i.e. not linked into effect | 675 // It is safe for the load to be effect-free (i.e. not linked into effect |
| 676 // chain) because we assume String::length to be immutable. | 676 // chain) because we assume String::length to be immutable. |
| 677 Node* length = graph()->NewNode(simplified()->LoadField(access), input, | 677 Node* length = graph()->NewNode(simplified()->LoadField(access), input, |
| 678 graph()->start(), graph()->start()); | 678 graph()->start(), graph()->start()); |
| 679 node->set_op(simplified()->NumberLessThan()); | 679 NodeProperties::ChangeOp(node, simplified()->NumberLessThan()); |
| 680 node->ReplaceInput(0, jsgraph()->ZeroConstant()); | 680 node->ReplaceInput(0, jsgraph()->ZeroConstant()); |
| 681 node->ReplaceInput(1, length); | 681 node->ReplaceInput(1, length); |
| 682 DCHECK_EQ(2, node->InputCount()); | 682 DCHECK_EQ(2, node->InputCount()); |
| 683 return Changed(node); | 683 return Changed(node); |
| 684 } | 684 } |
| 685 return NoChange(); | 685 return NoChange(); |
| 686 } | 686 } |
| 687 | 687 |
| 688 | 688 |
| 689 Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) { | 689 Reduction JSTypedLowering::ReduceJSToNumberInput(Node* input) { |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 // For integer-typed arrays, convert to the integer type. | 901 // For integer-typed arrays, convert to the integer type. |
| 902 if (TypeOf(access.machine_type()) == kTypeInt32 && | 902 if (TypeOf(access.machine_type()) == kTypeInt32 && |
| 903 !value_type->Is(Type::Signed32())) { | 903 !value_type->Is(Type::Signed32())) { |
| 904 value = graph()->NewNode(simplified()->NumberToInt32(), value); | 904 value = graph()->NewNode(simplified()->NumberToInt32(), value); |
| 905 } else if (TypeOf(access.machine_type()) == kTypeUint32 && | 905 } else if (TypeOf(access.machine_type()) == kTypeUint32 && |
| 906 !value_type->Is(Type::Unsigned32())) { | 906 !value_type->Is(Type::Unsigned32())) { |
| 907 value = graph()->NewNode(simplified()->NumberToUint32(), value); | 907 value = graph()->NewNode(simplified()->NumberToUint32(), value); |
| 908 } | 908 } |
| 909 // Check if we can avoid the bounds check. | 909 // Check if we can avoid the bounds check. |
| 910 if (key_type->Min() >= 0 && key_type->Max() < array->length_value()) { | 910 if (key_type->Min() >= 0 && key_type->Max() < array->length_value()) { |
| 911 node->set_op(simplified()->StoreElement( | |
| 912 AccessBuilder::ForTypedArrayElement(array->type(), true))); | |
| 913 node->ReplaceInput(0, buffer); | 911 node->ReplaceInput(0, buffer); |
| 914 DCHECK_EQ(key, node->InputAt(1)); | 912 DCHECK_EQ(key, node->InputAt(1)); |
| 915 node->ReplaceInput(2, value); | 913 node->ReplaceInput(2, value); |
| 916 node->ReplaceInput(3, effect); | 914 node->ReplaceInput(3, effect); |
| 917 node->ReplaceInput(4, control); | 915 node->ReplaceInput(4, control); |
| 918 node->TrimInputCount(5); | 916 node->TrimInputCount(5); |
| 917 NodeProperties::ChangeOp( | |
| 918 node, | |
| 919 simplified()->StoreElement( | |
| 920 AccessBuilder::ForTypedArrayElement(array->type(), true))); | |
| 919 RelaxControls(node); | 921 RelaxControls(node); |
| 920 return Changed(node); | 922 return Changed(node); |
| 921 } | 923 } |
| 922 // Compute byte offset. | 924 // Compute byte offset. |
| 923 Node* offset = Word32Shl(key, static_cast<int>(k)); | 925 Node* offset = Word32Shl(key, static_cast<int>(k)); |
| 924 // Turn into a StoreBuffer operation. | 926 // Turn into a StoreBuffer operation. |
| 925 node->set_op(simplified()->StoreBuffer(access)); | |
| 926 node->ReplaceInput(0, buffer); | 927 node->ReplaceInput(0, buffer); |
| 927 node->ReplaceInput(1, offset); | 928 node->ReplaceInput(1, offset); |
| 928 node->ReplaceInput(2, length); | 929 node->ReplaceInput(2, length); |
| 929 node->ReplaceInput(3, value); | 930 node->ReplaceInput(3, value); |
| 930 node->ReplaceInput(4, effect); | 931 node->ReplaceInput(4, effect); |
| 931 node->ReplaceInput(5, control); | 932 node->ReplaceInput(5, control); |
| 932 node->TrimInputCount(6); | 933 node->TrimInputCount(6); |
| 934 NodeProperties::ChangeOp(node, simplified()->StoreBuffer(access)); | |
| 933 RelaxControls(node); | 935 RelaxControls(node); |
| 934 return Changed(node); | 936 return Changed(node); |
| 935 } | 937 } |
| 936 } | 938 } |
| 937 } | 939 } |
| 938 return NoChange(); | 940 return NoChange(); |
| 939 } | 941 } |
| 940 | 942 |
| 941 | 943 |
| 942 Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) { | 944 Reduction JSTypedLowering::ReduceJSLoadContext(Node* node) { |
| 943 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode()); | 945 DCHECK_EQ(IrOpcode::kJSLoadContext, node->opcode()); |
| 944 ContextAccess const& access = ContextAccessOf(node->op()); | 946 ContextAccess const& access = ContextAccessOf(node->op()); |
| 945 Node* const effect = NodeProperties::GetEffectInput(node); | 947 Node* const effect = NodeProperties::GetEffectInput(node); |
| 946 Node* const control = graph()->start(); | 948 Node* const control = graph()->start(); |
| 947 for (size_t i = 0; i < access.depth(); ++i) { | 949 for (size_t i = 0; i < access.depth(); ++i) { |
| 948 node->ReplaceInput( | 950 node->ReplaceInput( |
| 949 0, graph()->NewNode( | 951 0, graph()->NewNode( |
| 950 simplified()->LoadField( | 952 simplified()->LoadField( |
| 951 AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)), | 953 AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)), |
| 952 NodeProperties::GetValueInput(node, 0), effect, control)); | 954 NodeProperties::GetValueInput(node, 0), effect, control)); |
| 953 } | 955 } |
| 954 node->set_op( | 956 NodeProperties::ChangeOp( |
| 957 node, | |
| 955 simplified()->LoadField(AccessBuilder::ForContextSlot(access.index()))); | 958 simplified()->LoadField(AccessBuilder::ForContextSlot(access.index()))); |
| 956 node->ReplaceInput(1, effect); | 959 node->ReplaceInput(1, effect); |
| 957 node->ReplaceInput(2, control); | 960 node->ReplaceInput(2, control); |
| 958 DCHECK_EQ(3, node->InputCount()); | 961 DCHECK_EQ(3, node->InputCount()); |
| 959 return Changed(node); | 962 return Changed(node); |
| 960 } | 963 } |
| 961 | 964 |
| 962 | 965 |
| 963 Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) { | 966 Reduction JSTypedLowering::ReduceJSStoreContext(Node* node) { |
| 964 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode()); | 967 DCHECK_EQ(IrOpcode::kJSStoreContext, node->opcode()); |
| 965 ContextAccess const& access = ContextAccessOf(node->op()); | 968 ContextAccess const& access = ContextAccessOf(node->op()); |
| 966 Node* const effect = NodeProperties::GetEffectInput(node); | 969 Node* const effect = NodeProperties::GetEffectInput(node); |
| 967 Node* const control = graph()->start(); | 970 Node* const control = graph()->start(); |
| 968 for (size_t i = 0; i < access.depth(); ++i) { | 971 for (size_t i = 0; i < access.depth(); ++i) { |
| 969 node->ReplaceInput( | 972 node->ReplaceInput( |
| 970 0, graph()->NewNode( | 973 0, graph()->NewNode( |
| 971 simplified()->LoadField( | 974 simplified()->LoadField( |
| 972 AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)), | 975 AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX)), |
| 973 NodeProperties::GetValueInput(node, 0), effect, control)); | 976 NodeProperties::GetValueInput(node, 0), effect, control)); |
| 974 } | 977 } |
| 975 node->set_op( | 978 node->RemoveInput(2); |
| 979 NodeProperties::ChangeOp( | |
| 980 node, | |
| 976 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); | 981 simplified()->StoreField(AccessBuilder::ForContextSlot(access.index()))); |
| 977 node->RemoveInput(2); | |
| 978 DCHECK_EQ(4, node->InputCount()); | 982 DCHECK_EQ(4, node->InputCount()); |
| 979 return Changed(node); | 983 return Changed(node); |
| 980 } | 984 } |
| 981 | 985 |
| 982 | 986 |
| 983 Reduction JSTypedLowering::ReduceJSLoadDynamicGlobal(Node* node) { | 987 Reduction JSTypedLowering::ReduceJSLoadDynamicGlobal(Node* node) { |
| 984 DCHECK_EQ(IrOpcode::kJSLoadDynamicGlobal, node->opcode()); | 988 DCHECK_EQ(IrOpcode::kJSLoadDynamicGlobal, node->opcode()); |
| 985 DynamicGlobalAccess const& access = DynamicGlobalAccessOf(node->op()); | 989 DynamicGlobalAccess const& access = DynamicGlobalAccessOf(node->op()); |
| 986 Node* const vector = NodeProperties::GetValueInput(node, 0); | 990 Node* const vector = NodeProperties::GetValueInput(node, 0); |
| 987 Node* const context = NodeProperties::GetContextInput(node); | 991 Node* const context = NodeProperties::GetContextInput(node); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1000 if ((bitset & 1) == 0) continue; | 1004 if ((bitset & 1) == 0) continue; |
| 1001 Node* load = graph()->NewNode( | 1005 Node* load = graph()->NewNode( |
| 1002 javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false), | 1006 javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false), |
| 1003 context, context, effect); | 1007 context, context, effect); |
| 1004 Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), | 1008 Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), |
| 1005 load, jsgraph()->ZeroConstant()); | 1009 load, jsgraph()->ZeroConstant()); |
| 1006 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check, | 1010 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check, |
| 1007 check_true); | 1011 check_true); |
| 1008 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 1012 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
| 1009 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 1013 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
| 1010 check_false->set_op(common()->Merge(check_false->InputCount() + 1)); | |
| 1011 check_false->AppendInput(graph()->zone(), if_false); | 1014 check_false->AppendInput(graph()->zone(), if_false); |
| 1015 NodeProperties::ChangeOp(check_false, | |
| 1016 common()->Merge(check_false->InputCount())); | |
| 1012 check_true = if_true; | 1017 check_true = if_true; |
| 1013 } | 1018 } |
| 1014 | 1019 |
| 1015 // Fast case, because variable is not shadowed. Perform global object load. | 1020 // Fast case, because variable is not shadowed. Perform global object load. |
| 1016 Node* global = graph()->NewNode( | 1021 Node* global = graph()->NewNode( |
| 1017 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), context, | 1022 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), context, |
| 1018 context, effect); | 1023 context, effect); |
| 1019 Node* fast = graph()->NewNode( | 1024 Node* fast = graph()->NewNode( |
| 1020 javascript()->LoadGlobal(access.name(), access.feedback(), | 1025 javascript()->LoadGlobal(access.name(), access.feedback(), |
| 1021 access.typeof_mode()), | 1026 access.typeof_mode()), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1059 if ((bitset & 1) == 0) continue; | 1064 if ((bitset & 1) == 0) continue; |
| 1060 Node* load = graph()->NewNode( | 1065 Node* load = graph()->NewNode( |
| 1061 javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false), | 1066 javascript()->LoadContext(depth, Context::EXTENSION_INDEX, false), |
| 1062 context, context, effect); | 1067 context, context, effect); |
| 1063 Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), | 1068 Node* check = graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), |
| 1064 load, jsgraph()->ZeroConstant()); | 1069 load, jsgraph()->ZeroConstant()); |
| 1065 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check, | 1070 Node* branch = graph()->NewNode(common()->Branch(BranchHint::kTrue), check, |
| 1066 check_true); | 1071 check_true); |
| 1067 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); | 1072 Node* if_true = graph()->NewNode(common()->IfTrue(), branch); |
| 1068 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); | 1073 Node* if_false = graph()->NewNode(common()->IfFalse(), branch); |
| 1069 check_false->set_op(common()->Merge(check_false->InputCount() + 1)); | |
| 1070 check_false->AppendInput(graph()->zone(), if_false); | 1074 check_false->AppendInput(graph()->zone(), if_false); |
| 1075 NodeProperties::ChangeOp(check_false, | |
| 1076 common()->Merge(check_false->InputCount())); | |
| 1071 check_true = if_true; | 1077 check_true = if_true; |
| 1072 } | 1078 } |
| 1073 | 1079 |
| 1074 // Fast case, because variable is not shadowed. Perform context slot load. | 1080 // Fast case, because variable is not shadowed. Perform context slot load. |
| 1075 Node* fast = | 1081 Node* fast = |
| 1076 graph()->NewNode(javascript()->LoadContext(context_access.depth(), | 1082 graph()->NewNode(javascript()->LoadContext(context_access.depth(), |
| 1077 context_access.index(), false), | 1083 context_access.index(), false), |
| 1078 context, context, effect); | 1084 context, context, effect); |
| 1079 | 1085 |
| 1080 // Slow case, because variable potentially shadowed. Perform dynamic lookup. | 1086 // Slow case, because variable potentially shadowed. Perform dynamic lookup. |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 1108 Isolate* isolate = jsgraph()->isolate(); | 1114 Isolate* isolate = jsgraph()->isolate(); |
| 1109 Callable callable = CodeFactory::FastNewClosure( | 1115 Callable callable = CodeFactory::FastNewClosure( |
| 1110 isolate, shared->language_mode(), shared->kind()); | 1116 isolate, shared->language_mode(), shared->kind()); |
| 1111 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 1117 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 1112 isolate, graph()->zone(), callable.descriptor(), 0, | 1118 isolate, graph()->zone(), callable.descriptor(), 0, |
| 1113 CallDescriptor::kNoFlags); | 1119 CallDescriptor::kNoFlags); |
| 1114 const Operator* new_op = common()->Call(desc); | 1120 const Operator* new_op = common()->Call(desc); |
| 1115 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 1121 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 1116 node->InsertInput(graph()->zone(), 0, stub_code); | 1122 node->InsertInput(graph()->zone(), 0, stub_code); |
| 1117 node->InsertInput(graph()->zone(), 1, jsgraph()->HeapConstant(shared)); | 1123 node->InsertInput(graph()->zone(), 1, jsgraph()->HeapConstant(shared)); |
| 1118 node->set_op(new_op); | 1124 NodeProperties::ChangeOp(node, new_op); |
| 1119 return Changed(node); | 1125 return Changed(node); |
| 1120 } | 1126 } |
| 1121 | 1127 |
| 1122 return NoChange(); | 1128 return NoChange(); |
| 1123 } | 1129 } |
| 1124 | 1130 |
| 1125 | 1131 |
| 1126 Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) { | 1132 Reduction JSTypedLowering::ReduceJSCreateLiteralArray(Node* node) { |
| 1127 DCHECK_EQ(IrOpcode::kJSCreateLiteralArray, node->opcode()); | 1133 DCHECK_EQ(IrOpcode::kJSCreateLiteralArray, node->opcode()); |
| 1128 HeapObjectMatcher mconst(NodeProperties::GetValueInput(node, 2)); | 1134 HeapObjectMatcher mconst(NodeProperties::GetValueInput(node, 2)); |
| 1129 int length = Handle<FixedArray>::cast(mconst.Value())->length(); | 1135 int length = Handle<FixedArray>::cast(mconst.Value())->length(); |
| 1130 int flags = OpParameter<int>(node->op()); | 1136 int flags = OpParameter<int>(node->op()); |
| 1131 | 1137 |
| 1132 // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the | 1138 // Use the FastCloneShallowArrayStub only for shallow boilerplates up to the |
| 1133 // initial length limit for arrays with "fast" elements kind. | 1139 // initial length limit for arrays with "fast" elements kind. |
| 1134 // TODO(rossberg): Teach strong mode to FastCloneShallowArrayStub. | 1140 // TODO(rossberg): Teach strong mode to FastCloneShallowArrayStub. |
| 1135 if ((flags & ArrayLiteral::kShallowElements) != 0 && | 1141 if ((flags & ArrayLiteral::kShallowElements) != 0 && |
| 1136 (flags & ArrayLiteral::kIsStrong) == 0 && | 1142 (flags & ArrayLiteral::kIsStrong) == 0 && |
| 1137 length < JSObject::kInitialMaxFastElementArray) { | 1143 length < JSObject::kInitialMaxFastElementArray) { |
| 1138 Isolate* isolate = jsgraph()->isolate(); | 1144 Isolate* isolate = jsgraph()->isolate(); |
| 1139 Callable callable = CodeFactory::FastCloneShallowArray(isolate); | 1145 Callable callable = CodeFactory::FastCloneShallowArray(isolate); |
| 1140 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 1146 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 1141 isolate, graph()->zone(), callable.descriptor(), 0, | 1147 isolate, graph()->zone(), callable.descriptor(), 0, |
| 1142 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0) | 1148 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0) |
| 1143 ? CallDescriptor::kNeedsFrameState | 1149 ? CallDescriptor::kNeedsFrameState |
| 1144 : CallDescriptor::kNoFlags); | 1150 : CallDescriptor::kNoFlags); |
| 1145 const Operator* new_op = common()->Call(desc); | 1151 const Operator* new_op = common()->Call(desc); |
| 1146 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 1152 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 1147 node->InsertInput(graph()->zone(), 0, stub_code); | 1153 node->InsertInput(graph()->zone(), 0, stub_code); |
| 1148 node->set_op(new_op); | 1154 NodeProperties::ChangeOp(node, new_op); |
| 1149 return Changed(node); | 1155 return Changed(node); |
| 1150 } | 1156 } |
| 1151 | 1157 |
| 1152 return NoChange(); | 1158 return NoChange(); |
| 1153 } | 1159 } |
| 1154 | 1160 |
| 1155 | 1161 |
| 1156 Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) { | 1162 Reduction JSTypedLowering::ReduceJSCreateLiteralObject(Node* node) { |
| 1157 DCHECK_EQ(IrOpcode::kJSCreateLiteralObject, node->opcode()); | 1163 DCHECK_EQ(IrOpcode::kJSCreateLiteralObject, node->opcode()); |
| 1158 HeapObjectMatcher mconst(NodeProperties::GetValueInput(node, 2)); | 1164 HeapObjectMatcher mconst(NodeProperties::GetValueInput(node, 2)); |
| 1159 // Constants are pairs, see ObjectLiteral::properties_count(). | 1165 // Constants are pairs, see ObjectLiteral::properties_count(). |
| 1160 int length = Handle<FixedArray>::cast(mconst.Value())->length() / 2; | 1166 int length = Handle<FixedArray>::cast(mconst.Value())->length() / 2; |
| 1161 int flags = OpParameter<int>(node->op()); | 1167 int flags = OpParameter<int>(node->op()); |
| 1162 | 1168 |
| 1163 // Use the FastCloneShallowObjectStub only for shallow boilerplates without | 1169 // Use the FastCloneShallowObjectStub only for shallow boilerplates without |
| 1164 // elements up to the number of properties that the stubs can handle. | 1170 // elements up to the number of properties that the stubs can handle. |
| 1165 if ((flags & ObjectLiteral::kShallowProperties) != 0 && | 1171 if ((flags & ObjectLiteral::kShallowProperties) != 0 && |
| 1166 length <= FastCloneShallowObjectStub::kMaximumClonedProperties) { | 1172 length <= FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1167 Isolate* isolate = jsgraph()->isolate(); | 1173 Isolate* isolate = jsgraph()->isolate(); |
| 1168 Callable callable = CodeFactory::FastCloneShallowObject(isolate, length); | 1174 Callable callable = CodeFactory::FastCloneShallowObject(isolate, length); |
| 1169 CallDescriptor* desc = Linkage::GetStubCallDescriptor( | 1175 CallDescriptor* desc = Linkage::GetStubCallDescriptor( |
| 1170 isolate, graph()->zone(), callable.descriptor(), 0, | 1176 isolate, graph()->zone(), callable.descriptor(), 0, |
| 1171 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0) | 1177 (OperatorProperties::GetFrameStateInputCount(node->op()) != 0) |
| 1172 ? CallDescriptor::kNeedsFrameState | 1178 ? CallDescriptor::kNeedsFrameState |
| 1173 : CallDescriptor::kNoFlags); | 1179 : CallDescriptor::kNoFlags); |
| 1174 const Operator* new_op = common()->Call(desc); | 1180 const Operator* new_op = common()->Call(desc); |
| 1175 Node* stub_code = jsgraph()->HeapConstant(callable.code()); | 1181 Node* stub_code = jsgraph()->HeapConstant(callable.code()); |
| 1176 node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(flags)); | 1182 node->InsertInput(graph()->zone(), 3, jsgraph()->Constant(flags)); |
| 1177 node->InsertInput(graph()->zone(), 0, stub_code); | 1183 node->InsertInput(graph()->zone(), 0, stub_code); |
| 1178 node->set_op(new_op); | 1184 NodeProperties::ChangeOp(node, new_op); |
| 1179 return Changed(node); | 1185 return Changed(node); |
| 1180 } | 1186 } |
| 1181 | 1187 |
| 1182 return NoChange(); | 1188 return NoChange(); |
| 1183 } | 1189 } |
| 1184 | 1190 |
| 1185 | 1191 |
| 1186 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) { | 1192 Reduction JSTypedLowering::ReduceJSCreateWithContext(Node* node) { |
| 1187 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode()); | 1193 DCHECK_EQ(IrOpcode::kJSCreateWithContext, node->opcode()); |
| 1188 Node* const input = NodeProperties::GetValueInput(node, 0); | 1194 Node* const input = NodeProperties::GetValueInput(node, 0); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1202 a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map()); | 1208 a.AllocateArray(Context::MIN_CONTEXT_SLOTS, factory()->with_context_map()); |
| 1203 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); | 1209 a.Store(AccessBuilder::ForContextSlot(Context::CLOSURE_INDEX), closure); |
| 1204 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); | 1210 a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context); |
| 1205 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), input); | 1211 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), input); |
| 1206 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load); | 1212 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load); |
| 1207 // TODO(mstarzinger): We could mutate {node} into the allocation instead. | 1213 // TODO(mstarzinger): We could mutate {node} into the allocation instead. |
| 1208 NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node)); | 1214 NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node)); |
| 1209 ReplaceWithValue(node, node, a.effect()); | 1215 ReplaceWithValue(node, node, a.effect()); |
| 1210 node->ReplaceInput(0, a.allocation()); | 1216 node->ReplaceInput(0, a.allocation()); |
| 1211 node->ReplaceInput(1, a.effect()); | 1217 node->ReplaceInput(1, a.effect()); |
| 1212 node->set_op(common()->Finish(1)); | |
| 1213 node->TrimInputCount(2); | 1218 node->TrimInputCount(2); |
| 1219 NodeProperties::ChangeOp(node, common()->Finish(1)); | |
| 1214 return Changed(node); | 1220 return Changed(node); |
| 1215 } | 1221 } |
| 1216 return NoChange(); | 1222 return NoChange(); |
| 1217 } | 1223 } |
| 1218 | 1224 |
| 1219 | 1225 |
| 1220 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { | 1226 Reduction JSTypedLowering::ReduceJSCreateBlockContext(Node* node) { |
| 1221 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); | 1227 DCHECK_EQ(IrOpcode::kJSCreateBlockContext, node->opcode()); |
| 1222 Node* const input = NodeProperties::GetValueInput(node, 0); | 1228 Node* const input = NodeProperties::GetValueInput(node, 0); |
| 1223 HeapObjectMatcher minput(input); | 1229 HeapObjectMatcher minput(input); |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1241 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), input); | 1247 a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), input); |
| 1242 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load); | 1248 a.Store(AccessBuilder::ForContextSlot(Context::GLOBAL_OBJECT_INDEX), load); |
| 1243 for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) { | 1249 for (int i = Context::MIN_CONTEXT_SLOTS; i < context_length; ++i) { |
| 1244 a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant()); | 1250 a.Store(AccessBuilder::ForContextSlot(i), jsgraph()->TheHoleConstant()); |
| 1245 } | 1251 } |
| 1246 // TODO(mstarzinger): We could mutate {node} into the allocation instead. | 1252 // TODO(mstarzinger): We could mutate {node} into the allocation instead. |
| 1247 NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node)); | 1253 NodeProperties::SetType(a.allocation(), NodeProperties::GetType(node)); |
| 1248 ReplaceWithValue(node, node, a.effect()); | 1254 ReplaceWithValue(node, node, a.effect()); |
| 1249 node->ReplaceInput(0, a.allocation()); | 1255 node->ReplaceInput(0, a.allocation()); |
| 1250 node->ReplaceInput(1, a.effect()); | 1256 node->ReplaceInput(1, a.effect()); |
| 1251 node->set_op(common()->Finish(1)); | |
| 1252 node->TrimInputCount(2); | 1257 node->TrimInputCount(2); |
| 1258 NodeProperties::ChangeOp(node, common()->Finish(1)); | |
| 1253 return Changed(node); | 1259 return Changed(node); |
| 1254 } | 1260 } |
| 1255 return NoChange(); | 1261 return NoChange(); |
| 1256 } | 1262 } |
| 1257 | 1263 |
| 1258 | 1264 |
| 1259 Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) { | 1265 Reduction JSTypedLowering::ReduceJSCallFunction(Node* node) { |
| 1260 DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); | 1266 DCHECK_EQ(IrOpcode::kJSCallFunction, node->opcode()); |
| 1261 CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); | 1267 CallFunctionParameters const& p = CallFunctionParametersOf(node->op()); |
| 1262 int const arity = static_cast<int>(p.arity() - 2); | 1268 int const arity = static_cast<int>(p.arity() - 2); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1273 // Check that the {receiver} doesn't need to be wrapped. | 1279 // Check that the {receiver} doesn't need to be wrapped. |
| 1274 if (receiver_type->Is(Type::ReceiverOrUndefined())) { | 1280 if (receiver_type->Is(Type::ReceiverOrUndefined())) { |
| 1275 Node* const context = graph()->NewNode( | 1281 Node* const context = graph()->NewNode( |
| 1276 simplified()->LoadField(AccessBuilder::ForJSFunctionContext()), | 1282 simplified()->LoadField(AccessBuilder::ForJSFunctionContext()), |
| 1277 function, effect, control); | 1283 function, effect, control); |
| 1278 NodeProperties::ReplaceContextInput(node, context); | 1284 NodeProperties::ReplaceContextInput(node, context); |
| 1279 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState; | 1285 CallDescriptor::Flags flags = CallDescriptor::kNeedsFrameState; |
| 1280 if (is_strict(p.language_mode())) { | 1286 if (is_strict(p.language_mode())) { |
| 1281 flags |= CallDescriptor::kSupportsTailCalls; | 1287 flags |= CallDescriptor::kSupportsTailCalls; |
| 1282 } | 1288 } |
| 1283 node->set_op(common()->Call(Linkage::GetJSCallDescriptor( | 1289 NodeProperties::ChangeOp(node, |
| 1284 graph()->zone(), false, 1 + arity, flags))); | 1290 common()->Call(Linkage::GetJSCallDescriptor( |
| 1291 graph()->zone(), false, 1 + arity, flags))); | |
| 1285 return Changed(node); | 1292 return Changed(node); |
| 1286 } | 1293 } |
| 1287 } | 1294 } |
| 1288 return NoChange(); | 1295 return NoChange(); |
| 1289 } | 1296 } |
| 1290 | 1297 |
| 1291 | 1298 |
| 1292 Reduction JSTypedLowering::ReduceJSForInDone(Node* node) { | 1299 Reduction JSTypedLowering::ReduceJSForInDone(Node* node) { |
| 1293 DCHECK_EQ(IrOpcode::kJSForInDone, node->opcode()); | 1300 DCHECK_EQ(IrOpcode::kJSForInDone, node->opcode()); |
| 1294 node->set_op(machine()->Word32Equal()); | |
| 1295 node->TrimInputCount(2); | 1301 node->TrimInputCount(2); |
| 1302 NodeProperties::ChangeOp(node, machine()->Word32Equal()); | |
| 1296 return Changed(node); | 1303 return Changed(node); |
| 1297 } | 1304 } |
| 1298 | 1305 |
| 1299 | 1306 |
| 1300 Reduction JSTypedLowering::ReduceJSForInPrepare(Node* node) { | 1307 Reduction JSTypedLowering::ReduceJSForInPrepare(Node* node) { |
| 1301 DCHECK_EQ(IrOpcode::kJSForInPrepare, node->opcode()); | 1308 DCHECK_EQ(IrOpcode::kJSForInPrepare, node->opcode()); |
| 1302 Node* receiver = NodeProperties::GetValueInput(node, 0); | 1309 Node* receiver = NodeProperties::GetValueInput(node, 0); |
| 1303 Node* context = NodeProperties::GetContextInput(node); | 1310 Node* context = NodeProperties::GetContextInput(node); |
| 1304 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); | 1311 Node* frame_state = NodeProperties::GetFrameStateInput(node, 0); |
| 1305 Node* effect = NodeProperties::GetEffectInput(node); | 1312 Node* effect = NodeProperties::GetEffectInput(node); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1533 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); | 1540 if_false0 = graph()->NewNode(common()->Merge(2), if_true1, if_false1); |
| 1534 efalse0 = | 1541 efalse0 = |
| 1535 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0); | 1542 graph()->NewNode(common()->EffectPhi(2), etrue1, efalse1, if_false0); |
| 1536 vfalse0 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vtrue1, | 1543 vfalse0 = graph()->NewNode(common()->Phi(kMachAnyTagged, 2), vtrue1, |
| 1537 vfalse1, if_false0); | 1544 vfalse1, if_false0); |
| 1538 } | 1545 } |
| 1539 | 1546 |
| 1540 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); | 1547 control = graph()->NewNode(common()->Merge(2), if_true0, if_false0); |
| 1541 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); | 1548 effect = graph()->NewNode(common()->EffectPhi(2), etrue0, efalse0, control); |
| 1542 ReplaceWithValue(node, node, effect, control); | 1549 ReplaceWithValue(node, node, effect, control); |
| 1543 node->set_op(common()->Phi(kMachAnyTagged, 2)); | |
| 1544 node->ReplaceInput(0, vtrue0); | 1550 node->ReplaceInput(0, vtrue0); |
| 1545 node->ReplaceInput(1, vfalse0); | 1551 node->ReplaceInput(1, vfalse0); |
| 1546 node->ReplaceInput(2, control); | 1552 node->ReplaceInput(2, control); |
| 1547 node->TrimInputCount(3); | 1553 node->TrimInputCount(3); |
| 1554 NodeProperties::ChangeOp(node, common()->Phi(kMachAnyTagged, 2)); | |
| 1548 return Changed(node); | 1555 return Changed(node); |
| 1549 } | 1556 } |
| 1550 | 1557 |
| 1551 | 1558 |
| 1552 Reduction JSTypedLowering::ReduceJSForInStep(Node* node) { | 1559 Reduction JSTypedLowering::ReduceJSForInStep(Node* node) { |
| 1553 DCHECK_EQ(IrOpcode::kJSForInStep, node->opcode()); | 1560 DCHECK_EQ(IrOpcode::kJSForInStep, node->opcode()); |
| 1554 node->set_op(machine()->Int32Add()); | |
| 1555 node->ReplaceInput(1, jsgraph()->Int32Constant(1)); | 1561 node->ReplaceInput(1, jsgraph()->Int32Constant(1)); |
| 1562 NodeProperties::ChangeOp(node, machine()->Int32Add()); | |
| 1556 DCHECK_EQ(2, node->InputCount()); | 1563 DCHECK_EQ(2, node->InputCount()); |
| 1557 return Changed(node); | 1564 return Changed(node); |
| 1558 } | 1565 } |
| 1559 | 1566 |
| 1560 | 1567 |
| 1561 Reduction JSTypedLowering::Reduce(Node* node) { | 1568 Reduction JSTypedLowering::Reduce(Node* node) { |
| 1562 // Check if the output type is a singleton. In that case we already know the | 1569 // Check if the output type is a singleton. In that case we already know the |
| 1563 // result value and can simply replace the node if it's eliminable. | 1570 // result value and can simply replace the node if it's eliminable. |
| 1564 if (!NodeProperties::IsConstant(node) && NodeProperties::IsTyped(node) && | 1571 if (!NodeProperties::IsConstant(node) && NodeProperties::IsTyped(node) && |
| 1565 node->op()->HasProperty(Operator::kEliminatable)) { | 1572 node->op()->HasProperty(Operator::kEliminatable)) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1704 } | 1711 } |
| 1705 | 1712 |
| 1706 | 1713 |
| 1707 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1714 MachineOperatorBuilder* JSTypedLowering::machine() const { |
| 1708 return jsgraph()->machine(); | 1715 return jsgraph()->machine(); |
| 1709 } | 1716 } |
| 1710 | 1717 |
| 1711 } // namespace compiler | 1718 } // namespace compiler |
| 1712 } // namespace internal | 1719 } // namespace internal |
| 1713 } // namespace v8 | 1720 } // namespace v8 |
| OLD | NEW |