| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { | 262 const LoadNamedParameters& LoadNamedParametersOf(const Operator* op) { |
| 263 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); | 263 DCHECK_EQ(IrOpcode::kJSLoadNamed, op->opcode()); |
| 264 return OpParameter<LoadNamedParameters>(op); | 264 return OpParameter<LoadNamedParameters>(op); |
| 265 } | 265 } |
| 266 | 266 |
| 267 | 267 |
| 268 bool operator==(LoadGlobalParameters const& lhs, | 268 bool operator==(LoadGlobalParameters const& lhs, |
| 269 LoadGlobalParameters const& rhs) { | 269 LoadGlobalParameters const& rhs) { |
| 270 return lhs.name().location() == rhs.name().location() && | 270 return lhs.name().location() == rhs.name().location() && |
| 271 lhs.feedback() == rhs.feedback() && | 271 lhs.feedback() == rhs.feedback() && |
| 272 lhs.typeof_mode() == rhs.typeof_mode() && | 272 lhs.typeof_mode() == rhs.typeof_mode(); |
| 273 lhs.slot_index() == rhs.slot_index(); | |
| 274 } | 273 } |
| 275 | 274 |
| 276 | 275 |
| 277 bool operator!=(LoadGlobalParameters const& lhs, | 276 bool operator!=(LoadGlobalParameters const& lhs, |
| 278 LoadGlobalParameters const& rhs) { | 277 LoadGlobalParameters const& rhs) { |
| 279 return !(lhs == rhs); | 278 return !(lhs == rhs); |
| 280 } | 279 } |
| 281 | 280 |
| 282 | 281 |
| 283 size_t hash_value(LoadGlobalParameters const& p) { | 282 size_t hash_value(LoadGlobalParameters const& p) { |
| 284 return base::hash_combine(p.name().location(), p.typeof_mode(), | 283 return base::hash_combine(p.name().location(), p.typeof_mode()); |
| 285 p.slot_index()); | |
| 286 } | 284 } |
| 287 | 285 |
| 288 | 286 |
| 289 std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) { | 287 std::ostream& operator<<(std::ostream& os, LoadGlobalParameters const& p) { |
| 290 return os << Brief(*p.name()) << ", " << p.typeof_mode() | 288 return os << Brief(*p.name()) << ", " << p.typeof_mode(); |
| 291 << ", slot: " << p.slot_index(); | |
| 292 } | 289 } |
| 293 | 290 |
| 294 | 291 |
| 295 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) { | 292 const LoadGlobalParameters& LoadGlobalParametersOf(const Operator* op) { |
| 296 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode()); | 293 DCHECK_EQ(IrOpcode::kJSLoadGlobal, op->opcode()); |
| 297 return OpParameter<LoadGlobalParameters>(op); | 294 return OpParameter<LoadGlobalParameters>(op); |
| 298 } | 295 } |
| 299 | 296 |
| 300 | 297 |
| 301 bool operator==(StoreGlobalParameters const& lhs, | 298 bool operator==(StoreGlobalParameters const& lhs, |
| 302 StoreGlobalParameters const& rhs) { | 299 StoreGlobalParameters const& rhs) { |
| 303 return lhs.language_mode() == rhs.language_mode() && | 300 return lhs.language_mode() == rhs.language_mode() && |
| 304 lhs.name().location() == rhs.name().location() && | 301 lhs.name().location() == rhs.name().location() && |
| 305 lhs.feedback() == rhs.feedback() && | 302 lhs.feedback() == rhs.feedback(); |
| 306 lhs.slot_index() == rhs.slot_index(); | |
| 307 } | 303 } |
| 308 | 304 |
| 309 | 305 |
| 310 bool operator!=(StoreGlobalParameters const& lhs, | 306 bool operator!=(StoreGlobalParameters const& lhs, |
| 311 StoreGlobalParameters const& rhs) { | 307 StoreGlobalParameters const& rhs) { |
| 312 return !(lhs == rhs); | 308 return !(lhs == rhs); |
| 313 } | 309 } |
| 314 | 310 |
| 315 | 311 |
| 316 size_t hash_value(StoreGlobalParameters const& p) { | 312 size_t hash_value(StoreGlobalParameters const& p) { |
| 317 return base::hash_combine(p.language_mode(), p.name().location(), | 313 return base::hash_combine(p.language_mode(), p.name().location(), |
| 318 p.feedback(), p.slot_index()); | 314 p.feedback()); |
| 319 } | 315 } |
| 320 | 316 |
| 321 | 317 |
| 322 std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) { | 318 std::ostream& operator<<(std::ostream& os, StoreGlobalParameters const& p) { |
| 323 return os << p.language_mode() << ", " << Brief(*p.name()) | 319 return os << p.language_mode() << ", " << Brief(*p.name()); |
| 324 << ", slot: " << p.slot_index(); | |
| 325 } | 320 } |
| 326 | 321 |
| 327 | 322 |
| 328 const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) { | 323 const StoreGlobalParameters& StoreGlobalParametersOf(const Operator* op) { |
| 329 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode()); | 324 DCHECK_EQ(IrOpcode::kJSStoreGlobal, op->opcode()); |
| 330 return OpParameter<StoreGlobalParameters>(op); | 325 return OpParameter<StoreGlobalParameters>(op); |
| 331 } | 326 } |
| 332 | 327 |
| 333 | 328 |
| 334 bool operator==(StoreNamedParameters const& lhs, | 329 bool operator==(StoreNamedParameters const& lhs, |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 return new (zone()) Operator1<LanguageMode>( // -- | 645 return new (zone()) Operator1<LanguageMode>( // -- |
| 651 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode | 646 IrOpcode::kJSDeleteProperty, Operator::kNoProperties, // opcode |
| 652 "JSDeleteProperty", // name | 647 "JSDeleteProperty", // name |
| 653 2, 1, 1, 1, 1, 2, // counts | 648 2, 1, 1, 1, 1, 2, // counts |
| 654 language_mode); // parameter | 649 language_mode); // parameter |
| 655 } | 650 } |
| 656 | 651 |
| 657 | 652 |
| 658 const Operator* JSOperatorBuilder::LoadGlobal(const Handle<Name>& name, | 653 const Operator* JSOperatorBuilder::LoadGlobal(const Handle<Name>& name, |
| 659 const VectorSlotPair& feedback, | 654 const VectorSlotPair& feedback, |
| 660 TypeofMode typeof_mode, | 655 TypeofMode typeof_mode) { |
| 661 int slot_index) { | 656 LoadGlobalParameters parameters(name, feedback, typeof_mode); |
| 662 LoadGlobalParameters parameters(name, feedback, typeof_mode, slot_index); | |
| 663 return new (zone()) Operator1<LoadGlobalParameters>( // -- | 657 return new (zone()) Operator1<LoadGlobalParameters>( // -- |
| 664 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode | 658 IrOpcode::kJSLoadGlobal, Operator::kNoProperties, // opcode |
| 665 "JSLoadGlobal", // name | 659 "JSLoadGlobal", // name |
| 666 3, 1, 1, 1, 1, 2, // counts | 660 1, 1, 1, 1, 1, 2, // counts |
| 667 parameters); // parameter | 661 parameters); // parameter |
| 668 } | 662 } |
| 669 | 663 |
| 670 | 664 |
| 671 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, | 665 const Operator* JSOperatorBuilder::StoreGlobal(LanguageMode language_mode, |
| 672 const Handle<Name>& name, | 666 const Handle<Name>& name, |
| 673 const VectorSlotPair& feedback, | 667 const VectorSlotPair& feedback) { |
| 674 int slot_index) { | 668 StoreGlobalParameters parameters(language_mode, feedback, name); |
| 675 StoreGlobalParameters parameters(language_mode, feedback, name, slot_index); | |
| 676 return new (zone()) Operator1<StoreGlobalParameters>( // -- | 669 return new (zone()) Operator1<StoreGlobalParameters>( // -- |
| 677 IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode | 670 IrOpcode::kJSStoreGlobal, Operator::kNoProperties, // opcode |
| 678 "JSStoreGlobal", // name | 671 "JSStoreGlobal", // name |
| 679 4, 1, 1, 0, 1, 2, // counts | 672 2, 1, 1, 0, 1, 2, // counts |
| 680 parameters); // parameter | 673 parameters); // parameter |
| 681 } | 674 } |
| 682 | 675 |
| 683 | 676 |
| 684 const Operator* JSOperatorBuilder::LoadContext(size_t depth, size_t index, | 677 const Operator* JSOperatorBuilder::LoadContext(size_t depth, size_t index, |
| 685 bool immutable) { | 678 bool immutable) { |
| 686 ContextAccess access(depth, index, immutable); | 679 ContextAccess access(depth, index, immutable); |
| 687 return new (zone()) Operator1<ContextAccess>( // -- | 680 return new (zone()) Operator1<ContextAccess>( // -- |
| 688 IrOpcode::kJSLoadContext, // opcode | 681 IrOpcode::kJSLoadContext, // opcode |
| 689 Operator::kNoWrite | Operator::kNoThrow, // flags | 682 Operator::kNoWrite | Operator::kNoThrow, // flags |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 Handle<ScopeInfo>::hash>( // -- | 800 Handle<ScopeInfo>::hash>( // -- |
| 808 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode | 801 IrOpcode::kJSCreateScriptContext, Operator::kNoProperties, // opcode |
| 809 "JSCreateScriptContext", // name | 802 "JSCreateScriptContext", // name |
| 810 1, 1, 1, 1, 1, 2, // counts | 803 1, 1, 1, 1, 1, 2, // counts |
| 811 scpope_info); // parameter | 804 scpope_info); // parameter |
| 812 } | 805 } |
| 813 | 806 |
| 814 } // namespace compiler | 807 } // namespace compiler |
| 815 } // namespace internal | 808 } // namespace internal |
| 816 } // namespace v8 | 809 } // namespace v8 |
| OLD | NEW |