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

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

Issue 256873007: Revert r20974: Unify and simplify the FastCloneShallowArrayStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_;
304 303
305 Address deoptimization_handler_; 304 Address deoptimization_handler_;
306 HandlerArgumentsMode handler_arguments_mode_; 305 HandlerArgumentsMode handler_arguments_mode_;
307 306
308 bool initialized() const { return register_param_count_ >= 0; } 307 bool initialized() const { return register_param_count_ >= 0; }
309 308
310 int environment_length() const { 309 int environment_length() const {
311 return register_param_count_; 310 return register_param_count_;
312 } 311 }
313 312
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 static const int kFunction = 0; 597 static const int kFunction = 0;
599 598
600 private: 599 private:
601 int slots_; 600 int slots_;
602 }; 601 };
603 602
604 603
605 class FastCloneShallowArrayStub : public HydrogenCodeStub { 604 class FastCloneShallowArrayStub : public HydrogenCodeStub {
606 public: 605 public:
607 // Maximum length of copied elements array. 606 // Maximum length of copied elements array.
608 static const int kMaximumInlinedCloneLength = 8; 607 static const int kMaximumClonedLength = 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;
609 617
610 FastCloneShallowArrayStub(Isolate* isolate, 618 FastCloneShallowArrayStub(Isolate* isolate,
611 AllocationSiteMode allocation_site_mode) 619 Mode mode,
620 AllocationSiteMode allocation_site_mode,
621 int length)
612 : HydrogenCodeStub(isolate), 622 : HydrogenCodeStub(isolate),
613 allocation_site_mode_(allocation_site_mode) {} 623 mode_(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 }
614 629
630 Mode mode() const { return mode_; }
631 int length() const { return length_; }
615 AllocationSiteMode allocation_site_mode() const { 632 AllocationSiteMode allocation_site_mode() const {
616 return allocation_site_mode_; 633 return allocation_site_mode_;
617 } 634 }
618 635
619 virtual Handle<Code> GenerateCode(); 636 ElementsKind ComputeElementsKind() const {
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;
620 651
621 virtual void InitializeInterfaceDescriptor( 652 virtual void InitializeInterfaceDescriptor(
622 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 653 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
623 654
624 static void InstallDescriptors(Isolate* isolate); 655 static void InstallDescriptors(Isolate* isolate);
625 656
626 private: 657 private:
658 Mode mode_;
627 AllocationSiteMode allocation_site_mode_; 659 AllocationSiteMode allocation_site_mode_;
660 int length_;
628 661
629 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; 662 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
663 class ModeBits: public BitField<Mode, 1, 4> {};
664 class LengthBits: public BitField<int, 5, 4> {};
630 // Ensure data fits within available bits. 665 // Ensure data fits within available bits.
666 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1);
667 STATIC_ASSERT(kFastCloneModeCount < 16);
668 STATIC_ASSERT(kMaximumClonedLength < 16);
631 Major MajorKey() { return FastCloneShallowArray; } 669 Major MajorKey() { return FastCloneShallowArray; }
632 int NotMissMinorKey() { 670 int NotMissMinorKey() {
633 return AllocationSiteModeBits::encode(allocation_site_mode_); 671 return AllocationSiteModeBits::encode(allocation_site_mode_)
672 | ModeBits::encode(mode_)
673 | LengthBits::encode(length_);
634 } 674 }
635 }; 675 };
636 676
637 677
638 class FastCloneShallowObjectStub : public HydrogenCodeStub { 678 class FastCloneShallowObjectStub : public HydrogenCodeStub {
639 public: 679 public:
640 // Maximum number of properties in copied object. 680 // Maximum number of properties in copied object.
641 static const int kMaximumClonedProperties = 6; 681 static const int kMaximumClonedProperties = 6;
642 682
643 FastCloneShallowObjectStub(Isolate* isolate, int length) 683 FastCloneShallowObjectStub(Isolate* isolate, int length)
(...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 2529
2490 2530
2491 class CallDescriptors { 2531 class CallDescriptors {
2492 public: 2532 public:
2493 static void InitializeForIsolate(Isolate* isolate); 2533 static void InitializeForIsolate(Isolate* isolate);
2494 }; 2534 };
2495 2535
2496 } } // namespace v8::internal 2536 } } // namespace v8::internal
2497 2537
2498 #endif // V8_CODE_STUBS_H_ 2538 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698