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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 machine_type.semantic() == MachineSemantic::kInt32 || | 1005 machine_type.semantic() == MachineSemantic::kInt32 || |
1006 machine_type.semantic() == MachineSemantic::kUint32); | 1006 machine_type.semantic() == MachineSemantic::kUint32); |
1007 (*types)[i] = machine_type; | 1007 (*types)[i] = machine_type; |
1008 } | 1008 } |
1009 NodeProperties::ChangeOp(node, | 1009 NodeProperties::ChangeOp(node, |
1010 jsgraph_->common()->TypedStateValues(types)); | 1010 jsgraph_->common()->TypedStateValues(types)); |
1011 } | 1011 } |
1012 SetOutput(node, MachineRepresentation::kTagged); | 1012 SetOutput(node, MachineRepresentation::kTagged); |
1013 } | 1013 } |
1014 | 1014 |
| 1015 void VisitObjectState(Node* node) { |
| 1016 if (propagate()) { |
| 1017 for (int i = 0; i < node->InputCount(); i++) { |
| 1018 EnqueueInput(node, i, UseInfo::Any()); |
| 1019 } |
| 1020 } else if (lower()) { |
| 1021 Zone* zone = jsgraph_->zone(); |
| 1022 ZoneVector<MachineType>* types = |
| 1023 new (zone->New(sizeof(ZoneVector<MachineType>))) |
| 1024 ZoneVector<MachineType>(node->InputCount(), zone); |
| 1025 for (int i = 0; i < node->InputCount(); i++) { |
| 1026 Node* input = node->InputAt(i); |
| 1027 NodeInfo* input_info = GetInfo(input); |
| 1028 Type* input_type = TypeOf(input); |
| 1029 MachineRepresentation rep = input_type->IsInhabited() |
| 1030 ? input_info->representation() |
| 1031 : MachineRepresentation::kNone; |
| 1032 MachineType machine_type(rep, DeoptValueSemanticOf(input_type)); |
| 1033 DCHECK(machine_type.representation() != |
| 1034 MachineRepresentation::kWord32 || |
| 1035 machine_type.semantic() == MachineSemantic::kInt32 || |
| 1036 machine_type.semantic() == MachineSemantic::kUint32); |
| 1037 (*types)[i] = machine_type; |
| 1038 } |
| 1039 NodeProperties::ChangeOp(node, |
| 1040 jsgraph_->common()->TypedObjectState(types)); |
| 1041 } |
| 1042 SetOutput(node, MachineRepresentation::kTagged); |
| 1043 } |
| 1044 |
1015 const Operator* Int32Op(Node* node) { | 1045 const Operator* Int32Op(Node* node) { |
1016 return changer_->Int32OperatorFor(node->opcode()); | 1046 return changer_->Int32OperatorFor(node->opcode()); |
1017 } | 1047 } |
1018 | 1048 |
1019 const Operator* Int32OverflowOp(Node* node) { | 1049 const Operator* Int32OverflowOp(Node* node) { |
1020 return changer_->Int32OverflowOperatorFor(node->opcode()); | 1050 return changer_->Int32OverflowOperatorFor(node->opcode()); |
1021 } | 1051 } |
1022 | 1052 |
1023 const Operator* Uint32Op(Node* node) { | 1053 const Operator* Uint32Op(Node* node) { |
1024 return changer_->Uint32OperatorFor(node->opcode()); | 1054 return changer_->Uint32OperatorFor(node->opcode()); |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2449 return; | 2479 return; |
2450 } | 2480 } |
2451 | 2481 |
2452 case IrOpcode::kNumberSilenceNaN: | 2482 case IrOpcode::kNumberSilenceNaN: |
2453 VisitUnop(node, UseInfo::TruncatingFloat64(), | 2483 VisitUnop(node, UseInfo::TruncatingFloat64(), |
2454 MachineRepresentation::kFloat64); | 2484 MachineRepresentation::kFloat64); |
2455 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); | 2485 if (lower()) NodeProperties::ChangeOp(node, Float64Op(node)); |
2456 return; | 2486 return; |
2457 case IrOpcode::kStateValues: | 2487 case IrOpcode::kStateValues: |
2458 return VisitStateValues(node); | 2488 return VisitStateValues(node); |
| 2489 case IrOpcode::kObjectState: |
| 2490 return VisitObjectState(node); |
2459 case IrOpcode::kTypeGuard: { | 2491 case IrOpcode::kTypeGuard: { |
2460 // We just get rid of the sigma here. In principle, it should be | 2492 // We just get rid of the sigma here. In principle, it should be |
2461 // possible to refine the truncation and representation based on | 2493 // possible to refine the truncation and representation based on |
2462 // the sigma's type. | 2494 // the sigma's type. |
2463 MachineRepresentation output = | 2495 MachineRepresentation output = |
2464 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); | 2496 GetOutputInfoForPhi(node, TypeOf(node->InputAt(0)), truncation); |
2465 VisitUnop(node, UseInfo(output, truncation), output); | 2497 VisitUnop(node, UseInfo(output, truncation), output); |
2466 if (lower()) DeferReplacement(node, node->InputAt(0)); | 2498 if (lower()) DeferReplacement(node, node->InputAt(0)); |
2467 return; | 2499 return; |
2468 } | 2500 } |
(...skipping 21 matching lines...) Expand all Loading... |
2490 case IrOpcode::kDeoptimize: | 2522 case IrOpcode::kDeoptimize: |
2491 case IrOpcode::kEffectPhi: | 2523 case IrOpcode::kEffectPhi: |
2492 case IrOpcode::kTerminate: | 2524 case IrOpcode::kTerminate: |
2493 case IrOpcode::kFrameState: | 2525 case IrOpcode::kFrameState: |
2494 case IrOpcode::kCheckpoint: | 2526 case IrOpcode::kCheckpoint: |
2495 case IrOpcode::kLoop: | 2527 case IrOpcode::kLoop: |
2496 case IrOpcode::kMerge: | 2528 case IrOpcode::kMerge: |
2497 case IrOpcode::kThrow: | 2529 case IrOpcode::kThrow: |
2498 case IrOpcode::kBeginRegion: | 2530 case IrOpcode::kBeginRegion: |
2499 case IrOpcode::kProjection: | 2531 case IrOpcode::kProjection: |
2500 case IrOpcode::kObjectState: | |
2501 case IrOpcode::kOsrValue: | 2532 case IrOpcode::kOsrValue: |
2502 // All JavaScript operators except JSToNumber have uniform handling. | 2533 // All JavaScript operators except JSToNumber have uniform handling. |
2503 #define OPCODE_CASE(name) case IrOpcode::k##name: | 2534 #define OPCODE_CASE(name) case IrOpcode::k##name: |
2504 JS_SIMPLE_BINOP_LIST(OPCODE_CASE) | 2535 JS_SIMPLE_BINOP_LIST(OPCODE_CASE) |
2505 JS_OTHER_UNOP_LIST(OPCODE_CASE) | 2536 JS_OTHER_UNOP_LIST(OPCODE_CASE) |
2506 JS_OBJECT_OP_LIST(OPCODE_CASE) | 2537 JS_OBJECT_OP_LIST(OPCODE_CASE) |
2507 JS_CONTEXT_OP_LIST(OPCODE_CASE) | 2538 JS_CONTEXT_OP_LIST(OPCODE_CASE) |
2508 JS_OTHER_OP_LIST(OPCODE_CASE) | 2539 JS_OTHER_OP_LIST(OPCODE_CASE) |
2509 #undef OPCODE_CASE | 2540 #undef OPCODE_CASE |
2510 case IrOpcode::kJSToInteger: | 2541 case IrOpcode::kJSToInteger: |
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3279 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3310 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3280 Operator::kNoProperties); | 3311 Operator::kNoProperties); |
3281 to_number_operator_.set(common()->Call(desc)); | 3312 to_number_operator_.set(common()->Call(desc)); |
3282 } | 3313 } |
3283 return to_number_operator_.get(); | 3314 return to_number_operator_.get(); |
3284 } | 3315 } |
3285 | 3316 |
3286 } // namespace compiler | 3317 } // namespace compiler |
3287 } // namespace internal | 3318 } // namespace internal |
3288 } // namespace v8 | 3319 } // namespace v8 |
OLD | NEW |