| 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 23 matching lines...) Expand all  Loading... | 
| 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 | 42 | 
| 43 size_t hash_value(ConvertReceiverMode mode) { | 43 size_t hash_value(ConvertReceiverMode mode) { | 
| 44   return base::hash_value(static_cast<int>(mode)); | 44   return base::hash_value(static_cast<unsigned>(mode)); | 
| 45 } | 45 } | 
| 46 | 46 | 
| 47 | 47 | 
| 48 std::ostream& operator<<(std::ostream& os, ConvertReceiverMode mode) { | 48 std::ostream& operator<<(std::ostream& os, ConvertReceiverMode mode) { | 
| 49   switch (mode) { | 49   switch (mode) { | 
| 50     case ConvertReceiverMode::kNullOrUndefined: | 50     case ConvertReceiverMode::kNullOrUndefined: | 
| 51       return os << "NULL_OR_UNDEFINED"; | 51       return os << "NULL_OR_UNDEFINED"; | 
| 52     case ConvertReceiverMode::kNotNullOrUndefined: | 52     case ConvertReceiverMode::kNotNullOrUndefined: | 
| 53       return os << "NOT_NULL_OR_UNDEFINED"; | 53       return os << "NOT_NULL_OR_UNDEFINED"; | 
| 54     case ConvertReceiverMode::kAny: | 54     case ConvertReceiverMode::kAny: | 
| 55       return os << "ANY"; | 55       return os << "ANY"; | 
| 56   } | 56   } | 
| 57   UNREACHABLE(); | 57   UNREACHABLE(); | 
| 58   return os; | 58   return os; | 
| 59 } | 59 } | 
| 60 | 60 | 
| 61 | 61 | 
| 62 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) { | 62 ConvertReceiverMode ConvertReceiverModeOf(Operator const* op) { | 
| 63   DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode()); | 63   DCHECK_EQ(IrOpcode::kJSConvertReceiver, op->opcode()); | 
| 64   return OpParameter<ConvertReceiverMode>(op); | 64   return OpParameter<ConvertReceiverMode>(op); | 
| 65 } | 65 } | 
| 66 | 66 | 
| 67 | 67 | 
|  | 68 size_t hash_value(TailCallMode mode) { | 
|  | 69   return base::hash_value(static_cast<unsigned>(mode)); | 
|  | 70 } | 
|  | 71 | 
|  | 72 | 
|  | 73 std::ostream& operator<<(std::ostream& os, TailCallMode mode) { | 
|  | 74   switch (mode) { | 
|  | 75     case TailCallMode::kAllow: | 
|  | 76       return os << "ALLOW_TAIL_CALLS"; | 
|  | 77     case TailCallMode::kDisallow: | 
|  | 78       return os << "DISALLOW_TAIL_CALLS"; | 
|  | 79   } | 
|  | 80   UNREACHABLE(); | 
|  | 81   return os; | 
|  | 82 } | 
|  | 83 | 
|  | 84 | 
| 68 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { | 85 std::ostream& operator<<(std::ostream& os, CallFunctionParameters const& p) { | 
| 69   os << p.arity() << ", " << p.flags() << ", " << p.language_mode(); | 86   os << p.arity() << ", " << p.language_mode() << ", " << p.convert_mode() | 
| 70   if (p.AllowTailCalls()) { | 87      << ", " << p.tail_call_mode(); | 
| 71     os << ", ALLOW_TAIL_CALLS"; |  | 
| 72   } |  | 
| 73   return os; | 88   return os; | 
| 74 } | 89 } | 
| 75 | 90 | 
| 76 | 91 | 
| 77 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { | 92 const CallFunctionParameters& CallFunctionParametersOf(const Operator* op) { | 
| 78   DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); | 93   DCHECK_EQ(IrOpcode::kJSCallFunction, op->opcode()); | 
| 79   return OpParameter<CallFunctionParameters>(op); | 94   return OpParameter<CallFunctionParameters>(op); | 
| 80 } | 95 } | 
| 81 | 96 | 
| 82 | 97 | 
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 463         break; /* %*!%^$#@ */                                           \ | 478         break; /* %*!%^$#@ */                                           \ | 
| 464     }                                                                   \ | 479     }                                                                   \ | 
| 465     UNREACHABLE();                                                      \ | 480     UNREACHABLE();                                                      \ | 
| 466     return nullptr;                                                     \ | 481     return nullptr;                                                     \ | 
| 467   } | 482   } | 
| 468 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) | 483 CACHED_OP_LIST_WITH_LANGUAGE_MODE(CACHED_WITH_LANGUAGE_MODE) | 
| 469 #undef CACHED_WITH_LANGUAGE_MODE | 484 #undef CACHED_WITH_LANGUAGE_MODE | 
| 470 | 485 | 
| 471 | 486 | 
| 472 const Operator* JSOperatorBuilder::CallFunction( | 487 const Operator* JSOperatorBuilder::CallFunction( | 
| 473     size_t arity, CallFunctionFlags flags, LanguageMode language_mode, | 488     size_t arity, LanguageMode language_mode, VectorSlotPair const& feedback, | 
| 474     VectorSlotPair const& feedback, ConvertReceiverMode convert_mode, | 489     ConvertReceiverMode convert_mode, TailCallMode tail_call_mode) { | 
| 475     TailCallMode tail_call_mode) { | 490   CallFunctionParameters parameters(arity, language_mode, feedback, | 
| 476   CallFunctionParameters parameters(arity, flags, language_mode, feedback, |  | 
| 477                                     tail_call_mode, convert_mode); | 491                                     tail_call_mode, convert_mode); | 
| 478   return new (zone()) Operator1<CallFunctionParameters>(   // -- | 492   return new (zone()) Operator1<CallFunctionParameters>(   // -- | 
| 479       IrOpcode::kJSCallFunction, Operator::kNoProperties,  // opcode | 493       IrOpcode::kJSCallFunction, Operator::kNoProperties,  // opcode | 
| 480       "JSCallFunction",                                    // name | 494       "JSCallFunction",                                    // name | 
| 481       parameters.arity(), 1, 1, 1, 1, 2,                   // inputs/outputs | 495       parameters.arity(), 1, 1, 1, 1, 2,                   // inputs/outputs | 
| 482       parameters);                                         // parameter | 496       parameters);                                         // parameter | 
| 483 } | 497 } | 
| 484 | 498 | 
| 485 | 499 | 
| 486 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, | 500 const Operator* JSOperatorBuilder::CallRuntime(Runtime::FunctionId id, | 
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 706                                 Handle<ScopeInfo>::hash>(         // -- | 720                                 Handle<ScopeInfo>::hash>(         // -- | 
| 707       IrOpcode::kJSCreateScriptContext, Operator::kNoProperties,  // opcode | 721       IrOpcode::kJSCreateScriptContext, Operator::kNoProperties,  // opcode | 
| 708       "JSCreateScriptContext",                                    // name | 722       "JSCreateScriptContext",                                    // name | 
| 709       1, 1, 1, 1, 1, 2,                                           // counts | 723       1, 1, 1, 1, 1, 2,                                           // counts | 
| 710       scpope_info);                                               // parameter | 724       scpope_info);                                               // parameter | 
| 711 } | 725 } | 
| 712 | 726 | 
| 713 }  // namespace compiler | 727 }  // namespace compiler | 
| 714 }  // namespace internal | 728 }  // namespace internal | 
| 715 }  // namespace v8 | 729 }  // namespace v8 | 
| OLD | NEW | 
|---|