| 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/js-operator.h" | 5 #include "src/compiler/js-operator.h" | 
| 6 | 6 | 
| 7 #include <limits> | 7 #include <limits> | 
| 8 | 8 | 
| 9 #include "src/base/lazy-instance.h" | 9 #include "src/base/lazy-instance.h" | 
| 10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 32 | 32 | 
| 33 bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { | 33 bool operator!=(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { | 
| 34   return !(lhs == rhs); | 34   return !(lhs == rhs); | 
| 35 } | 35 } | 
| 36 | 36 | 
| 37 | 37 | 
| 38 size_t hash_value(VectorSlotPair const& p) { | 38 size_t hash_value(VectorSlotPair const& p) { | 
| 39   return base::hash_combine(p.slot(), p.vector().location()); | 39   return base::hash_combine(p.slot(), p.vector().location()); | 
| 40 } | 40 } | 
| 41 | 41 | 
|  | 42 std::ostream& operator<<(std::ostream& os, VectorSlotPair const& p) { | 
|  | 43   if (p.IsValid()) { | 
|  | 44     os << p.index(); | 
|  | 45   } else { | 
|  | 46     os << "N/A"; | 
|  | 47   } | 
|  | 48   return os; | 
|  | 49 } | 
| 42 | 50 | 
| 43 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) { | 51 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) { | 
| 44   DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode()); | 52   DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode()); | 
| 45   return OpParameter<ConvertReceiverMode>(op); | 53   return OpParameter<ConvertReceiverMode>(op); | 
| 46 } | 54 } | 
| 47 | 55 | 
| 48 | 56 | 
| 49 ToBooleanHints ToBooleanHintsOf(Operator const* op) { | 57 ToBooleanHints ToBooleanHintsOf(Operator const* op) { | 
| 50   DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode()); | 58   DCHECK_EQ(IrOpcode::kJSToBoolean, op->opcode()); | 
| 51   return OpParameter<ToBooleanHints>(op); | 59   return OpParameter<ToBooleanHints>(op); | 
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 429          op->opcode() == IrOpcode::kJSNotEqual || | 437          op->opcode() == IrOpcode::kJSNotEqual || | 
| 430          op->opcode() == IrOpcode::kJSStrictEqual || | 438          op->opcode() == IrOpcode::kJSStrictEqual || | 
| 431          op->opcode() == IrOpcode::kJSStrictNotEqual || | 439          op->opcode() == IrOpcode::kJSStrictNotEqual || | 
| 432          op->opcode() == IrOpcode::kJSLessThan || | 440          op->opcode() == IrOpcode::kJSLessThan || | 
| 433          op->opcode() == IrOpcode::kJSGreaterThan || | 441          op->opcode() == IrOpcode::kJSGreaterThan || | 
| 434          op->opcode() == IrOpcode::kJSLessThanOrEqual || | 442          op->opcode() == IrOpcode::kJSLessThanOrEqual || | 
| 435          op->opcode() == IrOpcode::kJSGreaterThanOrEqual); | 443          op->opcode() == IrOpcode::kJSGreaterThanOrEqual); | 
| 436   return OpParameter<CompareOperationHint>(op); | 444   return OpParameter<CompareOperationHint>(op); | 
| 437 } | 445 } | 
| 438 | 446 | 
|  | 447 VectorSlotPair const& VectorSlotPairOf(const Operator* op) { | 
|  | 448   DCHECK_EQ(IrOpcode::kJSInstanceOf, op->opcode()); | 
|  | 449   return OpParameter<VectorSlotPair>(op); | 
|  | 450 } | 
|  | 451 | 
| 439 #define CACHED_OP_LIST(V)                                   \ | 452 #define CACHED_OP_LIST(V)                                   \ | 
| 440   V(ToInteger, Operator::kNoProperties, 1, 1)               \ | 453   V(ToInteger, Operator::kNoProperties, 1, 1)               \ | 
| 441   V(ToLength, Operator::kNoProperties, 1, 1)                \ | 454   V(ToLength, Operator::kNoProperties, 1, 1)                \ | 
| 442   V(ToName, Operator::kNoProperties, 1, 1)                  \ | 455   V(ToName, Operator::kNoProperties, 1, 1)                  \ | 
| 443   V(ToNumber, Operator::kNoProperties, 1, 1)                \ | 456   V(ToNumber, Operator::kNoProperties, 1, 1)                \ | 
| 444   V(ToObject, Operator::kFoldable, 1, 1)                    \ | 457   V(ToObject, Operator::kFoldable, 1, 1)                    \ | 
| 445   V(ToString, Operator::kNoProperties, 1, 1)                \ | 458   V(ToString, Operator::kNoProperties, 1, 1)                \ | 
| 446   V(Create, Operator::kEliminatable, 2, 1)                  \ | 459   V(Create, Operator::kEliminatable, 2, 1)                  \ | 
| 447   V(CreateIterResultObject, Operator::kEliminatable, 2, 1)  \ | 460   V(CreateIterResultObject, Operator::kEliminatable, 2, 1)  \ | 
| 448   V(HasProperty, Operator::kNoProperties, 2, 1)             \ | 461   V(HasProperty, Operator::kNoProperties, 2, 1)             \ | 
| 449   V(TypeOf, Operator::kPure, 1, 1)                          \ | 462   V(TypeOf, Operator::kPure, 1, 1)                          \ | 
| 450   V(InstanceOf, Operator::kNoProperties, 2, 1)              \ |  | 
| 451   V(ForInNext, Operator::kNoProperties, 4, 1)               \ | 463   V(ForInNext, Operator::kNoProperties, 4, 1)               \ | 
| 452   V(ForInPrepare, Operator::kNoProperties, 1, 3)            \ | 464   V(ForInPrepare, Operator::kNoProperties, 1, 3)            \ | 
| 453   V(LoadMessage, Operator::kNoThrow, 0, 1)                  \ | 465   V(LoadMessage, Operator::kNoThrow, 0, 1)                  \ | 
| 454   V(StoreMessage, Operator::kNoThrow, 1, 0)                 \ | 466   V(StoreMessage, Operator::kNoThrow, 1, 0)                 \ | 
| 455   V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \ | 467   V(GeneratorRestoreContinuation, Operator::kNoThrow, 1, 1) \ | 
| 456   V(StackCheck, Operator::kNoWrite, 0, 0) | 468   V(StackCheck, Operator::kNoWrite, 0, 0) | 
| 457 | 469 | 
| 458 #define BINARY_OP_LIST(V) \ | 470 #define BINARY_OP_LIST(V) \ | 
| 459   V(BitwiseOr)            \ | 471   V(BitwiseOr)            \ | 
| 460   V(BitwiseXor)           \ | 472   V(BitwiseXor)           \ | 
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 758 const Operator* JSOperatorBuilder::StoreContext(size_t depth, size_t index) { | 770 const Operator* JSOperatorBuilder::StoreContext(size_t depth, size_t index) { | 
| 759   ContextAccess access(depth, index, false); | 771   ContextAccess access(depth, index, false); | 
| 760   return new (zone()) Operator1<ContextAccess>(  // -- | 772   return new (zone()) Operator1<ContextAccess>(  // -- | 
| 761       IrOpcode::kJSStoreContext,                 // opcode | 773       IrOpcode::kJSStoreContext,                 // opcode | 
| 762       Operator::kNoRead | Operator::kNoThrow,    // flags | 774       Operator::kNoRead | Operator::kNoThrow,    // flags | 
| 763       "JSStoreContext",                          // name | 775       "JSStoreContext",                          // name | 
| 764       2, 1, 1, 0, 1, 0,                          // counts | 776       2, 1, 1, 0, 1, 0,                          // counts | 
| 765       access);                                   // parameter | 777       access);                                   // parameter | 
| 766 } | 778 } | 
| 767 | 779 | 
|  | 780 const Operator* JSOperatorBuilder::InstanceOf(VectorSlotPair const& feedback) { | 
|  | 781   return new (zone()) Operator1<VectorSlotPair>(         // -- | 
|  | 782       IrOpcode::kJSInstanceOf, Operator::kNoProperties,  // opcode | 
|  | 783       "JSInstanceOf",                                    // name | 
|  | 784       2, 1, 1, 1, 1, 2,                                  // counts | 
|  | 785       feedback);                                         // parameter | 
|  | 786 } | 
| 768 | 787 | 
| 769 const Operator* JSOperatorBuilder::CreateArguments(CreateArgumentsType type) { | 788 const Operator* JSOperatorBuilder::CreateArguments(CreateArgumentsType type) { | 
| 770   return new (zone()) Operator1<CreateArgumentsType>(         // -- | 789   return new (zone()) Operator1<CreateArgumentsType>(         // -- | 
| 771       IrOpcode::kJSCreateArguments, Operator::kEliminatable,  // opcode | 790       IrOpcode::kJSCreateArguments, Operator::kEliminatable,  // opcode | 
| 772       "JSCreateArguments",                                    // name | 791       "JSCreateArguments",                                    // name | 
| 773       1, 1, 0, 1, 1, 0,                                       // counts | 792       1, 1, 0, 1, 1, 0,                                       // counts | 
| 774       type);                                                  // parameter | 793       type);                                                  // parameter | 
| 775 } | 794 } | 
| 776 | 795 | 
| 777 | 796 | 
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 877   return new (zone()) Operator1<Handle<ScopeInfo>>(               // -- | 896   return new (zone()) Operator1<Handle<ScopeInfo>>(               // -- | 
| 878       IrOpcode::kJSCreateScriptContext, Operator::kNoProperties,  // opcode | 897       IrOpcode::kJSCreateScriptContext, Operator::kNoProperties,  // opcode | 
| 879       "JSCreateScriptContext",                                    // name | 898       "JSCreateScriptContext",                                    // name | 
| 880       1, 1, 1, 1, 1, 2,                                           // counts | 899       1, 1, 1, 1, 1, 2,                                           // counts | 
| 881       scpope_info);                                               // parameter | 900       scpope_info);                                               // parameter | 
| 882 } | 901 } | 
| 883 | 902 | 
| 884 }  // namespace compiler | 903 }  // namespace compiler | 
| 885 }  // namespace internal | 904 }  // namespace internal | 
| 886 }  // namespace v8 | 905 }  // namespace v8 | 
| OLD | NEW | 
|---|