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