| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 << access.immutable(); | 150 << access.immutable(); |
| 151 } | 151 } |
| 152 | 152 |
| 153 | 153 |
| 154 ContextAccess const& ContextAccessOf(Operator const* op) { | 154 ContextAccess const& ContextAccessOf(Operator const* op) { |
| 155 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || | 155 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || |
| 156 op->opcode() == IrOpcode::kJSStoreContext); | 156 op->opcode() == IrOpcode::kJSStoreContext); |
| 157 return OpParameter<ContextAccess>(op); | 157 return OpParameter<ContextAccess>(op); |
| 158 } | 158 } |
| 159 | 159 |
| 160 CreateCatchContextParameters::CreateCatchContextParameters( |
| 161 Handle<String> catch_name, Handle<ScopeInfo> scope_info) |
| 162 : catch_name_(catch_name), scope_info_(scope_info) {} |
| 163 |
| 164 bool operator==(CreateCatchContextParameters const& lhs, |
| 165 CreateCatchContextParameters const& rhs) { |
| 166 return lhs.catch_name().location() == rhs.catch_name().location() && |
| 167 lhs.scope_info().location() == rhs.scope_info().location(); |
| 168 } |
| 169 |
| 170 bool operator!=(CreateCatchContextParameters const& lhs, |
| 171 CreateCatchContextParameters const& rhs) { |
| 172 return !(lhs == rhs); |
| 173 } |
| 174 |
| 175 size_t hash_value(CreateCatchContextParameters const& parameters) { |
| 176 return base::hash_combine(parameters.catch_name().location(), |
| 177 parameters.scope_info().location()); |
| 178 } |
| 179 |
| 180 std::ostream& operator<<(std::ostream& os, |
| 181 CreateCatchContextParameters const& parameters) { |
| 182 return os << Brief(*parameters.catch_name()) << ", " |
| 183 << Brief(*parameters.scope_info()); |
| 184 } |
| 185 |
| 186 CreateCatchContextParameters const& CreateCatchContextParametersOf( |
| 187 Operator const* op) { |
| 188 DCHECK_EQ(IrOpcode::kJSCreateCatchContext, op->opcode()); |
| 189 return OpParameter<CreateCatchContextParameters>(op); |
| 190 } |
| 160 | 191 |
| 161 bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) { | 192 bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) { |
| 162 return lhs.name().location() == rhs.name().location() && | 193 return lhs.name().location() == rhs.name().location() && |
| 163 lhs.language_mode() == rhs.language_mode() && | 194 lhs.language_mode() == rhs.language_mode() && |
| 164 lhs.feedback() == rhs.feedback(); | 195 lhs.feedback() == rhs.feedback(); |
| 165 } | 196 } |
| 166 | 197 |
| 167 | 198 |
| 168 bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) { | 199 bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) { |
| 169 return !(lhs == rhs); | 200 return !(lhs == rhs); |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 | 833 |
| 803 | 834 |
| 804 const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) { | 835 const Operator* JSOperatorBuilder::CreateFunctionContext(int slot_count) { |
| 805 return new (zone()) Operator1<int>( // -- | 836 return new (zone()) Operator1<int>( // -- |
| 806 IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode | 837 IrOpcode::kJSCreateFunctionContext, Operator::kNoProperties, // opcode |
| 807 "JSCreateFunctionContext", // name | 838 "JSCreateFunctionContext", // name |
| 808 1, 1, 1, 1, 1, 2, // counts | 839 1, 1, 1, 1, 1, 2, // counts |
| 809 slot_count); // parameter | 840 slot_count); // parameter |
| 810 } | 841 } |
| 811 | 842 |
| 812 | |
| 813 const Operator* JSOperatorBuilder::CreateCatchContext( | 843 const Operator* JSOperatorBuilder::CreateCatchContext( |
| 814 const Handle<String>& name) { | 844 const Handle<String>& name, const Handle<ScopeInfo>& scope_info) { |
| 815 return new (zone()) Operator1<Handle<String>>( // -- | 845 CreateCatchContextParameters parameters(name, scope_info); |
| 846 return new (zone()) Operator1<CreateCatchContextParameters>( |
| 816 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 847 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
| 817 "JSCreateCatchContext", // name | 848 "JSCreateCatchContext", // name |
| 818 2, 1, 1, 1, 1, 2, // counts | 849 2, 1, 1, 1, 1, 2, // counts |
| 819 name); // parameter | 850 parameters); // parameter |
| 820 } | 851 } |
| 821 | 852 |
| 822 | 853 |
| 823 const Operator* JSOperatorBuilder::CreateBlockContext( | 854 const Operator* JSOperatorBuilder::CreateBlockContext( |
| 824 const Handle<ScopeInfo>& scpope_info) { | 855 const Handle<ScopeInfo>& scpope_info) { |
| 825 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 856 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
| 826 IrOpcode::kJSCreateBlockContext, Operator::kNoProperties, // opcode | 857 IrOpcode::kJSCreateBlockContext, Operator::kNoProperties, // opcode |
| 827 "JSCreateBlockContext", // name | 858 "JSCreateBlockContext", // name |
| 828 1, 1, 1, 1, 1, 2, // counts | 859 1, 1, 1, 1, 1, 2, // counts |
| 829 scpope_info); // parameter | 860 scpope_info); // parameter |
| 830 } | 861 } |
| 831 | 862 |
| 832 | 863 |
| 833 const Operator* JSOperatorBuilder::CreateScriptContext( | 864 const Operator* JSOperatorBuilder::CreateScriptContext( |
| 834 const Handle<ScopeInfo>& scpope_info) { | 865 const Handle<ScopeInfo>& scpope_info) { |
| 835 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 866 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
| 836 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 867 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 837 "JSCreateScriptContext", // name | 868 "JSCreateScriptContext", // name |
| 838 1, 1, 1, 1, 1, 2, // counts | 869 1, 1, 1, 1, 1, 2, // counts |
| 839 scpope_info); // parameter | 870 scpope_info); // parameter |
| 840 } | 871 } |
| 841 | 872 |
| 842 } // namespace compiler | 873 } // namespace compiler |
| 843 } // namespace internal | 874 } // namespace internal |
| 844 } // namespace v8 | 875 } // namespace v8 |
| OLD | NEW |