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

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

Issue 272243002: Revert "Reland 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 // 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 struct CodeStubInterfaceDescriptor { 270 struct CodeStubInterfaceDescriptor {
271 CodeStubInterfaceDescriptor(); 271 CodeStubInterfaceDescriptor();
272 int register_param_count_; 272 int register_param_count_;
273 273
274 Register stack_parameter_count_; 274 Register stack_parameter_count_;
275 // if hint_stack_parameter_count_ > 0, the code stub can optimize the 275 // if hint_stack_parameter_count_ > 0, the code stub can optimize the
276 // return sequence. Default value is -1, which means it is ignored. 276 // return sequence. Default value is -1, which means it is ignored.
277 int hint_stack_parameter_count_; 277 int hint_stack_parameter_count_;
278 StubFunctionMode function_mode_; 278 StubFunctionMode function_mode_;
279 Register* register_params_; 279 Register* register_params_;
280 // Specifies Representations for the stub's parameter. Points to an array of
281 // Representations of the same length of the numbers of parameters to the
282 // stub, or if NULL (the default value), Representation of each parameter
283 // assumed to be Tagged()
284 Representation* register_param_representations_;
285 280
286 Address deoptimization_handler_; 281 Address deoptimization_handler_;
287 HandlerArgumentsMode handler_arguments_mode_; 282 HandlerArgumentsMode handler_arguments_mode_;
288 283
289 bool initialized() const { return register_param_count_ >= 0; } 284 bool initialized() const { return register_param_count_ >= 0; }
290 285
291 int environment_length() const { 286 int environment_length() const {
292 return register_param_count_; 287 return register_param_count_;
293 } 288 }
294 289
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 static const int kFunction = 0; 574 static const int kFunction = 0;
580 575
581 private: 576 private:
582 int slots_; 577 int slots_;
583 }; 578 };
584 579
585 580
586 class FastCloneShallowArrayStub : public HydrogenCodeStub { 581 class FastCloneShallowArrayStub : public HydrogenCodeStub {
587 public: 582 public:
588 // Maximum length of copied elements array. 583 // Maximum length of copied elements array.
589 static const int kMaximumInlinedCloneLength = 8; 584 static const int kMaximumClonedLength = 8;
585 enum Mode {
586 CLONE_ELEMENTS,
587 CLONE_DOUBLE_ELEMENTS,
588 COPY_ON_WRITE_ELEMENTS,
589 CLONE_ANY_ELEMENTS,
590 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS
591 };
592
593 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1;
590 594
591 FastCloneShallowArrayStub(Isolate* isolate, 595 FastCloneShallowArrayStub(Isolate* isolate,
592 AllocationSiteMode allocation_site_mode) 596 Mode mode,
597 AllocationSiteMode allocation_site_mode,
598 int length)
593 : HydrogenCodeStub(isolate), 599 : HydrogenCodeStub(isolate),
594 allocation_site_mode_(allocation_site_mode) {} 600 mode_(mode),
601 allocation_site_mode_(allocation_site_mode),
602 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) {
603 ASSERT_GE(length_, 0);
604 ASSERT_LE(length_, kMaximumClonedLength);
605 }
595 606
607 Mode mode() const { return mode_; }
608 int length() const { return length_; }
596 AllocationSiteMode allocation_site_mode() const { 609 AllocationSiteMode allocation_site_mode() const {
597 return allocation_site_mode_; 610 return allocation_site_mode_;
598 } 611 }
599 612
600 virtual Handle<Code> GenerateCode(); 613 ElementsKind ComputeElementsKind() const {
614 switch (mode()) {
615 case CLONE_ELEMENTS:
616 case COPY_ON_WRITE_ELEMENTS:
617 return FAST_ELEMENTS;
618 case CLONE_DOUBLE_ELEMENTS:
619 return FAST_DOUBLE_ELEMENTS;
620 case CLONE_ANY_ELEMENTS:
621 /*fall-through*/;
622 }
623 UNREACHABLE();
624 return LAST_ELEMENTS_KIND;
625 }
626
627 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
601 628
602 virtual void InitializeInterfaceDescriptor( 629 virtual void InitializeInterfaceDescriptor(
603 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 630 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
604 631
605 static void InstallDescriptors(Isolate* isolate); 632 static void InstallDescriptors(Isolate* isolate);
606 633
607 private: 634 private:
635 Mode mode_;
608 AllocationSiteMode allocation_site_mode_; 636 AllocationSiteMode allocation_site_mode_;
637 int length_;
609 638
610 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; 639 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {};
640 class ModeBits: public BitField<Mode, 1, 4> {};
641 class LengthBits: public BitField<int, 5, 4> {};
611 // Ensure data fits within available bits. 642 // Ensure data fits within available bits.
643 STATIC_ASSERT(LAST_ALLOCATION_SITE_MODE == 1);
644 STATIC_ASSERT(kFastCloneModeCount < 16);
645 STATIC_ASSERT(kMaximumClonedLength < 16);
612 Major MajorKey() { return FastCloneShallowArray; } 646 Major MajorKey() { return FastCloneShallowArray; }
613 int NotMissMinorKey() { 647 int NotMissMinorKey() {
614 return AllocationSiteModeBits::encode(allocation_site_mode_); 648 return AllocationSiteModeBits::encode(allocation_site_mode_)
649 | ModeBits::encode(mode_)
650 | LengthBits::encode(length_);
615 } 651 }
616 }; 652 };
617 653
618 654
619 class FastCloneShallowObjectStub : public HydrogenCodeStub { 655 class FastCloneShallowObjectStub : public HydrogenCodeStub {
620 public: 656 public:
621 // Maximum number of properties in copied object. 657 // Maximum number of properties in copied object.
622 static const int kMaximumClonedProperties = 6; 658 static const int kMaximumClonedProperties = 6;
623 659
624 FastCloneShallowObjectStub(Isolate* isolate, int length) 660 FastCloneShallowObjectStub(Isolate* isolate, int length)
(...skipping 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 2543
2508 2544
2509 class CallDescriptors { 2545 class CallDescriptors {
2510 public: 2546 public:
2511 static void InitializeForIsolate(Isolate* isolate); 2547 static void InitializeForIsolate(Isolate* isolate);
2512 }; 2548 };
2513 2549
2514 } } // namespace v8::internal 2550 } } // namespace v8::internal
2515 2551
2516 #endif // V8_CODE_STUBS_H_ 2552 #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