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

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

Issue 272513004: Reland r20974: Unify and simplify the FastCloneShallowArrayStub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "allocation.h" 8 #include "allocation.h"
9 #include "assembler.h" 9 #include "assembler.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 struct CodeStubInterfaceDescriptor { 271 struct CodeStubInterfaceDescriptor {
272 CodeStubInterfaceDescriptor(); 272 CodeStubInterfaceDescriptor();
273 int register_param_count_; 273 int register_param_count_;
274 274
275 Register stack_parameter_count_; 275 Register stack_parameter_count_;
276 // if hint_stack_parameter_count_ > 0, the code stub can optimize the 276 // if hint_stack_parameter_count_ > 0, the code stub can optimize the
277 // return sequence. Default value is -1, which means it is ignored. 277 // return sequence. Default value is -1, which means it is ignored.
278 int hint_stack_parameter_count_; 278 int hint_stack_parameter_count_;
279 StubFunctionMode function_mode_; 279 StubFunctionMode function_mode_;
280 Register* register_params_; 280 Register* register_params_;
281 Representation* register_param_representations_;
mvstanton 2014/05/09 13:16:49 Could you add a comment that the default Represent
danno 2014/05/09 15:51:25 Done.
281 282
282 Address deoptimization_handler_; 283 Address deoptimization_handler_;
283 HandlerArgumentsMode handler_arguments_mode_; 284 HandlerArgumentsMode handler_arguments_mode_;
284 285
285 bool initialized() const { return register_param_count_ >= 0; } 286 bool initialized() const { return register_param_count_ >= 0; }
286 287
287 int environment_length() const { 288 int environment_length() const {
288 return register_param_count_; 289 return register_param_count_;
289 } 290 }
290 291
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 static const int kFunction = 0; 576 static const int kFunction = 0;
576 577
577 private: 578 private:
578 int slots_; 579 int slots_;
579 }; 580 };
580 581
581 582
582 class FastCloneShallowArrayStub : public HydrogenCodeStub { 583 class FastCloneShallowArrayStub : public HydrogenCodeStub {
583 public: 584 public:
584 // Maximum length of copied elements array. 585 // Maximum length of copied elements array.
585 static const int kMaximumClonedLength = 8; 586 static const int kMaximumInlinedCloneLength = 8;
586 enum Mode {
587 CLONE_ELEMENTS,
588 CLONE_DOUBLE_ELEMENTS,
589 COPY_ON_WRITE_ELEMENTS,
590 CLONE_ANY_ELEMENTS,
591 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS
592 };
593
594 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1;
595 587
596 FastCloneShallowArrayStub(Isolate* isolate, 588 FastCloneShallowArrayStub(Isolate* isolate,
597 Mode mode, 589 AllocationSiteMode allocation_site_mode)
598 AllocationSiteMode allocation_site_mode,
599 int length)
600 : HydrogenCodeStub(isolate), 590 : HydrogenCodeStub(isolate),
601 mode_(mode), 591 allocation_site_mode_(allocation_site_mode) {}
602 allocation_site_mode_(allocation_site_mode),
603 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) {
604 ASSERT_GE(length_, 0);
605 ASSERT_LE(length_, kMaximumClonedLength);
606 }
607 592
608 Mode mode() const { return mode_; }
609 int length() const { return length_; }
610 AllocationSiteMode allocation_site_mode() const { 593 AllocationSiteMode allocation_site_mode() const {
611 return allocation_site_mode_; 594 return allocation_site_mode_;
612 } 595 }
613 596
614 ElementsKind ComputeElementsKind() const { 597 virtual Handle<Code> GenerateCode();
615 switch (mode()) {
616 case CLONE_ELEMENTS:
617 case COPY_ON_WRITE_ELEMENTS:
618 return FAST_ELEMENTS;
619 case CLONE_DOUBLE_ELEMENTS:
620 return FAST_DOUBLE_ELEMENTS;
621 case CLONE_ANY_ELEMENTS:
622 /*fall-through*/;
623 }
624 UNREACHABLE();
625 return LAST_ELEMENTS_KIND;
626 }
627
628 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
629 598
630 virtual void InitializeInterfaceDescriptor( 599 virtual void InitializeInterfaceDescriptor(
631 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 600 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
632 601
633 static void InstallDescriptors(Isolate* isolate); 602 static void InstallDescriptors(Isolate* isolate);
634 603
635 private: 604 private:
636 Mode mode_;
637 AllocationSiteMode allocation_site_mode_; 605 AllocationSiteMode allocation_site_mode_;
638 int length_;
639 606
640 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; 607 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
641 class ModeBits: public BitField<Mode, 1, 4> {};
642 class LengthBits: public BitField<int, 5, 4> {};
643 // Ensure data fits within available bits. 608 // Ensure data fits within available bits.
644 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1);
645 STATIC_ASSERT(kFastCloneModeCount < 16);
646 STATIC_ASSERT(kMaximumClonedLength < 16);
647 Major MajorKey() { return FastCloneShallowArray; } 609 Major MajorKey() { return FastCloneShallowArray; }
648 int NotMissMinorKey() { 610 int NotMissMinorKey() {
649 return AllocationSiteModeBits::encode(allocation_site_mode_) 611 return AllocationSiteModeBits::encode(allocation_site_mode_);
650 | ModeBits::encode(mode_)
651 | LengthBits::encode(length_);
652 } 612 }
653 }; 613 };
654 614
655 615
656 class FastCloneShallowObjectStub : public HydrogenCodeStub { 616 class FastCloneShallowObjectStub : public HydrogenCodeStub {
657 public: 617 public:
658 // Maximum number of properties in copied object. 618 // Maximum number of properties in copied object.
659 static const int kMaximumClonedProperties = 6; 619 static const int kMaximumClonedProperties = 6;
660 620
661 FastCloneShallowObjectStub(Isolate* isolate, int length) 621 FastCloneShallowObjectStub(Isolate* isolate, int length)
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 2498
2539 2499
2540 class CallDescriptors { 2500 class CallDescriptors {
2541 public: 2501 public:
2542 static void InitializeForIsolate(Isolate* isolate); 2502 static void InitializeForIsolate(Isolate* isolate);
2543 }; 2503 };
2544 2504
2545 } } // namespace v8::internal 2505 } } // namespace v8::internal
2546 2506
2547 #endif // V8_CODE_STUBS_H_ 2507 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/code-stubs.cc » ('j') | src/code-stubs-hydrogen.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698