| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 | 194 |
| 195 ContextAccess const& ContextAccessOf(Operator const* op) { | 195 ContextAccess const& ContextAccessOf(Operator const* op) { |
| 196 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || | 196 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || |
| 197 op->opcode() == IrOpcode::kJSStoreContext); | 197 op->opcode() == IrOpcode::kJSStoreContext); |
| 198 return OpParameter<ContextAccess>(op); | 198 return OpParameter<ContextAccess>(op); |
| 199 } | 199 } |
| 200 | 200 |
| 201 | 201 |
| 202 DynamicAccess::DynamicAccess(const Handle<String>& name, TypeofMode typeof_mode) | |
| 203 : name_(name), typeof_mode_(typeof_mode) {} | |
| 204 | |
| 205 | |
| 206 bool operator==(DynamicAccess const& lhs, DynamicAccess const& rhs) { | |
| 207 UNIMPLEMENTED(); | |
| 208 return true; | |
| 209 } | |
| 210 | |
| 211 | |
| 212 bool operator!=(DynamicAccess const& lhs, DynamicAccess const& rhs) { | |
| 213 return !(lhs == rhs); | |
| 214 } | |
| 215 | |
| 216 | |
| 217 size_t hash_value(DynamicAccess const& access) { | |
| 218 UNIMPLEMENTED(); | |
| 219 return 0; | |
| 220 } | |
| 221 | |
| 222 | |
| 223 std::ostream& operator<<(std::ostream& os, DynamicAccess const& access) { | |
| 224 return os << Brief(*access.name()) << ", " << access.typeof_mode(); | |
| 225 } | |
| 226 | |
| 227 | |
| 228 DynamicAccess const& DynamicAccessOf(Operator const* op) { | |
| 229 DCHECK_EQ(IrOpcode::kJSLoadDynamic, op->opcode()); | |
| 230 return OpParameter<DynamicAccess>(op); | |
| 231 } | |
| 232 | |
| 233 | |
| 234 bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) { | 202 bool operator==(NamedAccess const& lhs, NamedAccess const& rhs) { |
| 235 return lhs.name().location() == rhs.name().location() && | 203 return lhs.name().location() == rhs.name().location() && |
| 236 lhs.language_mode() == rhs.language_mode() && | 204 lhs.language_mode() == rhs.language_mode() && |
| 237 lhs.feedback() == rhs.feedback(); | 205 lhs.feedback() == rhs.feedback(); |
| 238 } | 206 } |
| 239 | 207 |
| 240 | 208 |
| 241 bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) { | 209 bool operator!=(NamedAccess const& lhs, NamedAccess const& rhs) { |
| 242 return !(lhs == rhs); | 210 return !(lhs == rhs); |
| 243 } | 211 } |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 ContextAccess access(depth, index, false); | 815 ContextAccess access(depth, index, false); |
| 848 return new (zone()) Operator1<ContextAccess>( // -- | 816 return new (zone()) Operator1<ContextAccess>( // -- |
| 849 IrOpcode::kJSStoreContext, // opcode | 817 IrOpcode::kJSStoreContext, // opcode |
| 850 Operator::kNoRead | Operator::kNoThrow, // flags | 818 Operator::kNoRead | Operator::kNoThrow, // flags |
| 851 "JSStoreContext", // name | 819 "JSStoreContext", // name |
| 852 2, 1, 1, 0, 1, 0, // counts | 820 2, 1, 1, 0, 1, 0, // counts |
| 853 access); // parameter | 821 access); // parameter |
| 854 } | 822 } |
| 855 | 823 |
| 856 | 824 |
| 857 const Operator* JSOperatorBuilder::LoadDynamic(const Handle<String>& name, | |
| 858 TypeofMode typeof_mode) { | |
| 859 DynamicAccess access(name, typeof_mode); | |
| 860 return new (zone()) Operator1<DynamicAccess>( // -- | |
| 861 IrOpcode::kJSLoadDynamic, Operator::kNoProperties, // opcode | |
| 862 "JSLoadDynamic", // name | |
| 863 2, 1, 1, 1, 1, 2, // counts | |
| 864 access); // parameter | |
| 865 } | |
| 866 | |
| 867 | |
| 868 const Operator* JSOperatorBuilder::CreateArguments(CreateArgumentsType type) { | 825 const Operator* JSOperatorBuilder::CreateArguments(CreateArgumentsType type) { |
| 869 return new (zone()) Operator1<CreateArgumentsType>( // -- | 826 return new (zone()) Operator1<CreateArgumentsType>( // -- |
| 870 IrOpcode::kJSCreateArguments, Operator::kNoThrow, // opcode | 827 IrOpcode::kJSCreateArguments, Operator::kNoThrow, // opcode |
| 871 "JSCreateArguments", // name | 828 "JSCreateArguments", // name |
| 872 1, 1, 1, 1, 1, 0, // counts | 829 1, 1, 1, 1, 1, 0, // counts |
| 873 type); // parameter | 830 type); // parameter |
| 874 } | 831 } |
| 875 | 832 |
| 876 | 833 |
| 877 const Operator* JSOperatorBuilder::CreateArray(size_t arity, | 834 const Operator* JSOperatorBuilder::CreateArray(size_t arity, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- | 927 return new (zone()) Operator1<Handle<ScopeInfo>>( // -- |
| 971 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 928 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 972 "JSCreateScriptContext", // name | 929 "JSCreateScriptContext", // name |
| 973 1, 1, 1, 1, 1, 2, // counts | 930 1, 1, 1, 1, 1, 2, // counts |
| 974 scpope_info); // parameter | 931 scpope_info); // parameter |
| 975 } | 932 } |
| 976 | 933 |
| 977 } // namespace compiler | 934 } // namespace compiler |
| 978 } // namespace internal | 935 } // namespace internal |
| 979 } // namespace v8 | 936 } // namespace v8 |
| OLD | NEW |