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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 struct CodeStubInterfaceDescriptor { | 293 struct CodeStubInterfaceDescriptor { |
294 CodeStubInterfaceDescriptor(); | 294 CodeStubInterfaceDescriptor(); |
295 int register_param_count_; | 295 int register_param_count_; |
296 | 296 |
297 Register stack_parameter_count_; | 297 Register stack_parameter_count_; |
298 // if hint_stack_parameter_count_ > 0, the code stub can optimize the | 298 // if hint_stack_parameter_count_ > 0, the code stub can optimize the |
299 // return sequence. Default value is -1, which means it is ignored. | 299 // return sequence. Default value is -1, which means it is ignored. |
300 int hint_stack_parameter_count_; | 300 int hint_stack_parameter_count_; |
301 StubFunctionMode function_mode_; | 301 StubFunctionMode function_mode_; |
302 Register* register_params_; | 302 Register* register_params_; |
| 303 Representation* register_param_representations_; |
303 | 304 |
304 Address deoptimization_handler_; | 305 Address deoptimization_handler_; |
305 HandlerArgumentsMode handler_arguments_mode_; | 306 HandlerArgumentsMode handler_arguments_mode_; |
306 | 307 |
307 bool initialized() const { return register_param_count_ >= 0; } | 308 bool initialized() const { return register_param_count_ >= 0; } |
308 | 309 |
309 int environment_length() const { | 310 int environment_length() const { |
310 return register_param_count_; | 311 return register_param_count_; |
311 } | 312 } |
312 | 313 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 static const int kFunction = 0; | 598 static const int kFunction = 0; |
598 | 599 |
599 private: | 600 private: |
600 int slots_; | 601 int slots_; |
601 }; | 602 }; |
602 | 603 |
603 | 604 |
604 class FastCloneShallowArrayStub : public HydrogenCodeStub { | 605 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
605 public: | 606 public: |
606 // Maximum length of copied elements array. | 607 // Maximum length of copied elements array. |
607 static const int kMaximumClonedLength = 8; | 608 static const int kMaximumInlinedCloneLength = 8; |
608 enum Mode { | |
609 CLONE_ELEMENTS, | |
610 CLONE_DOUBLE_ELEMENTS, | |
611 COPY_ON_WRITE_ELEMENTS, | |
612 CLONE_ANY_ELEMENTS, | |
613 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS | |
614 }; | |
615 | |
616 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; | |
617 | 609 |
618 FastCloneShallowArrayStub(Isolate* isolate, | 610 FastCloneShallowArrayStub(Isolate* isolate, |
619 Mode mode, | 611 AllocationSiteMode allocation_site_mode) |
620 AllocationSiteMode allocation_site_mode, | |
621 int length) | |
622 : HydrogenCodeStub(isolate), | 612 : HydrogenCodeStub(isolate), |
623 mode_(mode), | 613 allocation_site_mode_(allocation_site_mode) {} |
624 allocation_site_mode_(allocation_site_mode), | |
625 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | |
626 ASSERT_GE(length_, 0); | |
627 ASSERT_LE(length_, kMaximumClonedLength); | |
628 } | |
629 | 614 |
630 Mode mode() const { return mode_; } | |
631 int length() const { return length_; } | |
632 AllocationSiteMode allocation_site_mode() const { | 615 AllocationSiteMode allocation_site_mode() const { |
633 return allocation_site_mode_; | 616 return allocation_site_mode_; |
634 } | 617 } |
635 | 618 |
636 ElementsKind ComputeElementsKind() const { | 619 virtual Handle<Code> GenerateCode(); |
637 switch (mode()) { | |
638 case CLONE_ELEMENTS: | |
639 case COPY_ON_WRITE_ELEMENTS: | |
640 return FAST_ELEMENTS; | |
641 case CLONE_DOUBLE_ELEMENTS: | |
642 return FAST_DOUBLE_ELEMENTS; | |
643 case CLONE_ANY_ELEMENTS: | |
644 /*fall-through*/; | |
645 } | |
646 UNREACHABLE(); | |
647 return LAST_ELEMENTS_KIND; | |
648 } | |
649 | |
650 virtual Handle<Code> GenerateCode() V8_OVERRIDE; | |
651 | 620 |
652 virtual void InitializeInterfaceDescriptor( | 621 virtual void InitializeInterfaceDescriptor( |
653 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; | 622 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; |
654 | 623 |
655 static void InstallDescriptors(Isolate* isolate); | 624 static void InstallDescriptors(Isolate* isolate); |
656 | 625 |
657 private: | 626 private: |
658 Mode mode_; | |
659 AllocationSiteMode allocation_site_mode_; | 627 AllocationSiteMode allocation_site_mode_; |
660 int length_; | |
661 | 628 |
662 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 629 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
663 class ModeBits: public BitField<Mode, 1, 4> {}; | |
664 class LengthBits: public BitField<int, 5, 4> {}; | |
665 // Ensure data fits within available bits. | 630 // Ensure data fits within available bits. |
666 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1); | |
667 STATIC_ASSERT(kFastCloneModeCount < 16); | |
668 STATIC_ASSERT(kMaximumClonedLength < 16); | |
669 Major MajorKey() { return FastCloneShallowArray; } | 631 Major MajorKey() { return FastCloneShallowArray; } |
670 int NotMissMinorKey() { | 632 int NotMissMinorKey() { |
671 return AllocationSiteModeBits::encode(allocation_site_mode_) | 633 return AllocationSiteModeBits::encode(allocation_site_mode_); |
672 | ModeBits::encode(mode_) | |
673 | LengthBits::encode(length_); | |
674 } | 634 } |
675 }; | 635 }; |
676 | 636 |
677 | 637 |
678 class FastCloneShallowObjectStub : public HydrogenCodeStub { | 638 class FastCloneShallowObjectStub : public HydrogenCodeStub { |
679 public: | 639 public: |
680 // Maximum number of properties in copied object. | 640 // Maximum number of properties in copied object. |
681 static const int kMaximumClonedProperties = 6; | 641 static const int kMaximumClonedProperties = 6; |
682 | 642 |
683 FastCloneShallowObjectStub(Isolate* isolate, int length) | 643 FastCloneShallowObjectStub(Isolate* isolate, int length) |
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2529 | 2489 |
2530 | 2490 |
2531 class CallDescriptors { | 2491 class CallDescriptors { |
2532 public: | 2492 public: |
2533 static void InitializeForIsolate(Isolate* isolate); | 2493 static void InitializeForIsolate(Isolate* isolate); |
2534 }; | 2494 }; |
2535 | 2495 |
2536 } } // namespace v8::internal | 2496 } } // namespace v8::internal |
2537 | 2497 |
2538 #endif // V8_CODE_STUBS_H_ | 2498 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |