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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 ContextAccess const& ContextAccessOf(Operator const* op) { | 106 ContextAccess const& ContextAccessOf(Operator const* op) { |
107 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || | 107 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || |
108 op->opcode() == IrOpcode::kJSStoreContext); | 108 op->opcode() == IrOpcode::kJSStoreContext); |
109 return OpParameter<ContextAccess>(op); | 109 return OpParameter<ContextAccess>(op); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 DynamicGlobalAccess::DynamicGlobalAccess(const Handle<String>& name, | 113 DynamicGlobalAccess::DynamicGlobalAccess(const Handle<String>& name, |
114 uint32_t check_bitset, | 114 uint32_t check_bitset, |
115 const VectorSlotPair& feedback, | 115 const VectorSlotPair& feedback, |
116 ContextualMode mode) | 116 TypeofMode typeof_mode) |
117 : name_(name), | 117 : name_(name), |
118 check_bitset_(check_bitset), | 118 check_bitset_(check_bitset), |
119 feedback_(feedback), | 119 feedback_(feedback), |
120 mode_(mode) { | 120 typeof_mode_(typeof_mode) { |
121 DCHECK(check_bitset == kFullCheckRequired || check_bitset < 0x80000000U); | 121 DCHECK(check_bitset == kFullCheckRequired || check_bitset < 0x80000000U); |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 bool operator==(DynamicGlobalAccess const& lhs, | 125 bool operator==(DynamicGlobalAccess const& lhs, |
126 DynamicGlobalAccess const& rhs) { | 126 DynamicGlobalAccess const& rhs) { |
127 UNIMPLEMENTED(); | 127 UNIMPLEMENTED(); |
128 return true; | 128 return true; |
129 } | 129 } |
130 | 130 |
131 | 131 |
132 bool operator!=(DynamicGlobalAccess const& lhs, | 132 bool operator!=(DynamicGlobalAccess const& lhs, |
133 DynamicGlobalAccess const& rhs) { | 133 DynamicGlobalAccess const& rhs) { |
134 return !(lhs == rhs); | 134 return !(lhs == rhs); |
135 } | 135 } |
136 | 136 |
137 | 137 |
138 size_t hash_value(DynamicGlobalAccess const& access) { | 138 size_t hash_value(DynamicGlobalAccess const& access) { |
139 UNIMPLEMENTED(); | 139 UNIMPLEMENTED(); |
140 return 0; | 140 return 0; |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 std::ostream& operator<<(std::ostream& os, DynamicGlobalAccess const& access) { | 144 std::ostream& operator<<(std::ostream& os, DynamicGlobalAccess const& access) { |
145 return os << Brief(*access.name()) << ", " << access.check_bitset() << ", " | 145 return os << Brief(*access.name()) << ", " << access.check_bitset() << ", " |
146 << access.mode(); | 146 << access.typeof_mode(); |
147 } | 147 } |
148 | 148 |
149 | 149 |
150 DynamicGlobalAccess const& DynamicGlobalAccessOf(Operator const* op) { | 150 DynamicGlobalAccess const& DynamicGlobalAccessOf(Operator const* op) { |
151 DCHECK_EQ(IrOpcode::kJSLoadDynamicGlobal, op->opcode()); | 151 DCHECK_EQ(IrOpcode::kJSLoadDynamicGlobal, op->opcode()); |
152 return OpParameter<DynamicGlobalAccess>(op); | 152 return OpParameter<DynamicGlobalAccess>(op); |
153 } | 153 } |
154 | 154 |
155 | 155 |
156 DynamicContextAccess::DynamicContextAccess(const Handle<String>& name, | 156 DynamicContextAccess::DynamicContextAccess(const Handle<String>& name, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) { | 191 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) { |
192 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode()); | 192 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode()); |
193 return OpParameter<DynamicContextAccess>(op); | 193 return OpParameter<DynamicContextAccess>(op); |
194 } | 194 } |
195 | 195 |
196 | 196 |
197 bool operator==(LoadNamedParameters const& lhs, | 197 bool operator==(LoadNamedParameters const& lhs, |
198 LoadNamedParameters const& rhs) { | 198 LoadNamedParameters const& rhs) { |
199 return lhs.name() == rhs.name() && | 199 return lhs.name() == rhs.name() && |
200 lhs.language_mode() == rhs.language_mode() && | 200 lhs.language_mode() == rhs.language_mode() && |
201 lhs.contextual_mode() == rhs.contextual_mode() && | |
202 lhs.feedback() == rhs.feedback(); | 201 lhs.feedback() == rhs.feedback(); |
203 } | 202 } |
204 | 203 |
205 | 204 |
206 bool operator!=(LoadNamedParameters const& lhs, | 205 bool operator!=(LoadNamedParameters const& lhs, |
207 LoadNamedParameters const& rhs) { | 206 LoadNamedParameters const& rhs) { |
208 return !(lhs == rhs); | 207 return !(lhs == rhs); |
209 } | 208 } |
210 | 209 |
211 | 210 |
212 size_t hash_value(LoadNamedParameters const& p) { | 211 size_t hash_value(LoadNamedParameters const& p) { |
213 return base::hash_combine(p.name(), p.language_mode(), p.contextual_mode(), | 212 return base::hash_combine(p.name(), p.language_mode(), p.feedback()); |
214 p.feedback()); | |
215 } | 213 } |
216 | 214 |
217 | 215 |
218 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { | 216 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { |
219 return os << Brief(*p.name().handle()) << ", " << p.language_mode() << ", " | 217 return os << Brief(*p.name().handle()) << ", " << p.language_mode(); |
220 << p.contextual_mode(); | |
221 } | 218 } |
222 | 219 |
223 | 220 |
224 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { | 221 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { |
225 return os << p.language_mode(); | 222 return os << p.language_mode(); |
226 } | 223 } |
227 | 224 |
228 | 225 |
229 bool operator==(LoadPropertyParameters const& lhs, | 226 bool operator==(LoadPropertyParameters const& lhs, |
230 LoadPropertyParameters const& rhs) { | 227 LoadPropertyParameters const& rhs) { |
(...skipping 21 matching lines...) Expand all Loading... |
252 | 249 |
253 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { | 250 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { |
254 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); | 251 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); |
255 return OpParameter<LoadNamedParameters>(op); | 252 return OpParameter<LoadNamedParameters>(op); |
256 } | 253 } |
257 | 254 |
258 | 255 |
259 bool operator==(LoadGlobalParameters const& lhs, | 256 bool operator==(LoadGlobalParameters const& lhs, |
260 LoadGlobalParameters const& rhs) { | 257 LoadGlobalParameters const& rhs) { |
261 return lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback() && | 258 return lhs.name() == rhs.name() && lhs.feedback() == rhs.feedback() && |
262 lhs.contextual_mode() == rhs.contextual_mode() && | 259 lhs.typeof_mode() == rhs.typeof_mode() && |
263 lhs.slot_index() == rhs.slot_index(); | 260 lhs.slot_index() == rhs.slot_index(); |
264 } | 261 } |
265 | 262 |
266 | 263 |
267 bool operator!=(LoadGlobalParameters const& lhs, | 264 bool operator!=(LoadGlobalParameters const& lhs, |
268 LoadGlobalParameters const& rhs) { | 265 LoadGlobalParameters const& rhs) { |
269 return !(lhs == rhs); | 266 return !(lhs == rhs); |
270 } | 267 } |
271 | 268 |
272 | 269 |
273 size_t hash_value(LoadGlobalParameters const& p) { | 270 size_t hash_value(LoadGlobalParameters const& p) { |
274 return base::hash_combine(p.name(), p.contextual_mode(), p.slot_index()); | 271 return base::hash_combine(p.name(), p.typeof_mode(), p.slot_index()); |
275 } | 272 } |
276 | 273 |
277 | 274 |
278 std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) { | 275 std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) { |
279 return os << Brief(*p.name().handle()) << ", " << p.contextual_mode() | 276 return os << Brief(*p.name().handle()) << ", " << p.typeof_mode() |
280 << ", slot: " << p.slot_index(); | 277 << ", slot: " << p.slot_index(); |
281 } | 278 } |
282 | 279 |
283 | 280 |
284 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) { | 281 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) { |
285 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode()); | 282 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode()); |
286 return OpParameter<LoadGlobalParameters>(op); | 283 return OpParameter<LoadGlobalParameters>(op); |
287 } | 284 } |
288 | 285 |
289 | 286 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode | 555 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode |
559 "JSCallConstruct", // name | 556 "JSCallConstruct", // name |
560 arguments, 1, 1, 1, 1, 2, // counts | 557 arguments, 1, 1, 1, 1, 2, // counts |
561 arguments); // parameter | 558 arguments); // parameter |
562 } | 559 } |
563 | 560 |
564 | 561 |
565 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, | 562 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, |
566 const VectorSlotPair& feedback, | 563 const VectorSlotPair& feedback, |
567 LanguageMode language_mode) { | 564 LanguageMode language_mode) { |
568 LoadNamedParameters parameters(name, feedback, language_mode, NOT_CONTEXTUAL); | 565 LoadNamedParameters parameters(name, feedback, language_mode); |
569 return new (zone()) Operator1<LoadNamedParameters>( // -- | 566 return new (zone()) Operator1<LoadNamedParameters>( // -- |
570 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode | 567 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode |
571 "JSLoadNamed", // name | 568 "JSLoadNamed", // name |
572 2, 1, 1, 1, 1, 2, // counts | 569 2, 1, 1, 1, 1, 2, // counts |
573 parameters); // parameter | 570 parameters); // parameter |
574 } | 571 } |
575 | 572 |
576 | 573 |
577 const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback, | 574 const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback, |
578 LanguageMode language_mode) { | 575 LanguageMode language_mode) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 return new (zone()) Operator1<LanguageMode>( // -- | 609 return new (zone()) Operator1<LanguageMode>( // -- |
613 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode | 610 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode |
614 "JSDeleteProperty", // name | 611 "JSDeleteProperty", // name |
615 2, 1, 1, 1, 1, 2, // counts | 612 2, 1, 1, 1, 1, 2, // counts |
616 language_mode); // parameter | 613 language_mode); // parameter |
617 } | 614 } |
618 | 615 |
619 | 616 |
620 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name, | 617 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name, |
621 const VectorSlotPair& feedback, | 618 const VectorSlotPair& feedback, |
622 ContextualMode contextual_mode, | 619 TypeofMode typeof_mode, |
623 int slot_index) { | 620 int slot_index) { |
624 LoadGlobalParameters parameters(name, feedback, contextual_mode, slot_index); | 621 LoadGlobalParameters parameters(name, feedback, typeof_mode, slot_index); |
625 return new (zone()) Operator1<LoadGlobalParameters>( // -- | 622 return new (zone()) Operator1<LoadGlobalParameters>( // -- |
626 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode | 623 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode |
627 "JSLoadGlobal", // name | 624 "JSLoadGlobal", // name |
628 3, 1, 1, 1, 1, 2, // counts | 625 3, 1, 1, 1, 1, 2, // counts |
629 parameters); // parameter | 626 parameters); // parameter |
630 } | 627 } |
631 | 628 |
632 | 629 |
633 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, | 630 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, |
634 const Unique<Name>& name, | 631 const Unique<Name>& name, |
(...skipping 26 matching lines...) Expand all Loading... |
661 IrOpcode::kJSStoreContext, // opcode | 658 IrOpcode::kJSStoreContext, // opcode |
662 Operator::kNoRead | Operator::kNoThrow, // flags | 659 Operator::kNoRead | Operator::kNoThrow, // flags |
663 "JSStoreContext", // name | 660 "JSStoreContext", // name |
664 2, 1, 1, 0, 1, 0, // counts | 661 2, 1, 1, 0, 1, 0, // counts |
665 access); // parameter | 662 access); // parameter |
666 } | 663 } |
667 | 664 |
668 | 665 |
669 const Operator* JSOperatorBuilder::LoadDynamicGlobal( | 666 const Operator* JSOperatorBuilder::LoadDynamicGlobal( |
670 const Handle<String>& name, uint32_t check_bitset, | 667 const Handle<String>& name, uint32_t check_bitset, |
671 const VectorSlotPair& feedback, ContextualMode mode) { | 668 const VectorSlotPair& feedback, TypeofMode typeof_mode) { |
672 DynamicGlobalAccess access(name, check_bitset, feedback, mode); | 669 DynamicGlobalAccess access(name, check_bitset, feedback, typeof_mode); |
673 return new (zone()) Operator1<DynamicGlobalAccess>( // -- | 670 return new (zone()) Operator1<DynamicGlobalAccess>( // -- |
674 IrOpcode::kJSLoadDynamicGlobal, Operator::kNoProperties, // opcode | 671 IrOpcode::kJSLoadDynamicGlobal, Operator::kNoProperties, // opcode |
675 "JSLoadDynamicGlobal", // name | 672 "JSLoadDynamicGlobal", // name |
676 2, 1, 1, 1, 1, 2, // counts | 673 2, 1, 1, 1, 1, 2, // counts |
677 access); // parameter | 674 access); // parameter |
678 } | 675 } |
679 | 676 |
680 | 677 |
681 const Operator* JSOperatorBuilder::LoadDynamicContext( | 678 const Operator* JSOperatorBuilder::LoadDynamicContext( |
682 const Handle<String>& name, uint32_t check_bitset, size_t depth, | 679 const Handle<String>& name, uint32_t check_bitset, size_t depth, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 return new (zone()) Operator1<Unique<String>>( // -- | 722 return new (zone()) Operator1<Unique<String>>( // -- |
726 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 723 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
727 "JSCreateCatchContext", // name | 724 "JSCreateCatchContext", // name |
728 2, 1, 1, 1, 1, 2, // counts | 725 2, 1, 1, 1, 1, 2, // counts |
729 name); // parameter | 726 name); // parameter |
730 } | 727 } |
731 | 728 |
732 } // namespace compiler | 729 } // namespace compiler |
733 } // namespace internal | 730 } // namespace internal |
734 } // namespace v8 | 731 } // namespace v8 |
OLD | NEW |