OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 static const int kNumber = 0; | 508 static const int kNumber = 0; |
509 | 509 |
510 private: | 510 private: |
511 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } | 511 virtual Major MajorKey() V8_OVERRIDE { return NumberToString; } |
512 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } | 512 virtual int NotMissMinorKey() V8_OVERRIDE { return 0; } |
513 }; | 513 }; |
514 | 514 |
515 | 515 |
516 class FastNewClosureStub : public HydrogenCodeStub { | 516 class FastNewClosureStub : public HydrogenCodeStub { |
517 public: | 517 public: |
518 explicit FastNewClosureStub(LanguageMode language_mode, bool is_generator) | 518 explicit FastNewClosureStub(StrictMode strict_mode, bool is_generator) |
519 : language_mode_(language_mode), | 519 : strict_mode_(strict_mode), |
520 is_generator_(is_generator) { } | 520 is_generator_(is_generator) { } |
521 | 521 |
522 virtual Handle<Code> GenerateCode(Isolate* isolate); | 522 virtual Handle<Code> GenerateCode(Isolate* isolate); |
523 | 523 |
524 virtual void InitializeInterfaceDescriptor( | 524 virtual void InitializeInterfaceDescriptor( |
525 Isolate* isolate, | 525 Isolate* isolate, |
526 CodeStubInterfaceDescriptor* descriptor); | 526 CodeStubInterfaceDescriptor* descriptor); |
527 | 527 |
528 static void InstallDescriptors(Isolate* isolate); | 528 static void InstallDescriptors(Isolate* isolate); |
529 | 529 |
530 LanguageMode language_mode() const { return language_mode_; } | 530 StrictMode strict_mode() const { return strict_mode_; } |
531 bool is_generator() const { return is_generator_; } | 531 bool is_generator() const { return is_generator_; } |
532 | 532 |
533 private: | 533 private: |
534 class StrictModeBits: public BitField<bool, 0, 1> {}; | 534 class StrictModeBits: public BitField<bool, 0, 1> {}; |
535 class IsGeneratorBits: public BitField<bool, 1, 1> {}; | 535 class IsGeneratorBits: public BitField<bool, 1, 1> {}; |
536 | 536 |
537 Major MajorKey() { return FastNewClosure; } | 537 Major MajorKey() { return FastNewClosure; } |
538 int NotMissMinorKey() { | 538 int NotMissMinorKey() { |
539 return StrictModeBits::encode(language_mode_ != SLOPPY_MODE) | | 539 return StrictModeBits::encode(strict_mode_ == STRICT) | |
540 IsGeneratorBits::encode(is_generator_); | 540 IsGeneratorBits::encode(is_generator_); |
541 } | 541 } |
542 | 542 |
543 LanguageMode language_mode_; | 543 StrictMode strict_mode_; |
544 bool is_generator_; | 544 bool is_generator_; |
545 }; | 545 }; |
546 | 546 |
547 | 547 |
548 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { | 548 class FastNewContextStub V8_FINAL : public HydrogenCodeStub { |
549 public: | 549 public: |
550 static const int kMaximumSlots = 64; | 550 static const int kMaximumSlots = 64; |
551 | 551 |
552 explicit FastNewContextStub(int slots) : slots_(slots) { | 552 explicit FastNewContextStub(int slots) : slots_(slots) { |
553 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); | 553 ASSERT(slots_ > 0 && slots_ <= kMaximumSlots); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 | LengthBits::encode(length_); | 643 | LengthBits::encode(length_); |
644 } | 644 } |
645 }; | 645 }; |
646 | 646 |
647 | 647 |
648 class FastCloneShallowObjectStub : public HydrogenCodeStub { | 648 class FastCloneShallowObjectStub : public HydrogenCodeStub { |
649 public: | 649 public: |
650 // Maximum number of properties in copied object. | 650 // Maximum number of properties in copied object. |
651 static const int kMaximumClonedProperties = 6; | 651 static const int kMaximumClonedProperties = 6; |
652 | 652 |
653 explicit FastCloneShallowObjectStub(int length) | 653 explicit FastCloneShallowObjectStub(int length) : length_(length) { |
654 : length_(length) { | |
655 ASSERT_GE(length_, 0); | 654 ASSERT_GE(length_, 0); |
656 ASSERT_LE(length_, kMaximumClonedProperties); | 655 ASSERT_LE(length_, kMaximumClonedProperties); |
657 } | 656 } |
658 | 657 |
659 int length() const { return length_; } | 658 int length() const { return length_; } |
660 | 659 |
661 virtual Handle<Code> GenerateCode(Isolate* isolate); | 660 virtual Handle<Code> GenerateCode(Isolate* isolate); |
662 | 661 |
663 virtual void InitializeInterfaceDescriptor( | 662 virtual void InitializeInterfaceDescriptor( |
664 Isolate* isolate, | 663 Isolate* isolate, |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 virtual void Generate(MacroAssembler* masm); | 830 virtual void Generate(MacroAssembler* masm); |
832 | 831 |
833 private: | 832 private: |
834 STATIC_ASSERT(KindBits::kSize == 4); | 833 STATIC_ASSERT(KindBits::kSize == 4); |
835 virtual CodeStub::Major MajorKey() { return StringLength; } | 834 virtual CodeStub::Major MajorKey() { return StringLength; } |
836 }; | 835 }; |
837 | 836 |
838 | 837 |
839 class StoreICStub: public ICStub { | 838 class StoreICStub: public ICStub { |
840 public: | 839 public: |
841 StoreICStub(Code::Kind kind, StrictModeFlag strict_mode) | 840 StoreICStub(Code::Kind kind, StrictMode strict_mode) |
842 : ICStub(kind), strict_mode_(strict_mode) { } | 841 : ICStub(kind), strict_mode_(strict_mode) { } |
843 | 842 |
844 protected: | 843 protected: |
845 virtual ExtraICState GetExtraICState() { | 844 virtual ExtraICState GetExtraICState() { |
846 return StoreIC::ComputeExtraICState(strict_mode_); | 845 return StoreIC::ComputeExtraICState(strict_mode_); |
847 } | 846 } |
848 | 847 |
849 private: | 848 private: |
850 STATIC_ASSERT(KindBits::kSize == 4); | 849 STATIC_ASSERT(KindBits::kSize == 4); |
851 class StrictModeBits: public BitField<bool, 4, 1> {}; | 850 class StrictModeBits: public BitField<bool, 4, 1> {}; |
852 virtual int MinorKey() { | 851 virtual int MinorKey() { |
853 return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); | 852 return KindBits::encode(kind()) | StrictModeBits::encode(strict_mode_); |
854 } | 853 } |
855 | 854 |
856 StrictModeFlag strict_mode_; | 855 StrictMode strict_mode_; |
857 }; | 856 }; |
858 | 857 |
859 | 858 |
860 class StoreArrayLengthStub: public StoreICStub { | 859 class StoreArrayLengthStub: public StoreICStub { |
861 public: | 860 public: |
862 explicit StoreArrayLengthStub(Code::Kind kind, StrictModeFlag strict_mode) | 861 explicit StoreArrayLengthStub(Code::Kind kind, StrictMode strict_mode) |
863 : StoreICStub(kind, strict_mode) { } | 862 : StoreICStub(kind, strict_mode) { } |
864 virtual void Generate(MacroAssembler* masm); | 863 virtual void Generate(MacroAssembler* masm); |
865 | 864 |
866 private: | 865 private: |
867 virtual CodeStub::Major MajorKey() { return StoreArrayLength; } | 866 virtual CodeStub::Major MajorKey() { return StoreArrayLength; } |
868 }; | 867 }; |
869 | 868 |
870 | 869 |
871 class HICStub: public HydrogenCodeStub { | 870 class HICStub: public HydrogenCodeStub { |
872 public: | 871 public: |
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 | 2480 |
2482 | 2481 |
2483 class CallDescriptors { | 2482 class CallDescriptors { |
2484 public: | 2483 public: |
2485 static void InitializeForIsolate(Isolate* isolate); | 2484 static void InitializeForIsolate(Isolate* isolate); |
2486 }; | 2485 }; |
2487 | 2486 |
2488 } } // namespace v8::internal | 2487 } } // namespace v8::internal |
2489 | 2488 |
2490 #endif // V8_CODE_STUBS_H_ | 2489 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |