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/compiler/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/address-map.h" | 9 #include "src/address-map.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 DeferReplacement(node, lowering->jsgraph()->Int32Constant(1)); | 985 DeferReplacement(node, lowering->jsgraph()->Int32Constant(1)); |
986 } | 986 } |
987 } else { | 987 } else { |
988 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); | 988 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); |
989 if (lower() && !input_type->Maybe(type)) { | 989 if (lower() && !input_type->Maybe(type)) { |
990 DeferReplacement(node, lowering->jsgraph()->Int32Constant(0)); | 990 DeferReplacement(node, lowering->jsgraph()->Int32Constant(0)); |
991 } | 991 } |
992 } | 992 } |
993 } | 993 } |
994 | 994 |
| 995 void VisitCheck(Node* node, Type* type, SimplifiedLowering* lowering) { |
| 996 if (InputIs(node, type)) { |
| 997 VisitUnop(node, UseInfo::AnyTagged(), |
| 998 MachineRepresentation::kTaggedPointer); |
| 999 if (lower()) DeferReplacement(node, node->InputAt(0)); |
| 1000 } else { |
| 1001 VisitUnop(node, UseInfo::CheckedHeapObjectAsTaggedPointer(), |
| 1002 MachineRepresentation::kTaggedPointer); |
| 1003 } |
| 1004 return; |
| 1005 } |
| 1006 |
995 void VisitCall(Node* node, SimplifiedLowering* lowering) { | 1007 void VisitCall(Node* node, SimplifiedLowering* lowering) { |
996 const CallDescriptor* desc = CallDescriptorOf(node->op()); | 1008 const CallDescriptor* desc = CallDescriptorOf(node->op()); |
997 int params = static_cast<int>(desc->ParameterCount()); | 1009 int params = static_cast<int>(desc->ParameterCount()); |
998 int value_input_count = node->op()->ValueInputCount(); | 1010 int value_input_count = node->op()->ValueInputCount(); |
999 // Propagate representation information from call descriptor. | 1011 // Propagate representation information from call descriptor. |
1000 for (int i = 0; i < value_input_count; i++) { | 1012 for (int i = 0; i < value_input_count; i++) { |
1001 if (i == 0) { | 1013 if (i == 0) { |
1002 // The target of the call. | 1014 // The target of the call. |
1003 ProcessInput(node, i, UseInfo::Any()); | 1015 ProcessInput(node, i, UseInfo::Any()); |
1004 } else if ((i - 1) < params) { | 1016 } else if ((i - 1) < params) { |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2383 if (lower()) DeferReplacement(node, node->InputAt(0)); | 2395 if (lower()) DeferReplacement(node, node->InputAt(0)); |
2384 return; | 2396 return; |
2385 } | 2397 } |
2386 case IrOpcode::kCheckIf: { | 2398 case IrOpcode::kCheckIf: { |
2387 ProcessInput(node, 0, UseInfo::Bool()); | 2399 ProcessInput(node, 0, UseInfo::Bool()); |
2388 ProcessRemainingInputs(node, 1); | 2400 ProcessRemainingInputs(node, 1); |
2389 SetOutput(node, MachineRepresentation::kNone); | 2401 SetOutput(node, MachineRepresentation::kNone); |
2390 return; | 2402 return; |
2391 } | 2403 } |
2392 case IrOpcode::kCheckInternalizedString: { | 2404 case IrOpcode::kCheckInternalizedString: { |
2393 if (InputIs(node, Type::InternalizedString())) { | 2405 VisitCheck(node, Type::InternalizedString(), lowering); |
2394 VisitUnop(node, UseInfo::AnyTagged(), | |
2395 MachineRepresentation::kTaggedPointer); | |
2396 if (lower()) DeferReplacement(node, node->InputAt(0)); | |
2397 } else { | |
2398 VisitUnop(node, UseInfo::CheckedHeapObjectAsTaggedPointer(), | |
2399 MachineRepresentation::kTaggedPointer); | |
2400 } | |
2401 return; | 2406 return; |
2402 } | 2407 } |
2403 case IrOpcode::kCheckNumber: { | 2408 case IrOpcode::kCheckNumber: { |
2404 Type* const input_type = TypeOf(node->InputAt(0)); | 2409 Type* const input_type = TypeOf(node->InputAt(0)); |
2405 if (input_type->Is(Type::Number())) { | 2410 if (input_type->Is(Type::Number())) { |
2406 VisitNoop(node, truncation); | 2411 VisitNoop(node, truncation); |
2407 } else { | 2412 } else { |
2408 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); | 2413 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); |
2409 } | 2414 } |
2410 return; | 2415 return; |
2411 } | 2416 } |
2412 case IrOpcode::kCheckReceiver: { | 2417 case IrOpcode::kCheckReceiver: { |
2413 if (InputIs(node, Type::Receiver())) { | 2418 VisitCheck(node, Type::Receiver(), lowering); |
2414 VisitUnop(node, UseInfo::AnyTagged(), | |
2415 MachineRepresentation::kTaggedPointer); | |
2416 if (lower()) DeferReplacement(node, node->InputAt(0)); | |
2417 } else { | |
2418 VisitUnop(node, UseInfo::CheckedHeapObjectAsTaggedPointer(), | |
2419 MachineRepresentation::kTaggedPointer); | |
2420 } | |
2421 return; | 2419 return; |
2422 } | 2420 } |
2423 case IrOpcode::kCheckSmi: { | 2421 case IrOpcode::kCheckSmi: { |
2424 if (SmiValuesAre32Bits() && truncation.IsUsedAsWord32()) { | 2422 if (SmiValuesAre32Bits() && truncation.IsUsedAsWord32()) { |
2425 VisitUnop(node, | 2423 VisitUnop(node, |
2426 UseInfo::CheckedSignedSmallAsWord32(kDistinguishZeros), | 2424 UseInfo::CheckedSignedSmallAsWord32(kDistinguishZeros), |
2427 MachineRepresentation::kWord32); | 2425 MachineRepresentation::kWord32); |
2428 } else { | 2426 } else { |
2429 VisitUnop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(), | 2427 VisitUnop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(), |
2430 MachineRepresentation::kTaggedSigned); | 2428 MachineRepresentation::kTaggedSigned); |
2431 } | 2429 } |
2432 if (lower()) DeferReplacement(node, node->InputAt(0)); | 2430 if (lower()) DeferReplacement(node, node->InputAt(0)); |
2433 return; | 2431 return; |
2434 } | 2432 } |
2435 case IrOpcode::kCheckString: { | 2433 case IrOpcode::kCheckString: { |
2436 if (InputIs(node, Type::String())) { | 2434 VisitCheck(node, Type::String(), lowering); |
2437 VisitUnop(node, UseInfo::AnyTagged(), | 2435 return; |
2438 MachineRepresentation::kTaggedPointer); | 2436 } |
2439 if (lower()) DeferReplacement(node, node->InputAt(0)); | 2437 case IrOpcode::kCheckSymbol: { |
2440 } else { | 2438 VisitCheck(node, Type::Symbol(), lowering); |
2441 VisitUnop(node, UseInfo::CheckedHeapObjectAsTaggedPointer(), | |
2442 MachineRepresentation::kTaggedPointer); | |
2443 } | |
2444 return; | 2439 return; |
2445 } | 2440 } |
2446 | 2441 |
2447 case IrOpcode::kAllocate: { | 2442 case IrOpcode::kAllocate: { |
2448 ProcessInput(node, 0, UseInfo::TruncatingWord32()); | 2443 ProcessInput(node, 0, UseInfo::TruncatingWord32()); |
2449 ProcessRemainingInputs(node, 1); | 2444 ProcessRemainingInputs(node, 1); |
2450 SetOutput(node, MachineRepresentation::kTaggedPointer); | 2445 SetOutput(node, MachineRepresentation::kTaggedPointer); |
2451 return; | 2446 return; |
2452 } | 2447 } |
2453 case IrOpcode::kLoadField: { | 2448 case IrOpcode::kLoadField: { |
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3705 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3700 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3706 Operator::kNoProperties); | 3701 Operator::kNoProperties); |
3707 to_number_operator_.set(common()->Call(desc)); | 3702 to_number_operator_.set(common()->Call(desc)); |
3708 } | 3703 } |
3709 return to_number_operator_.get(); | 3704 return to_number_operator_.get(); |
3710 } | 3705 } |
3711 | 3706 |
3712 } // namespace compiler | 3707 } // namespace compiler |
3713 } // namespace internal | 3708 } // namespace internal |
3714 } // namespace v8 | 3709 } // namespace v8 |
OLD | NEW |