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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 ContextAccess const& ContextAccessOf(Operator const* op) { | 87 ContextAccess const& ContextAccessOf(Operator const* op) { |
88 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || | 88 DCHECK(op->opcode() == IrOpcode::kJSLoadContext || |
89 op->opcode() == IrOpcode::kJSStoreContext); | 89 op->opcode() == IrOpcode::kJSStoreContext); |
90 return OpParameter<ContextAccess>(op); | 90 return OpParameter<ContextAccess>(op); |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 DynamicGlobalAccess::DynamicGlobalAccess(const Handle<String>& name, | 94 DynamicGlobalAccess::DynamicGlobalAccess(const Handle<String>& name, |
95 uint32_t check_bitset, | 95 uint32_t check_bitset, |
96 const VectorSlotPair& feedback, | 96 const ResolvedFeedbackSlot& feedback, |
97 ContextualMode mode) | 97 ContextualMode mode) |
98 : name_(name), | 98 : name_(name), |
99 check_bitset_(check_bitset), | 99 check_bitset_(check_bitset), |
100 feedback_(feedback), | 100 feedback_(feedback), |
101 mode_(mode) { | 101 mode_(mode) { |
102 DCHECK(check_bitset == kFullCheckRequired || check_bitset < 0x80000000U); | 102 DCHECK(check_bitset == kFullCheckRequired || check_bitset < 0x80000000U); |
103 } | 103 } |
104 | 104 |
105 | 105 |
106 bool operator==(DynamicGlobalAccess const& lhs, | 106 bool operator==(DynamicGlobalAccess const& lhs, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 << access.context_access(); | 168 << access.context_access(); |
169 } | 169 } |
170 | 170 |
171 | 171 |
172 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) { | 172 DynamicContextAccess const& DynamicContextAccessOf(Operator const* op) { |
173 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode()); | 173 DCHECK_EQ(IrOpcode::kJSLoadDynamicContext, op->opcode()); |
174 return OpParameter<DynamicContextAccess>(op); | 174 return OpParameter<DynamicContextAccess>(op); |
175 } | 175 } |
176 | 176 |
177 | 177 |
178 bool operator==(VectorSlotPair const& lhs, VectorSlotPair const& rhs) { | 178 bool operator==(ResolvedFeedbackSlot const& lhs, |
179 return lhs.slot().ToInt() == rhs.slot().ToInt() && | 179 ResolvedFeedbackSlot const& rhs) { |
180 lhs.vector().is_identical_to(rhs.vector()); | 180 return lhs.slot().ToInt() == rhs.slot().ToInt(); |
181 } | 181 } |
182 | 182 |
183 | 183 |
184 size_t hash_value(VectorSlotPair const& p) { | 184 size_t hash_value(ResolvedFeedbackSlot const& p) { |
185 // TODO(mvstanton): include the vector in the hash. | |
186 base::hash<int> h; | 185 base::hash<int> h; |
187 return h(p.slot().ToInt()); | 186 return h(p.slot().ToInt()); |
188 } | 187 } |
189 | 188 |
190 | 189 |
191 bool operator==(LoadNamedParameters const& lhs, | 190 bool operator==(LoadNamedParameters const& lhs, |
192 LoadNamedParameters const& rhs) { | 191 LoadNamedParameters const& rhs) { |
193 return lhs.name() == rhs.name() && | 192 return lhs.name() == rhs.name() && |
194 lhs.contextual_mode() == rhs.contextual_mode() && | 193 lhs.contextual_mode() == rhs.contextual_mode() && |
195 lhs.feedback() == rhs.feedback(); | 194 lhs.feedback() == rhs.feedback(); |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 | 450 |
452 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { | 451 const Operator* JSOperatorBuilder::CallConstruct(int arguments) { |
453 return new (zone()) Operator1<int>( // -- | 452 return new (zone()) Operator1<int>( // -- |
454 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode | 453 IrOpcode::kJSCallConstruct, Operator::kNoProperties, // opcode |
455 "JSCallConstruct", // name | 454 "JSCallConstruct", // name |
456 arguments, 1, 1, 1, 1, 2, // counts | 455 arguments, 1, 1, 1, 1, 2, // counts |
457 arguments); // parameter | 456 arguments); // parameter |
458 } | 457 } |
459 | 458 |
460 | 459 |
461 const Operator* JSOperatorBuilder::LoadNamed(const Unique<Name>& name, | 460 const Operator* JSOperatorBuilder::LoadNamed( |
462 const VectorSlotPair& feedback, | 461 const Unique<Name>& name, const ResolvedFeedbackSlot& feedback, |
463 ContextualMode contextual_mode) { | 462 ContextualMode contextual_mode) { |
464 LoadNamedParameters parameters(name, feedback, contextual_mode); | 463 LoadNamedParameters parameters(name, feedback, contextual_mode); |
465 return new (zone()) Operator1<LoadNamedParameters>( // -- | 464 return new (zone()) Operator1<LoadNamedParameters>( // -- |
466 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode | 465 IrOpcode::kJSLoadNamed, Operator::kNoProperties, // opcode |
467 "JSLoadNamed", // name | 466 "JSLoadNamed", // name |
468 1, 1, 1, 1, 1, 2, // counts | 467 2, 1, 1, 1, 1, 2, // counts |
469 parameters); // parameter | 468 parameters); // parameter |
470 } | 469 } |
471 | 470 |
472 | 471 |
473 const Operator* JSOperatorBuilder::LoadProperty( | 472 const Operator* JSOperatorBuilder::LoadProperty( |
474 const VectorSlotPair& feedback) { | 473 const ResolvedFeedbackSlot& feedback) { |
475 LoadPropertyParameters parameters(feedback); | 474 LoadPropertyParameters parameters(feedback); |
476 return new (zone()) Operator1<LoadPropertyParameters>( // -- | 475 return new (zone()) Operator1<LoadPropertyParameters>( // -- |
477 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode | 476 IrOpcode::kJSLoadProperty, Operator::kNoProperties, // opcode |
478 "JSLoadProperty", // name | 477 "JSLoadProperty", // name |
479 2, 1, 1, 1, 1, 2, // counts | 478 3, 1, 1, 1, 1, 2, // counts |
480 parameters); // parameter | 479 parameters); // parameter |
481 } | 480 } |
482 | 481 |
483 | 482 |
484 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, | 483 const Operator* JSOperatorBuilder::StoreNamed(LanguageMode language_mode, |
485 const Unique<Name>& name) { | 484 const Unique<Name>& name) { |
486 StoreNamedParameters parameters(language_mode, name); | 485 StoreNamedParameters parameters(language_mode, name); |
487 return new (zone()) Operator1<StoreNamedParameters>( // -- | 486 return new (zone()) Operator1<StoreNamedParameters>( // -- |
488 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode | 487 IrOpcode::kJSStoreNamed, Operator::kNoProperties, // opcode |
489 "JSStoreNamed", // name | 488 "JSStoreNamed", // name |
(...skipping 29 matching lines...) Expand all Loading... |
519 IrOpcode::kJSStoreContext, // opcode | 518 IrOpcode::kJSStoreContext, // opcode |
520 Operator::kNoRead | Operator::kNoThrow, // flags | 519 Operator::kNoRead | Operator::kNoThrow, // flags |
521 "JSStoreContext", // name | 520 "JSStoreContext", // name |
522 2, 1, 1, 0, 1, 0, // counts | 521 2, 1, 1, 0, 1, 0, // counts |
523 access); // parameter | 522 access); // parameter |
524 } | 523 } |
525 | 524 |
526 | 525 |
527 const Operator* JSOperatorBuilder::LoadDynamicGlobal( | 526 const Operator* JSOperatorBuilder::LoadDynamicGlobal( |
528 const Handle<String>& name, uint32_t check_bitset, | 527 const Handle<String>& name, uint32_t check_bitset, |
529 const VectorSlotPair& feedback, ContextualMode mode) { | 528 const ResolvedFeedbackSlot& feedback, ContextualMode mode) { |
530 DynamicGlobalAccess access(name, check_bitset, feedback, mode); | 529 DynamicGlobalAccess access(name, check_bitset, feedback, mode); |
531 return new (zone()) Operator1<DynamicGlobalAccess>( // -- | 530 return new (zone()) Operator1<DynamicGlobalAccess>( // -- |
532 IrOpcode::kJSLoadDynamicGlobal, Operator::kNoProperties, // opcode | 531 IrOpcode::kJSLoadDynamicGlobal, Operator::kNoProperties, // opcode |
533 "JSLoadDynamicGlobal", // name | 532 "JSLoadDynamicGlobal", // name |
534 1, 1, 1, 1, 1, 2, // counts | 533 2, 1, 1, 1, 1, 2, // counts |
535 access); // parameter | 534 access); // parameter |
536 } | 535 } |
537 | 536 |
538 | 537 |
539 const Operator* JSOperatorBuilder::LoadDynamicContext( | 538 const Operator* JSOperatorBuilder::LoadDynamicContext( |
540 const Handle<String>& name, uint32_t check_bitset, size_t depth, | 539 const Handle<String>& name, uint32_t check_bitset, size_t depth, |
541 size_t index) { | 540 size_t index) { |
542 ContextAccess context_access(depth, index, false); | 541 ContextAccess context_access(depth, index, false); |
543 DynamicContextAccess access(name, check_bitset, context_access); | 542 DynamicContextAccess access(name, check_bitset, context_access); |
544 return new (zone()) Operator1<DynamicContextAccess>( // -- | 543 return new (zone()) Operator1<DynamicContextAccess>( // -- |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 return new (zone()) Operator1<Unique<String>>( // -- | 582 return new (zone()) Operator1<Unique<String>>( // -- |
584 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode | 583 IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode |
585 "JSCreateCatchContext", // name | 584 "JSCreateCatchContext", // name |
586 2, 1, 1, 1, 1, 2, // counts | 585 2, 1, 1, 1, 1, 2, // counts |
587 name); // parameter | 586 name); // parameter |
588 } | 587 } |
589 | 588 |
590 } // namespace compiler | 589 } // namespace compiler |
591 } // namespace internal | 590 } // namespace internal |
592 } // namespace v8 | 591 } // namespace v8 |
OLD | NEW |