| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 if (pushed_unvisited) continue; | 304 if (pushed_unvisited) continue; |
| 305 | 305 |
| 306 // Process the top of the stack. | 306 // Process the top of the stack. |
| 307 Node* node = current.node; | 307 Node* node = current.node; |
| 308 typing_stack_.pop(); | 308 typing_stack_.pop(); |
| 309 NodeInfo* info = GetInfo(node); | 309 NodeInfo* info = GetInfo(node); |
| 310 info->set_visited(); | 310 info->set_visited(); |
| 311 bool updated = UpdateFeedbackType(node); | 311 bool updated = UpdateFeedbackType(node); |
| 312 TRACE(" visit #%d: %s\n", node->id(), node->op()->mnemonic()); | 312 TRACE(" visit #%d: %s\n", node->id(), node->op()->mnemonic()); |
| 313 VisitNode(node, info->truncation(), nullptr); | 313 VisitNode(node, info->truncation(), nullptr); |
| 314 TRACE(" ==> output "); |
| 315 PrintOutputInfo(info); |
| 316 TRACE("\n"); |
| 314 if (updated) { | 317 if (updated) { |
| 315 for (Node* const user : node->uses()) { | 318 for (Node* const user : node->uses()) { |
| 316 if (GetInfo(user)->visited()) { | 319 if (GetInfo(user)->visited()) { |
| 317 GetInfo(user)->set_queued(); | 320 GetInfo(user)->set_queued(); |
| 318 queue_.push(user); | 321 queue_.push(user); |
| 319 } | 322 } |
| 320 } | 323 } |
| 321 } | 324 } |
| 322 } | 325 } |
| 323 | 326 |
| 324 // Process the revisit queue. | 327 // Process the revisit queue. |
| 325 while (!queue_.empty()) { | 328 while (!queue_.empty()) { |
| 326 Node* node = queue_.front(); | 329 Node* node = queue_.front(); |
| 327 queue_.pop(); | 330 queue_.pop(); |
| 328 NodeInfo* info = GetInfo(node); | 331 NodeInfo* info = GetInfo(node); |
| 329 info->set_visited(); | 332 info->set_visited(); |
| 330 bool updated = UpdateFeedbackType(node); | 333 bool updated = UpdateFeedbackType(node); |
| 331 TRACE(" visit #%d: %s\n", node->id(), node->op()->mnemonic()); | 334 TRACE(" visit #%d: %s\n", node->id(), node->op()->mnemonic()); |
| 332 VisitNode(node, info->truncation(), nullptr); | 335 VisitNode(node, info->truncation(), nullptr); |
| 336 TRACE(" ==> output "); |
| 337 PrintOutputInfo(info); |
| 338 TRACE("\n"); |
| 333 if (updated) { | 339 if (updated) { |
| 334 for (Node* const user : node->uses()) { | 340 for (Node* const user : node->uses()) { |
| 335 if (GetInfo(user)->visited()) { | 341 if (GetInfo(user)->visited()) { |
| 336 GetInfo(user)->set_queued(); | 342 GetInfo(user)->set_queued(); |
| 337 queue_.push(user); | 343 queue_.push(user); |
| 338 } | 344 } |
| 339 } | 345 } |
| 340 } | 346 } |
| 341 } | 347 } |
| 342 } | 348 } |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 EnqueueInitial(jsgraph_->graph()->end()); | 533 EnqueueInitial(jsgraph_->graph()->end()); |
| 528 // Process nodes from the queue until it is empty. | 534 // Process nodes from the queue until it is empty. |
| 529 while (!queue_.empty()) { | 535 while (!queue_.empty()) { |
| 530 Node* node = queue_.front(); | 536 Node* node = queue_.front(); |
| 531 NodeInfo* info = GetInfo(node); | 537 NodeInfo* info = GetInfo(node); |
| 532 queue_.pop(); | 538 queue_.pop(); |
| 533 info->set_visited(); | 539 info->set_visited(); |
| 534 TRACE(" visit #%d: %s (trunc: %s)\n", node->id(), node->op()->mnemonic(), | 540 TRACE(" visit #%d: %s (trunc: %s)\n", node->id(), node->op()->mnemonic(), |
| 535 info->truncation().description()); | 541 info->truncation().description()); |
| 536 VisitNode(node, info->truncation(), nullptr); | 542 VisitNode(node, info->truncation(), nullptr); |
| 537 TRACE(" ==> output "); | |
| 538 PrintOutputInfo(info); | |
| 539 TRACE("\n"); | |
| 540 } | 543 } |
| 541 } | 544 } |
| 542 | 545 |
| 543 void Run(SimplifiedLowering* lowering) { | 546 void Run(SimplifiedLowering* lowering) { |
| 544 RunTruncationPropagationPhase(); | 547 RunTruncationPropagationPhase(); |
| 545 | 548 |
| 546 RunTypePropagationPhase(); | 549 RunTypePropagationPhase(); |
| 547 | 550 |
| 548 // Run lowering and change insertion phase. | 551 // Run lowering and change insertion phase. |
| 549 TRACE("--{Simplified lowering phase}--\n"); | 552 TRACE("--{Simplified lowering phase}--\n"); |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 EnqueueInput(node, i, UseInfo::Any()); | 982 EnqueueInput(node, i, UseInfo::Any()); |
| 980 } | 983 } |
| 981 } else if (lower()) { | 984 } else if (lower()) { |
| 982 Zone* zone = jsgraph_->zone(); | 985 Zone* zone = jsgraph_->zone(); |
| 983 ZoneVector<MachineType>* types = | 986 ZoneVector<MachineType>* types = |
| 984 new (zone->New(sizeof(ZoneVector<MachineType>))) | 987 new (zone->New(sizeof(ZoneVector<MachineType>))) |
| 985 ZoneVector<MachineType>(node->InputCount(), zone); | 988 ZoneVector<MachineType>(node->InputCount(), zone); |
| 986 for (int i = 0; i < node->InputCount(); i++) { | 989 for (int i = 0; i < node->InputCount(); i++) { |
| 987 Node* input = node->InputAt(i); | 990 Node* input = node->InputAt(i); |
| 988 NodeInfo* input_info = GetInfo(input); | 991 NodeInfo* input_info = GetInfo(input); |
| 989 MachineType machine_type(input_info->representation(), | 992 Type* input_type = TypeOf(input); |
| 990 DeoptValueSemanticOf(TypeOf(input))); | 993 MachineRepresentation rep = input_type->IsInhabited() |
| 994 ? input_info->representation() |
| 995 : MachineRepresentation::kNone; |
| 996 MachineType machine_type(rep, DeoptValueSemanticOf(input_type)); |
| 991 DCHECK(machine_type.representation() != | 997 DCHECK(machine_type.representation() != |
| 992 MachineRepresentation::kWord32 || | 998 MachineRepresentation::kWord32 || |
| 993 machine_type.semantic() == MachineSemantic::kInt32 || | 999 machine_type.semantic() == MachineSemantic::kInt32 || |
| 994 machine_type.semantic() == MachineSemantic::kUint32); | 1000 machine_type.semantic() == MachineSemantic::kUint32); |
| 995 (*types)[i] = machine_type; | 1001 (*types)[i] = machine_type; |
| 996 } | 1002 } |
| 997 NodeProperties::ChangeOp(node, | 1003 NodeProperties::ChangeOp(node, |
| 998 jsgraph_->common()->TypedStateValues(types)); | 1004 jsgraph_->common()->TypedStateValues(types)); |
| 999 } | 1005 } |
| 1000 SetOutput(node, MachineRepresentation::kTagged); | 1006 SetOutput(node, MachineRepresentation::kTagged); |
| (...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3323 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3329 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3324 Operator::kNoProperties); | 3330 Operator::kNoProperties); |
| 3325 to_number_operator_.set(common()->Call(desc)); | 3331 to_number_operator_.set(common()->Call(desc)); |
| 3326 } | 3332 } |
| 3327 return to_number_operator_.get(); | 3333 return to_number_operator_.get(); |
| 3328 } | 3334 } |
| 3329 | 3335 |
| 3330 } // namespace compiler | 3336 } // namespace compiler |
| 3331 } // namespace internal | 3337 } // namespace internal |
| 3332 } // namespace v8 | 3338 } // namespace v8 |
| OLD | NEW |