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

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

Issue 7332001: Removed useless implementations of GetName and Print for code stubs, the common (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 5 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/arm/code-stubs-arm.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 return UNINITIALIZED; 182 return UNINITIALIZED;
183 } 183 }
184 184
185 // Returns a name for logging/debugging purposes. 185 // Returns a name for logging/debugging purposes.
186 virtual const char* GetName() { return MajorName(MajorKey(), false); } 186 virtual const char* GetName() { return MajorName(MajorKey(), false); }
187 187
188 // Returns whether the code generated for this stub needs to be allocated as 188 // Returns whether the code generated for this stub needs to be allocated as
189 // a fixed (non-moveable) code object. 189 // a fixed (non-moveable) code object.
190 virtual bool NeedsImmovableCode() { return false; } 190 virtual bool NeedsImmovableCode() { return false; }
191 191
192 #ifdef DEBUG 192 #ifdef DEBUG
193 virtual void Print() { PrintF("%s\n", GetName()); } 193 virtual void Print() { PrintF("%s\n", GetName()); }
194 #endif 194 #endif
195 195
196 // Computes the key based on major and minor. 196 // Computes the key based on major and minor.
197 uint32_t GetKey() { 197 uint32_t GetKey() {
198 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS); 198 ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS);
199 return MinorKeyBits::encode(MinorKey()) | 199 return MinorKeyBits::encode(MinorKey()) |
200 MajorKeyBits::encode(MajorKey()); 200 MajorKeyBits::encode(MajorKey());
201 } 201 }
202 202
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 }; 267 };
268 268
269 269
270 class StackCheckStub : public CodeStub { 270 class StackCheckStub : public CodeStub {
271 public: 271 public:
272 StackCheckStub() { } 272 StackCheckStub() { }
273 273
274 void Generate(MacroAssembler* masm); 274 void Generate(MacroAssembler* masm);
275 275
276 private: 276 private:
277 const char* GetName() { return "StackCheckStub"; }
278
279 Major MajorKey() { return StackCheck; } 277 Major MajorKey() { return StackCheck; }
280 int MinorKey() { return 0; } 278 int MinorKey() { return 0; }
281 }; 279 };
282 280
283 281
284 class ToNumberStub: public CodeStub { 282 class ToNumberStub: public CodeStub {
285 public: 283 public:
286 ToNumberStub() { } 284 ToNumberStub() { }
287 285
288 void Generate(MacroAssembler* masm); 286 void Generate(MacroAssembler* masm);
289 287
290 private: 288 private:
291 Major MajorKey() { return ToNumber; } 289 Major MajorKey() { return ToNumber; }
292 int MinorKey() { return 0; } 290 int MinorKey() { return 0; }
293 const char* GetName() { return "ToNumberStub"; }
294 }; 291 };
295 292
296 293
297 class FastNewClosureStub : public CodeStub { 294 class FastNewClosureStub : public CodeStub {
298 public: 295 public:
299 explicit FastNewClosureStub(StrictModeFlag strict_mode) 296 explicit FastNewClosureStub(StrictModeFlag strict_mode)
300 : strict_mode_(strict_mode) { } 297 : strict_mode_(strict_mode) { }
301 298
302 void Generate(MacroAssembler* masm); 299 void Generate(MacroAssembler* masm);
303 300
304 private: 301 private:
305 const char* GetName() { return "FastNewClosureStub"; }
306 Major MajorKey() { return FastNewClosure; } 302 Major MajorKey() { return FastNewClosure; }
307 int MinorKey() { return strict_mode_; } 303 int MinorKey() { return strict_mode_; }
308 304
309 StrictModeFlag strict_mode_; 305 StrictModeFlag strict_mode_;
310 }; 306 };
311 307
312 308
313 class FastNewContextStub : public CodeStub { 309 class FastNewContextStub : public CodeStub {
314 public: 310 public:
315 static const int kMaximumSlots = 64; 311 static const int kMaximumSlots = 64;
316 312
317 explicit FastNewContextStub(int slots) : slots_(slots) { 313 explicit FastNewContextStub(int slots) : slots_(slots) {
318 ASSERT(slots_ > 0 && slots <= kMaximumSlots); 314 ASSERT(slots_ > 0 && slots <= kMaximumSlots);
319 } 315 }
320 316
321 void Generate(MacroAssembler* masm); 317 void Generate(MacroAssembler* masm);
322 318
323 private: 319 private:
324 int slots_; 320 int slots_;
325 321
326 const char* GetName() { return "FastNewContextStub"; }
327 Major MajorKey() { return FastNewContext; } 322 Major MajorKey() { return FastNewContext; }
328 int MinorKey() { return slots_; } 323 int MinorKey() { return slots_; }
329 }; 324 };
330 325
331 326
332 class FastCloneShallowArrayStub : public CodeStub { 327 class FastCloneShallowArrayStub : public CodeStub {
333 public: 328 public:
334 // Maximum length of copied elements array. 329 // Maximum length of copied elements array.
335 static const int kMaximumClonedLength = 8; 330 static const int kMaximumClonedLength = 8;
336 331
337 enum Mode { 332 enum Mode {
338 CLONE_ELEMENTS, 333 CLONE_ELEMENTS,
339 COPY_ON_WRITE_ELEMENTS 334 COPY_ON_WRITE_ELEMENTS
340 }; 335 };
341 336
342 FastCloneShallowArrayStub(Mode mode, int length) 337 FastCloneShallowArrayStub(Mode mode, int length)
343 : mode_(mode), 338 : mode_(mode),
344 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { 339 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) {
345 ASSERT(length_ >= 0); 340 ASSERT(length_ >= 0);
346 ASSERT(length_ <= kMaximumClonedLength); 341 ASSERT(length_ <= kMaximumClonedLength);
347 } 342 }
348 343
349 void Generate(MacroAssembler* masm); 344 void Generate(MacroAssembler* masm);
350 345
351 private: 346 private:
352 Mode mode_; 347 Mode mode_;
353 int length_; 348 int length_;
354 349
355 const char* GetName() { return "FastCloneShallowArrayStub"; }
356 Major MajorKey() { return FastCloneShallowArray; } 350 Major MajorKey() { return FastCloneShallowArray; }
357 int MinorKey() { 351 int MinorKey() {
358 ASSERT(mode_ == 0 || mode_ == 1); 352 ASSERT(mode_ == 0 || mode_ == 1);
359 return (length_ << 1) | mode_; 353 return (length_ << 1) | mode_;
360 } 354 }
361 }; 355 };
362 356
363 357
364 class InstanceofStub: public CodeStub { 358 class InstanceofStub: public CodeStub {
365 public: 359 public:
(...skipping 20 matching lines...) Expand all
386 } 380 }
387 381
388 bool HasCallSiteInlineCheck() const { 382 bool HasCallSiteInlineCheck() const {
389 return (flags_ & kCallSiteInlineCheck) != 0; 383 return (flags_ & kCallSiteInlineCheck) != 0;
390 } 384 }
391 385
392 bool ReturnTrueFalseObject() const { 386 bool ReturnTrueFalseObject() const {
393 return (flags_ & kReturnTrueFalseObject) != 0; 387 return (flags_ & kReturnTrueFalseObject) != 0;
394 } 388 }
395 389
396 const char* GetName(); 390 virtual const char* GetName();
397 391
398 Flags flags_; 392 Flags flags_;
399 char* name_; 393 char* name_;
400 }; 394 };
401 395
402 396
403 class MathPowStub: public CodeStub { 397 class MathPowStub: public CodeStub {
404 public: 398 public:
405 MathPowStub() {} 399 MathPowStub() {}
406 virtual void Generate(MacroAssembler* masm); 400 virtual void Generate(MacroAssembler* masm);
407 401
408 private: 402 private:
409 virtual CodeStub::Major MajorKey() { return MathPow; } 403 virtual CodeStub::Major MajorKey() { return MathPow; }
410 virtual int MinorKey() { return 0; } 404 virtual int MinorKey() { return 0; }
411
412 const char* GetName() { return "MathPowStub"; }
413 }; 405 };
414 406
415 407
416 class ICCompareStub: public CodeStub { 408 class ICCompareStub: public CodeStub {
417 public: 409 public:
418 ICCompareStub(Token::Value op, CompareIC::State state) 410 ICCompareStub(Token::Value op, CompareIC::State state)
419 : op_(op), state_(state) { 411 : op_(op), state_(state) {
420 ASSERT(Token::IsCompareOp(op)); 412 ASSERT(Token::IsCompareOp(op));
421 } 413 }
422 414
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 529
538 // Branch to the label if the given object isn't a symbol. 530 // Branch to the label if the given object isn't a symbol.
539 void BranchIfNonSymbol(MacroAssembler* masm, 531 void BranchIfNonSymbol(MacroAssembler* masm,
540 Label* label, 532 Label* label,
541 Register object, 533 Register object,
542 Register scratch); 534 Register scratch);
543 535
544 // Unfortunately you have to run without snapshots to see most of these 536 // Unfortunately you have to run without snapshots to see most of these
545 // names in the profile since most compare stubs end up in the snapshot. 537 // names in the profile since most compare stubs end up in the snapshot.
546 char* name_; 538 char* name_;
547 const char* GetName(); 539 virtual const char* GetName();
548 #ifdef DEBUG 540 #ifdef DEBUG
549 void Print() { 541 void Print() {
550 PrintF("CompareStub (minor %d) (cc %d), (strict %s), " 542 PrintF("CompareStub (minor %d) (cc %d), (strict %s), "
551 "(never_nan_nan %s), (smi_compare %s) (number_compare %s) ", 543 "(never_nan_nan %s), (smi_compare %s) (number_compare %s) ",
552 MinorKey(), 544 MinorKey(),
553 static_cast<int>(cc_), 545 static_cast<int>(cc_),
554 strict_ ? "true" : "false", 546 strict_ ? "true" : "false",
555 never_nan_nan_ ? "true" : "false", 547 never_nan_nan_ ? "true" : "false",
556 include_smi_compare_ ? "inluded" : "not included", 548 include_smi_compare_ ? "inluded" : "not included",
557 include_number_compare_ ? "included" : "not included"); 549 include_number_compare_ ? "included" : "not included");
(...skipping 28 matching lines...) Expand all
586 UncatchableExceptionType type); 578 UncatchableExceptionType type);
587 579
588 // Number of pointers/values returned. 580 // Number of pointers/values returned.
589 const int result_size_; 581 const int result_size_;
590 bool save_doubles_; 582 bool save_doubles_;
591 583
592 Major MajorKey() { return CEntry; } 584 Major MajorKey() { return CEntry; }
593 int MinorKey(); 585 int MinorKey();
594 586
595 bool NeedsImmovableCode(); 587 bool NeedsImmovableCode();
596
597 const char* GetName() { return "CEntryStub"; }
598 }; 588 };
599 589
600 590
601 class JSEntryStub : public CodeStub { 591 class JSEntryStub : public CodeStub {
602 public: 592 public:
603 JSEntryStub() { } 593 JSEntryStub() { }
604 594
605 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); } 595 void Generate(MacroAssembler* masm) { GenerateBody(masm, false); }
606 596
607 protected: 597 protected:
608 void GenerateBody(MacroAssembler* masm, bool is_construct); 598 void GenerateBody(MacroAssembler* masm, bool is_construct);
609 599
610 private: 600 private:
611 Major MajorKey() { return JSEntry; } 601 Major MajorKey() { return JSEntry; }
612 int MinorKey() { return 0; } 602 int MinorKey() { return 0; }
613
614 const char* GetName() { return "JSEntryStub"; }
615 }; 603 };
616 604
617 605
618 class JSConstructEntryStub : public JSEntryStub { 606 class JSConstructEntryStub : public JSEntryStub {
619 public: 607 public:
620 JSConstructEntryStub() { } 608 JSConstructEntryStub() { }
621 609
622 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); } 610 void Generate(MacroAssembler* masm) { GenerateBody(masm, true); }
623 611
624 private: 612 private:
625 int MinorKey() { return 1; } 613 int MinorKey() { return 1; }
626 614
627 const char* GetName() { return "JSConstructEntryStub"; } 615 virtual const char* GetName() { return "JSConstructEntryStub"; }
628 }; 616 };
629 617
630 618
631 class ArgumentsAccessStub: public CodeStub { 619 class ArgumentsAccessStub: public CodeStub {
632 public: 620 public:
633 enum Type { 621 enum Type {
634 READ_ELEMENT, 622 READ_ELEMENT,
635 NEW_NON_STRICT_FAST, 623 NEW_NON_STRICT_FAST,
636 NEW_NON_STRICT_SLOW, 624 NEW_NON_STRICT_SLOW,
637 NEW_STRICT 625 NEW_STRICT
638 }; 626 };
639 627
640 explicit ArgumentsAccessStub(Type type) : type_(type) { } 628 explicit ArgumentsAccessStub(Type type) : type_(type) { }
641 629
642 private: 630 private:
643 Type type_; 631 Type type_;
644 632
645 Major MajorKey() { return ArgumentsAccess; } 633 Major MajorKey() { return ArgumentsAccess; }
646 int MinorKey() { return type_; } 634 int MinorKey() { return type_; }
647 635
648 void Generate(MacroAssembler* masm); 636 void Generate(MacroAssembler* masm);
649 void GenerateReadElement(MacroAssembler* masm); 637 void GenerateReadElement(MacroAssembler* masm);
650 void GenerateNewStrict(MacroAssembler* masm); 638 void GenerateNewStrict(MacroAssembler* masm);
651 void GenerateNewNonStrictFast(MacroAssembler* masm); 639 void GenerateNewNonStrictFast(MacroAssembler* masm);
652 void GenerateNewNonStrictSlow(MacroAssembler* masm); 640 void GenerateNewNonStrictSlow(MacroAssembler* masm);
653 641
654 const char* GetName() { return "ArgumentsAccessStub"; }
655
656 #ifdef DEBUG 642 #ifdef DEBUG
657 void Print() { 643 void Print() {
658 PrintF("ArgumentsAccessStub (type %d)\n", type_); 644 PrintF("ArgumentsAccessStub (type %d)\n", type_);
659 } 645 }
660 #endif 646 #endif
661 }; 647 };
662 648
663 649
664 class RegExpExecStub: public CodeStub { 650 class RegExpExecStub: public CodeStub {
665 public: 651 public:
666 RegExpExecStub() { } 652 RegExpExecStub() { }
667 653
668 private: 654 private:
669 Major MajorKey() { return RegExpExec; } 655 Major MajorKey() { return RegExpExec; }
670 int MinorKey() { return 0; } 656 int MinorKey() { return 0; }
671 657
672 void Generate(MacroAssembler* masm); 658 void Generate(MacroAssembler* masm);
673
674 const char* GetName() { return "RegExpExecStub"; }
675
676 #ifdef DEBUG
677 void Print() {
678 PrintF("RegExpExecStub\n");
679 }
680 #endif
681 }; 659 };
682 660
683 661
684 class RegExpConstructResultStub: public CodeStub { 662 class RegExpConstructResultStub: public CodeStub {
685 public: 663 public:
686 RegExpConstructResultStub() { } 664 RegExpConstructResultStub() { }
687 665
688 private: 666 private:
689 Major MajorKey() { return RegExpConstructResult; } 667 Major MajorKey() { return RegExpConstructResult; }
690 int MinorKey() { return 0; } 668 int MinorKey() { return 0; }
691 669
692 void Generate(MacroAssembler* masm); 670 void Generate(MacroAssembler* masm);
693
694 const char* GetName() { return "RegExpConstructResultStub"; }
695
696 #ifdef DEBUG
697 void Print() {
698 PrintF("RegExpConstructResultStub\n");
699 }
700 #endif
701 }; 671 };
702 672
703 673
704 class CallFunctionStub: public CodeStub { 674 class CallFunctionStub: public CodeStub {
705 public: 675 public:
706 CallFunctionStub(int argc, InLoopFlag in_loop, CallFunctionFlags flags) 676 CallFunctionStub(int argc, InLoopFlag in_loop, CallFunctionFlags flags)
707 : argc_(argc), in_loop_(in_loop), flags_(flags) { } 677 : argc_(argc), in_loop_(in_loop), flags_(flags) { }
708 678
709 void Generate(MacroAssembler* masm); 679 void Generate(MacroAssembler* masm);
710 680
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 masm_->set_allow_stub_calls(previous_allow_); 884 masm_->set_allow_stub_calls(previous_allow_);
915 } 885 }
916 886
917 private: 887 private:
918 MacroAssembler* masm_; 888 MacroAssembler* masm_;
919 bool previous_allow_; 889 bool previous_allow_;
920 890
921 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope); 891 DISALLOW_COPY_AND_ASSIGN(AllowStubCallsScope);
922 }; 892 };
923 893
924 #ifdef DEBUG
925 #define DECLARE_ARRAY_STUB_PRINT(name) void Print() { PrintF(#name); }
926 #else
927 #define DECLARE_ARRAY_STUB_PRINT(name)
928 #endif
929
930 894
931 class KeyedLoadFastElementStub : public CodeStub { 895 class KeyedLoadFastElementStub : public CodeStub {
932 public: 896 public:
933 explicit KeyedLoadFastElementStub() { 897 explicit KeyedLoadFastElementStub() {
934 } 898 }
935 899
936 Major MajorKey() { return KeyedLoadFastElement; } 900 Major MajorKey() { return KeyedLoadFastElement; }
937 int MinorKey() { return 0; } 901 int MinorKey() { return 0; }
938 902
939 void Generate(MacroAssembler* masm); 903 void Generate(MacroAssembler* masm);
940
941 const char* GetName() { return "KeyedLoadFastElementStub"; }
942
943 DECLARE_ARRAY_STUB_PRINT(KeyedLoadFastElementStub)
944 }; 904 };
945 905
946 906
947 class KeyedStoreFastElementStub : public CodeStub { 907 class KeyedStoreFastElementStub : public CodeStub {
948 public: 908 public:
949 explicit KeyedStoreFastElementStub(bool is_js_array) 909 explicit KeyedStoreFastElementStub(bool is_js_array)
950 : is_js_array_(is_js_array) { } 910 : is_js_array_(is_js_array) { }
951 911
952 Major MajorKey() { return KeyedStoreFastElement; } 912 Major MajorKey() { return KeyedStoreFastElement; }
953 int MinorKey() { return is_js_array_ ? 1 : 0; } 913 int MinorKey() { return is_js_array_ ? 1 : 0; }
954 914
955 void Generate(MacroAssembler* masm); 915 void Generate(MacroAssembler* masm);
956 916
957 const char* GetName() { return "KeyedStoreFastElementStub"; }
958
959 DECLARE_ARRAY_STUB_PRINT(KeyedStoreFastElementStub)
960
961 private: 917 private:
962 bool is_js_array_; 918 bool is_js_array_;
963 }; 919 };
964 920
965 921
966 class KeyedLoadExternalArrayStub : public CodeStub { 922 class KeyedLoadExternalArrayStub : public CodeStub {
967 public: 923 public:
968 explicit KeyedLoadExternalArrayStub(JSObject::ElementsKind elements_kind) 924 explicit KeyedLoadExternalArrayStub(JSObject::ElementsKind elements_kind)
969 : elements_kind_(elements_kind) { } 925 : elements_kind_(elements_kind) { }
970 926
971 Major MajorKey() { return KeyedLoadExternalArray; } 927 Major MajorKey() { return KeyedLoadExternalArray; }
972 int MinorKey() { return elements_kind_; } 928 int MinorKey() { return elements_kind_; }
973 929
974 void Generate(MacroAssembler* masm); 930 void Generate(MacroAssembler* masm);
975 931
976 const char* GetName() { return "KeyedLoadExternalArrayStub"; }
977
978 DECLARE_ARRAY_STUB_PRINT(KeyedLoadExternalArrayStub)
979
980 protected: 932 protected:
981 JSObject::ElementsKind elements_kind_; 933 JSObject::ElementsKind elements_kind_;
982 }; 934 };
983 935
984 936
985 class KeyedStoreExternalArrayStub : public CodeStub { 937 class KeyedStoreExternalArrayStub : public CodeStub {
986 public: 938 public:
987 explicit KeyedStoreExternalArrayStub(JSObject::ElementsKind elements_kind) 939 explicit KeyedStoreExternalArrayStub(JSObject::ElementsKind elements_kind)
988 : elements_kind_(elements_kind) { } 940 : elements_kind_(elements_kind) { }
989 941
990 Major MajorKey() { return KeyedStoreExternalArray; } 942 Major MajorKey() { return KeyedStoreExternalArray; }
991 int MinorKey() { return elements_kind_; } 943 int MinorKey() { return elements_kind_; }
992 944
993 void Generate(MacroAssembler* masm); 945 void Generate(MacroAssembler* masm);
994 946
995 const char* GetName() { return "KeyedStoreExternalArrayStub"; }
996
997 DECLARE_ARRAY_STUB_PRINT(KeyedStoreExternalArrayStub)
998
999 protected: 947 protected:
1000 JSObject::ElementsKind elements_kind_; 948 JSObject::ElementsKind elements_kind_;
1001 }; 949 };
1002 950
1003 951
1004 class ToBooleanStub: public CodeStub { 952 class ToBooleanStub: public CodeStub {
1005 public: 953 public:
1006 explicit ToBooleanStub(Register tos) : tos_(tos) { } 954 explicit ToBooleanStub(Register tos) : tos_(tos) { }
1007 955
1008 void Generate(MacroAssembler* masm); 956 void Generate(MacroAssembler* masm);
1009 957
1010 private: 958 private:
1011 Register tos_; 959 Register tos_;
1012 Major MajorKey() { return ToBoolean; } 960 Major MajorKey() { return ToBoolean; }
1013 int MinorKey() { return tos_.code(); } 961 int MinorKey() { return tos_.code(); }
1014 }; 962 };
1015 963
1016 } } // namespace v8::internal 964 } } // namespace v8::internal
1017 965
1018 #endif // V8_CODE_STUBS_H_ 966 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698