| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } | 205 } |
| 206 UNREACHABLE(); | 206 UNREACHABLE(); |
| 207 return os; | 207 return os; |
| 208 } | 208 } |
| 209 | 209 |
| 210 CheckTaggedHoleMode CheckTaggedHoleModeOf(const Operator* op) { | 210 CheckTaggedHoleMode CheckTaggedHoleModeOf(const Operator* op) { |
| 211 DCHECK_EQ(IrOpcode::kCheckTaggedHole, op->opcode()); | 211 DCHECK_EQ(IrOpcode::kCheckTaggedHole, op->opcode()); |
| 212 return OpParameter<CheckTaggedHoleMode>(op); | 212 return OpParameter<CheckTaggedHoleMode>(op); |
| 213 } | 213 } |
| 214 | 214 |
| 215 Type* TypeOf(const Operator* op) { | |
| 216 DCHECK_EQ(IrOpcode::kTypeGuard, op->opcode()); | |
| 217 return OpParameter<Type*>(op); | |
| 218 } | |
| 219 | |
| 220 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) { | 215 BinaryOperationHints::Hint BinaryOperationHintOf(const Operator* op) { |
| 221 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd || | 216 DCHECK(op->opcode() == IrOpcode::kSpeculativeNumberAdd || |
| 222 op->opcode() == IrOpcode::kSpeculativeNumberSubtract || | 217 op->opcode() == IrOpcode::kSpeculativeNumberSubtract || |
| 223 op->opcode() == IrOpcode::kSpeculativeNumberMultiply || | 218 op->opcode() == IrOpcode::kSpeculativeNumberMultiply || |
| 224 op->opcode() == IrOpcode::kSpeculativeNumberDivide || | 219 op->opcode() == IrOpcode::kSpeculativeNumberDivide || |
| 225 op->opcode() == IrOpcode::kSpeculativeNumberModulus); | 220 op->opcode() == IrOpcode::kSpeculativeNumberModulus); |
| 226 return OpParameter<BinaryOperationHints::Hint>(op); | 221 return OpParameter<BinaryOperationHints::Hint>(op); |
| 227 } | 222 } |
| 228 | 223 |
| 229 CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) { | 224 CompareOperationHints::Hint CompareOperationHintOf(const Operator* op) { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 "ReferenceEqual", 2, 0, 0, 1, 0, 0); | 447 "ReferenceEqual", 2, 0, 0, 1, 0, 0); |
| 453 } | 448 } |
| 454 | 449 |
| 455 const Operator* SimplifiedOperatorBuilder::CheckBounds() { | 450 const Operator* SimplifiedOperatorBuilder::CheckBounds() { |
| 456 // TODO(bmeurer): Cache this operator. Make it pure! | 451 // TODO(bmeurer): Cache this operator. Make it pure! |
| 457 return new (zone()) | 452 return new (zone()) |
| 458 Operator(IrOpcode::kCheckBounds, Operator::kFoldable | Operator::kNoThrow, | 453 Operator(IrOpcode::kCheckBounds, Operator::kFoldable | Operator::kNoThrow, |
| 459 "CheckBounds", 2, 1, 1, 1, 1, 0); | 454 "CheckBounds", 2, 1, 1, 1, 1, 0); |
| 460 } | 455 } |
| 461 | 456 |
| 462 const Operator* SimplifiedOperatorBuilder::TypeGuard(Type* type) { | |
| 463 class TypeGuardOperator final : public Operator1<Type*> { | |
| 464 public: | |
| 465 explicit TypeGuardOperator(Type* type) | |
| 466 : Operator1<Type*>( // -- | |
| 467 IrOpcode::kTypeGuard, Operator::kPure, // opcode | |
| 468 "TypeGuard", // name | |
| 469 1, 0, 1, 1, 0, 0, // counts | |
| 470 type) {} // parameter | |
| 471 | |
| 472 void PrintParameter(std::ostream& os) const final { | |
| 473 parameter()->PrintTo(os); | |
| 474 } | |
| 475 }; | |
| 476 return new (zone()) TypeGuardOperator(type); | |
| 477 } | |
| 478 | |
| 479 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { | 457 const Operator* SimplifiedOperatorBuilder::Allocate(PretenureFlag pretenure) { |
| 480 switch (pretenure) { | 458 switch (pretenure) { |
| 481 case NOT_TENURED: | 459 case NOT_TENURED: |
| 482 return &cache_.kAllocateNotTenuredOperator; | 460 return &cache_.kAllocateNotTenuredOperator; |
| 483 case TENURED: | 461 case TENURED: |
| 484 return &cache_.kAllocateTenuredOperator; | 462 return &cache_.kAllocateTenuredOperator; |
| 485 } | 463 } |
| 486 UNREACHABLE(); | 464 UNREACHABLE(); |
| 487 return nullptr; | 465 return nullptr; |
| 488 } | 466 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 Operator::kNoDeopt | Operator::kNoThrow | properties, \ | 539 Operator::kNoDeopt | Operator::kNoThrow | properties, \ |
| 562 #Name, value_input_count, 1, control_input_count, \ | 540 #Name, value_input_count, 1, control_input_count, \ |
| 563 output_count, 1, 0, access); \ | 541 output_count, 1, 0, access); \ |
| 564 } | 542 } |
| 565 ACCESS_OP_LIST(ACCESS) | 543 ACCESS_OP_LIST(ACCESS) |
| 566 #undef ACCESS | 544 #undef ACCESS |
| 567 | 545 |
| 568 } // namespace compiler | 546 } // namespace compiler |
| 569 } // namespace internal | 547 } // namespace internal |
| 570 } // namespace v8 | 548 } // namespace v8 |
| OLD | NEW |