| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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-operator.h" | 5 #include "src/compiler/simplified-operator.h" |
| 6 | 6 |
| 7 #include "src/base/lazy-instance.h" | 7 #include "src/base/lazy-instance.h" |
| 8 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
| 9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
| 10 #include "src/types.h" | 10 #include "src/types.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 UNREACHABLE(); | 235 UNREACHABLE(); |
| 236 return os; | 236 return os; |
| 237 } | 237 } |
| 238 | 238 |
| 239 CheckTaggedHoleMode CheckTaggedHoleModeOf(const Operator* op) { | 239 CheckTaggedHoleMode CheckTaggedHoleModeOf(const Operator* op) { |
| 240 DCHECK_EQ(IrOpcode::kCheckTaggedHole, op->opcode()); | 240 DCHECK_EQ(IrOpcode::kCheckTaggedHole, op->opcode()); |
| 241 return OpParameter<CheckTaggedHoleMode>(op); | 241 return OpParameter<CheckTaggedHoleMode>(op); |
| 242 } | 242 } |
| 243 | 243 |
| 244 size_t hash_value(ElementsTransition transition) { |
| 245 return static_cast<uint8_t>(transition); |
| 246 } |
| 247 |
| 248 std::ostream& operator<<(std::ostream& os, ElementsTransition transition) { |
| 249 switch (transition) { |
| 250 case ElementsTransition::kFastTransition: |
| 251 return os << "fast-transition"; |
| 252 case ElementsTransition::kSlowTransition: |
| 253 return os << "slow-transition"; |
| 254 } |
| 255 UNREACHABLE(); |
| 256 return os; |
| 257 } |
| 258 |
| 259 ElementsTransition ElementsTransitionOf(const Operator* op) { |
| 260 DCHECK_EQ(IrOpcode::kTransitionElementsKind, op->opcode()); |
| 261 return OpParameter<ElementsTransition>(op); |
| 262 } |
| 263 |
| 244 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) { | 264 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) { |
| 245 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd || | 265 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd || |
| 246 op->opcode() == IrOpcode::kSpeculativeNumberSubtract || | 266 op->opcode() == IrOpcode::kSpeculativeNumberSubtract || |
| 247 op->opcode() == IrOpcode::kSpeculativeNumberMultiply || | 267 op->opcode() == IrOpcode::kSpeculativeNumberMultiply || |
| 248 op->opcode() == IrOpcode::kSpeculativeNumberDivide || | 268 op->opcode() == IrOpcode::kSpeculativeNumberDivide || |
| 249 op->opcode() == IrOpcode::kSpeculativeNumberModulus || | 269 op->opcode() == IrOpcode::kSpeculativeNumberModulus || |
| 250 op->opcode() == IrOpcode::kSpeculativeNumberShiftLeft); | 270 op->opcode() == IrOpcode::kSpeculativeNumberShiftLeft); |
| 251 return OpParameter<BinaryOperationHints::Hint>(op); | 271 return OpParameter<BinaryOperationHints::Hint>(op); |
| 252 } | 272 } |
| 253 | 273 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 UNREACHABLE(); | 529 UNREACHABLE(); |
| 510 return nullptr; | 530 return nullptr; |
| 511 } | 531 } |
| 512 | 532 |
| 513 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { | 533 const Operator* SimplifiedOperatorBuilder::ReferenceEqual(Type* type) { |
| 514 return new (zone()) Operator(IrOpcode::kReferenceEqual, | 534 return new (zone()) Operator(IrOpcode::kReferenceEqual, |
| 515 Operator::kCommutative | Operator::kPure, | 535 Operator::kCommutative | Operator::kPure, |
| 516 "ReferenceEqual", 2, 0, 0, 1, 0, 0); | 536 "ReferenceEqual", 2, 0, 0, 1, 0, 0); |
| 517 } | 537 } |
| 518 | 538 |
| 539 const Operator* SimplifiedOperatorBuilder::TransitionElementsKind( |
| 540 ElementsTransition transition) { |
| 541 return new (zone()) Operator1<ElementsTransition>( // -- |
| 542 IrOpcode::kTransitionElementsKind, // opcode |
| 543 Operator::kNoDeopt | Operator::kNoThrow, // flags |
| 544 "TransitionElementsKind", // name |
| 545 3, 1, 1, 0, 1, 0, // counts |
| 546 transition); // parameter |
| 547 } |
| 548 |
| 519 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { | 549 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { |
| 520 switch (pretenure) { | 550 switch (pretenure) { |
| 521 case NOT_TENURED: | 551 case NOT_TENURED: |
| 522 return &cache_.kAllocateNotTenuredOperator; | 552 return &cache_.kAllocateNotTenuredOperator; |
| 523 case TENURED: | 553 case TENURED: |
| 524 return &cache_.kAllocateTenuredOperator; | 554 return &cache_.kAllocateTenuredOperator; |
| 525 } | 555 } |
| 526 UNREACHABLE(); | 556 UNREACHABLE(); |
| 527 return nullptr; | 557 return nullptr; |
| 528 } | 558 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 631 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
| 602 #Name, value_input_count, 1, control_input_count, \ | 632 #Name, value_input_count, 1, control_input_count, \ |
| 603 output_count, 1, 0, access); \ | 633 output_count, 1, 0, access); \ |
| 604 } | 634 } |
| 605 ACCESS_OP_LIST(ACCESS) | 635 ACCESS_OP_LIST(ACCESS) |
| 606 #undef ACCESS | 636 #undef ACCESS |
| 607 | 637 |
| 608 } // namespace compiler | 638 } // namespace compiler |
| 609 } // namespace internal | 639 } // namespace internal |
| 610 } // namespace v8 | 640 } // namespace v8 |
| OLD | NEW |