Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: src/code-stubs.h

Issue 257563004: Unify and simplify the FastCloneShallowArrayStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix arm64 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 struct CodeStubInterfaceDescriptor { 287 struct CodeStubInterfaceDescriptor {
288 CodeStubInterfaceDescriptor(); 288 CodeStubInterfaceDescriptor();
289 int register_param_count_; 289 int register_param_count_;
290 290
291 Register stack_parameter_count_; 291 Register stack_parameter_count_;
292 // if hint_stack_parameter_count_ > 0, the code stub can optimize the 292 // if hint_stack_parameter_count_ > 0, the code stub can optimize the
293 // return sequence. Default value is -1, which means it is ignored. 293 // return sequence. Default value is -1, which means it is ignored.
294 int hint_stack_parameter_count_; 294 int hint_stack_parameter_count_;
295 StubFunctionMode function_mode_; 295 StubFunctionMode function_mode_;
296 Register* register_params_; 296 Register* register_params_;
297 Representation* register_param_representations_;
297 298
298 Address deoptimization_handler_; 299 Address deoptimization_handler_;
299 HandlerArgumentsMode handler_arguments_mode_; 300 HandlerArgumentsMode handler_arguments_mode_;
300 301
301 bool initialized() const { return register_param_count_ >= 0; } 302 bool initialized() const { return register_param_count_ >= 0; }
302 303
303 int environment_length() const { 304 int environment_length() const {
304 return register_param_count_; 305 return register_param_count_;
305 } 306 }
306 307
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 static const int kFunction = 0; 593 static const int kFunction = 0;
593 594
594 private: 595 private:
595 int slots_; 596 int slots_;
596 }; 597 };
597 598
598 599
599 class FastCloneShallowArrayStub : public HydrogenCodeStub { 600 class FastCloneShallowArrayStub : public HydrogenCodeStub {
600 public: 601 public:
601 // Maximum length of copied elements array. 602 // Maximum length of copied elements array.
602 static const int kMaximumClonedLength = 8; 603 static const int kMaximumInlinedCloneLength = 8;
603 enum Mode {
604 CLONE_ELEMENTS,
605 CLONE_DOUBLE_ELEMENTS,
606 COPY_ON_WRITE_ELEMENTS,
607 CLONE_ANY_ELEMENTS,
608 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS
609 };
610 604
611 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; 605 explicit FastCloneShallowArrayStub(
606 AllocationSiteMode allocation_site_mode)
607 : allocation_site_mode_(allocation_site_mode) {}
612 608
613 FastCloneShallowArrayStub(Mode mode,
614 AllocationSiteMode allocation_site_mode,
615 int length)
616 : mode_(mode),
617 allocation_site_mode_(allocation_site_mode),
618 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) {
619 ASSERT_GE(length_, 0);
620 ASSERT_LE(length_, kMaximumClonedLength);
621 }
622
623 Mode mode() const { return mode_; }
624 int length() const { return length_; }
625 AllocationSiteMode allocation_site_mode() const { 609 AllocationSiteMode allocation_site_mode() const {
626 return allocation_site_mode_; 610 return allocation_site_mode_;
627 } 611 }
628 612
629 ElementsKind ComputeElementsKind() const {
630 switch (mode()) {
631 case CLONE_ELEMENTS:
632 case COPY_ON_WRITE_ELEMENTS:
633 return FAST_ELEMENTS;
634 case CLONE_DOUBLE_ELEMENTS:
635 return FAST_DOUBLE_ELEMENTS;
636 case CLONE_ANY_ELEMENTS:
637 /*fall-through*/;
638 }
639 UNREACHABLE();
640 return LAST_ELEMENTS_KIND;
641 }
642
643 virtual Handle<Code> GenerateCode(Isolate* isolate); 613 virtual Handle<Code> GenerateCode(Isolate* isolate);
644 614
645 virtual void InitializeInterfaceDescriptor( 615 virtual void InitializeInterfaceDescriptor(
646 Isolate* isolate, 616 Isolate* isolate,
647 CodeStubInterfaceDescriptor* descriptor); 617 CodeStubInterfaceDescriptor* descriptor);
648 618
649 static void InstallDescriptors(Isolate* isolate); 619 static void InstallDescriptors(Isolate* isolate);
650 620
651 private: 621 private:
652 Mode mode_;
653 AllocationSiteMode allocation_site_mode_; 622 AllocationSiteMode allocation_site_mode_;
654 int length_;
655 623
656 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; 624 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
657 class ModeBits: public BitField<Mode, 1, 4> {};
658 class LengthBits: public BitField<int, 5, 4> {};
659 // Ensure data fits within available bits. 625 // Ensure data fits within available bits.
660 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1);
661 STATIC_ASSERT(kFastCloneModeCount < 16);
662 STATIC_ASSERT(kMaximumClonedLength < 16);
663 Major MajorKey() { return FastCloneShallowArray; } 626 Major MajorKey() { return FastCloneShallowArray; }
664 int NotMissMinorKey() { 627 int NotMissMinorKey() {
665 return AllocationSiteModeBits::encode(allocation_site_mode_) 628 return AllocationSiteModeBits::encode(allocation_site_mode_);
666 | ModeBits::encode(mode_)
667 | LengthBits::encode(length_);
668 } 629 }
669 }; 630 };
670 631
671 632
672 class FastCloneShallowObjectStub : public HydrogenCodeStub { 633 class FastCloneShallowObjectStub : public HydrogenCodeStub {
673 public: 634 public:
674 // Maximum number of properties in copied object. 635 // Maximum number of properties in copied object.
675 static const int kMaximumClonedProperties = 6; 636 static const int kMaximumClonedProperties = 6;
676 637
677 explicit FastCloneShallowObjectStub(int length) : length_(length) { 638 explicit FastCloneShallowObjectStub(int length) : length_(length) {
(...skipping 1815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 2454
2494 2455
2495 class CallDescriptors { 2456 class CallDescriptors {
2496 public: 2457 public:
2497 static void InitializeForIsolate(Isolate* isolate); 2458 static void InitializeForIsolate(Isolate* isolate);
2498 }; 2459 };
2499 2460
2500 } } // namespace v8::internal 2461 } } // namespace v8::internal
2501 2462
2502 #endif // V8_CODE_STUBS_H_ 2463 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/code-stubs.cc » ('j') | src/hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698