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() && | 201 lhs.typeof_mode() == rhs.typeof_mode() && |
202 lhs.feedback() == rhs.feedback(); | 202 lhs.feedback() == rhs.feedback(); |
203 } | 203 } |
204 | 204 |
205 | 205 |
206 bool operator!=(LoadNamedParameters const& lhs, | 206 bool operator!=(LoadNamedParameters const& lhs, |
207 LoadNamedParameters const& rhs) { | 207 LoadNamedParameters const& rhs) { |
208 return !(lhs == rhs); | 208 return !(lhs == rhs); |
209 } | 209 } |
210 | 210 |
211 | 211 |
212 size_t hash_value(LoadNamedParameters const& p) { | 212 size_t hash_value(LoadNamedParameters const& p) { |
213 return base::hash_combine(p.name(), p.language_mode(), p.contextual_mode(), | 213 return base::hash_combine(p.name(), p.language_mode(), p.typeof_mode(), |
214 p.feedback()); | 214 p.feedback()); |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { | 218 std::ostream& operator<<(std::ostream& os, LoadNamedParameters const& p) { |
219 return os << Brief(*p.name().handle()) << ", " << p.language_mode() << ", " | 219 return os << Brief(*p.name().handle()) << ", " << p.language_mode() << ", " |
220 << p.contextual_mode(); | 220 << p.typeof_mode(); |
221 } | 221 } |
222 | 222 |
223 | 223 |
224 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { | 224 std::ostream& operator<<(std::ostream& os, LoadPropertyParameters const& p) { |
225 return os << p.language_mode(); | 225 return os << p.language_mode(); |
226 } | 226 } |
227 | 227 |
228 | 228 |
229 bool operator==(LoadPropertyParameters const& lhs, | 229 bool operator==(LoadPropertyParameters const& lhs, |
230 LoadPropertyParameters const& rhs) { | 230 LoadPropertyParameters const& rhs) { |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode | 507 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode |
508 "JSCallConstruct", // name | 508 "JSCallConstruct", // name |
509 arguments, 1, 1, 1, 1, 2, // counts | 509 arguments, 1, 1, 1, 1, 2, // counts |
510 arguments); // parameter | 510 arguments); // parameter |
511 } | 511 } |
512 | 512 |
513 | 513 |
514 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, | 514 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, |
515 const VectorSlotPair& feedback, | 515 const VectorSlotPair& feedback, |
516 LanguageMode language_mode) { | 516 LanguageMode language_mode) { |
517 LoadNamedParameters parameters(name, feedback, language_mode, NOT_CONTEXTUAL); | 517 LoadNamedParameters parameters(name, feedback, language_mode, INSIDE_TYPEOF); |
518 return new (zone()) Operator1<LoadNamedParameters>( // -- | 518 return new (zone()) Operator1<LoadNamedParameters>( // -- |
519 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode | 519 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode |
520 "JSLoadNamed", // name | 520 "JSLoadNamed", // name |
521 2, 1, 1, 1, 1, 2, // counts | 521 2, 1, 1, 1, 1, 2, // counts |
522 parameters); // parameter | 522 parameters); // parameter |
523 } | 523 } |
524 | 524 |
525 | 525 |
526 const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback, | 526 const Operator* JSOperatorBuilder::LoadProperty(const VectorSlotPair& feedback, |
527 LanguageMode language_mode) { | 527 LanguageMode language_mode) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 return new (zone()) Operator1<LanguageMode>( // -- | 561 return new (zone()) Operator1<LanguageMode>( // -- |
562 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode | 562 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode |
563 "JSDeleteProperty", // name | 563 "JSDeleteProperty", // name |
564 2, 1, 1, 1, 1, 2, // counts | 564 2, 1, 1, 1, 1, 2, // counts |
565 language_mode); // parameter | 565 language_mode); // parameter |
566 } | 566 } |
567 | 567 |
568 | 568 |
569 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name, | 569 const Operator* JSOperatorBuilder::LoadGlobal(const Unique<Name>& name, |
570 const VectorSlotPair& feedback, | 570 const VectorSlotPair& feedback, |
571 ContextualMode contextual_mode) { | 571 TypeofMode typeof_mode) { |
572 LoadNamedParameters parameters(name, feedback, SLOPPY, contextual_mode); | 572 LoadNamedParameters parameters(name, feedback, SLOPPY, typeof_mode); |
573 return new (zone()) Operator1<LoadNamedParameters>( // -- | 573 return new (zone()) Operator1<LoadNamedParameters>( // -- |
574 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode | 574 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode |
575 "JSLoadGlobal", // name | 575 "JSLoadGlobal", // name |
576 2, 1, 1, 1, 1, 2, // counts | 576 2, 1, 1, 1, 1, 2, // counts |
577 parameters); // parameter | 577 parameters); // parameter |
578 } | 578 } |
579 | 579 |
580 | 580 |
581 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, | 581 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, |
582 const Unique<Name>& name, | 582 const Unique<Name>& name, |
(...skipping 25 matching lines...) Expand all Loading... |
608 IrOpcode::kJSStoreContext, // opcode | 608 IrOpcode::kJSStoreContext, // opcode |
609 Operator::kNoRead | Operator::kNoThrow, // flags | 609 Operator::kNoRead | Operator::kNoThrow, // flags |
610 "JSStoreContext", // name | 610 "JSStoreContext", // name |
611 2, 1, 1, 0, 1, 0, // counts | 611 2, 1, 1, 0, 1, 0, // counts |
612 access); // parameter | 612 access); // parameter |
613 } | 613 } |
614 | 614 |
615 | 615 |
616 const Operator* JSOperatorBuilder::LoadDynamicGlobal( | 616 const Operator* JSOperatorBuilder::LoadDynamicGlobal( |
617 const Handle<String>& name, uint32_t check_bitset, | 617 const Handle<String>& name, uint32_t check_bitset, |
618 const VectorSlotPair& feedback, ContextualMode mode) { | 618 const VectorSlotPair& feedback, TypeofMode typeof_mode) { |
619 DynamicGlobalAccess access(name, check_bitset, feedback, mode); | 619 DynamicGlobalAccess access(name, check_bitset, feedback, typeof_mode); |
620 return new (zone()) Operator1<DynamicGlobalAccess>( // -- | 620 return new (zone()) Operator1<DynamicGlobalAccess>( // -- |
621 IrOpcode::kJSLoadDynamicGlobal, Operator::kNoProperties, // opcode | 621 IrOpcode::kJSLoadDynamicGlobal, Operator::kNoProperties, // opcode |
622 "JSLoadDynamicGlobal", // name | 622 "JSLoadDynamicGlobal", // name |
623 2, 1, 1, 1, 1, 2, // counts | 623 2, 1, 1, 1, 1, 2, // counts |
624 access); // parameter | 624 access); // parameter |
625 } | 625 } |
626 | 626 |
627 | 627 |
628 const Operator* JSOperatorBuilder::LoadDynamicContext( | 628 const Operator* JSOperatorBuilder::LoadDynamicContext( |
629 const Handle<String>& name, uint32_t check_bitset, size_t depth, | 629 const Handle<String>& name, uint32_t check_bitset, size_t depth, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 return new (zone()) Operator1<Unique<String>>( // -- | 672 return new (zone()) Operator1<Unique<String>>( // -- |
673 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 673 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
674 "JSCreateCatchContext", // name | 674 "JSCreateCatchContext", // name |
675 2, 1, 1, 1, 1, 2, // counts | 675 2, 1, 1, 1, 1, 2, // counts |
676 name); // parameter | 676 name); // parameter |
677 } | 677 } |
678 | 678 |
679 } // namespace compiler | 679 } // namespace compiler |
680 } // namespace internal | 680 } // namespace internal |
681 } // namespace v8 | 681 } // namespace v8 |
OLD | NEW |