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

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 7342042: Disentangle printing of stub names and memory allocation. (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/ia32/code-stubs-ia32.h ('k') | src/mips/code-stubs-mips.h » ('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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 __ j(greater, &negative, Label::kNear); 504 __ j(greater, &negative, Label::kNear);
505 __ mov(ecx, scratch2); 505 __ mov(ecx, scratch2);
506 __ jmp(&done, Label::kNear); 506 __ jmp(&done, Label::kNear);
507 __ bind(&negative); 507 __ bind(&negative);
508 __ sub(ecx, Operand(scratch2)); 508 __ sub(ecx, Operand(scratch2));
509 __ bind(&done); 509 __ bind(&done);
510 } 510 }
511 } 511 }
512 512
513 513
514 const char* UnaryOpStub::GetName() { 514 void UnaryOpStub::PrintName(StringStream* stream) {
515 if (name_ != NULL) return name_;
516 const int kMaxNameLength = 100;
517 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
518 kMaxNameLength);
519 if (name_ == NULL) return "OOM";
520 const char* op_name = Token::Name(op_); 515 const char* op_name = Token::Name(op_);
521 const char* overwrite_name = NULL; // Make g++ happy. 516 const char* overwrite_name = NULL; // Make g++ happy.
522 switch (mode_) { 517 switch (mode_) {
523 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break; 518 case UNARY_NO_OVERWRITE: overwrite_name = "Alloc"; break;
524 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break; 519 case UNARY_OVERWRITE: overwrite_name = "Overwrite"; break;
525 } 520 }
526 521 stream->Add("UnaryOpStub_%s_%s_%s",
527 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), 522 op_name,
528 "UnaryOpStub_%s_%s_%s", 523 overwrite_name,
529 op_name, 524 UnaryOpIC::GetName(operand_type_));
530 overwrite_name,
531 UnaryOpIC::GetName(operand_type_));
532 return name_;
533 } 525 }
534 526
535 527
536 // TODO(svenpanne): Use virtual functions instead of switch. 528 // TODO(svenpanne): Use virtual functions instead of switch.
537 void UnaryOpStub::Generate(MacroAssembler* masm) { 529 void UnaryOpStub::Generate(MacroAssembler* masm) {
538 switch (operand_type_) { 530 switch (operand_type_) {
539 case UnaryOpIC::UNINITIALIZED: 531 case UnaryOpIC::UNINITIALIZED:
540 GenerateTypeTransition(masm); 532 GenerateTypeTransition(masm);
541 break; 533 break;
542 case UnaryOpIC::SMI: 534 case UnaryOpIC::SMI:
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 break; 899 break;
908 case BinaryOpIC::GENERIC: 900 case BinaryOpIC::GENERIC:
909 GenerateGeneric(masm); 901 GenerateGeneric(masm);
910 break; 902 break;
911 default: 903 default:
912 UNREACHABLE(); 904 UNREACHABLE();
913 } 905 }
914 } 906 }
915 907
916 908
917 const char* BinaryOpStub::GetName() { 909 void BinaryOpStub::PrintName(StringStream* stream) {
918 if (name_ != NULL) return name_;
919 const int kMaxNameLength = 100;
920 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
921 kMaxNameLength);
922 if (name_ == NULL) return "OOM";
923 const char* op_name = Token::Name(op_); 910 const char* op_name = Token::Name(op_);
924 const char* overwrite_name; 911 const char* overwrite_name;
925 switch (mode_) { 912 switch (mode_) {
926 case NO_OVERWRITE: overwrite_name = "Alloc"; break; 913 case NO_OVERWRITE: overwrite_name = "Alloc"; break;
927 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break; 914 case OVERWRITE_RIGHT: overwrite_name = "OverwriteRight"; break;
928 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break; 915 case OVERWRITE_LEFT: overwrite_name = "OverwriteLeft"; break;
929 default: overwrite_name = "UnknownOverwrite"; break; 916 default: overwrite_name = "UnknownOverwrite"; break;
930 } 917 }
931 918 stream->Add("BinaryOpStub_%s_%s_%s",
932 OS::SNPrintF(Vector<char>(name_, kMaxNameLength), 919 op_name,
933 "BinaryOpStub_%s_%s_%s", 920 overwrite_name,
934 op_name, 921 BinaryOpIC::GetName(operands_type_));
935 overwrite_name,
936 BinaryOpIC::GetName(operands_type_));
937 return name_;
938 } 922 }
939 923
940 924
941 void BinaryOpStub::GenerateSmiCode( 925 void BinaryOpStub::GenerateSmiCode(
942 MacroAssembler* masm, 926 MacroAssembler* masm,
943 Label* slow, 927 Label* slow,
944 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) { 928 SmiCodeGenerateHeapNumberResults allow_heapnumber_results) {
945 // 1. Move arguments into edx, eax except for DIV and MOD, which need the 929 // 1. Move arguments into edx, eax except for DIV and MOD, which need the
946 // dividend in eax and edx free for the division. Use eax, ebx for those. 930 // dividend in eax and edx free for the division. Use eax, ebx for those.
947 Comment load_comment(masm, "-- Load arguments"); 931 Comment load_comment(masm, "-- Load arguments");
(...skipping 3771 matching lines...) Expand 10 before | Expand all | Expand 10 after
4719 | RegisterField::encode(false) // lhs_ and rhs_ are not used 4703 | RegisterField::encode(false) // lhs_ and rhs_ are not used
4720 | StrictField::encode(strict_) 4704 | StrictField::encode(strict_)
4721 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false) 4705 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false)
4722 | IncludeNumberCompareField::encode(include_number_compare_) 4706 | IncludeNumberCompareField::encode(include_number_compare_)
4723 | IncludeSmiCompareField::encode(include_smi_compare_); 4707 | IncludeSmiCompareField::encode(include_smi_compare_);
4724 } 4708 }
4725 4709
4726 4710
4727 // Unfortunately you have to run without snapshots to see most of these 4711 // Unfortunately you have to run without snapshots to see most of these
4728 // names in the profile since most compare stubs end up in the snapshot. 4712 // names in the profile since most compare stubs end up in the snapshot.
4729 const char* CompareStub::GetName() { 4713 void CompareStub::PrintName(StringStream* stream) {
4730 ASSERT(lhs_.is(no_reg) && rhs_.is(no_reg)); 4714 ASSERT(lhs_.is(no_reg) && rhs_.is(no_reg));
4731
4732 if (name_ != NULL) return name_;
4733 const int kMaxNameLength = 100;
4734 name_ = Isolate::Current()->bootstrapper()->AllocateAutoDeletedArray(
4735 kMaxNameLength);
4736 if (name_ == NULL) return "OOM";
4737
4738 const char* cc_name; 4715 const char* cc_name;
4739 switch (cc_) { 4716 switch (cc_) {
4740 case less: cc_name = "LT"; break; 4717 case less: cc_name = "LT"; break;
4741 case greater: cc_name = "GT"; break; 4718 case greater: cc_name = "GT"; break;
4742 case less_equal: cc_name = "LE"; break; 4719 case less_equal: cc_name = "LE"; break;
4743 case greater_equal: cc_name = "GE"; break; 4720 case greater_equal: cc_name = "GE"; break;
4744 case equal: cc_name = "EQ"; break; 4721 case equal: cc_name = "EQ"; break;
4745 case not_equal: cc_name = "NE"; break; 4722 case not_equal: cc_name = "NE"; break;
4746 default: cc_name = "UnknownCondition"; break; 4723 default: cc_name = "UnknownCondition"; break;
4747 } 4724 }
4748 4725 bool is_equality = cc_ == equal || cc_ == not_equal;
4749 const char* strict_name = ""; 4726 stream->Add("CompareStub_%s", cc_name);
4750 if (strict_ && (cc_ == equal || cc_ == not_equal)) { 4727 if (strict_ && is_equality) stream->Add("_STRICT");
4751 strict_name = "_STRICT"; 4728 if (never_nan_nan_ && is_equality) stream->Add("_NO_NAN");
4752 } 4729 if (!include_number_compare_) stream->Add("_NO_NUMBER");
4753 4730 if (!include_smi_compare_) stream->Add("_NO_SMI");
4754 const char* never_nan_nan_name = "";
4755 if (never_nan_nan_ && (cc_ == equal || cc_ == not_equal)) {
4756 never_nan_nan_name = "_NO_NAN";
4757 }
4758
4759 const char* include_number_compare_name = "";
4760 if (!include_number_compare_) {
4761 include_number_compare_name = "_NO_NUMBER";
4762 }
4763
4764 const char* include_smi_compare_name = "";
4765 if (!include_smi_compare_) {
4766 include_smi_compare_name = "_NO_SMI";
4767 }
4768
4769 OS::SNPrintF(Vector<char>(name_, kMaxNameLength),
4770 "CompareStub_%s%s%s%s%s",
4771 cc_name,
4772 strict_name,
4773 never_nan_nan_name,
4774 include_number_compare_name,
4775 include_smi_compare_name);
4776 return name_;
4777 } 4731 }
4778 4732
4779 4733
4780 // ------------------------------------------------------------------------- 4734 // -------------------------------------------------------------------------
4781 // StringCharCodeAtGenerator 4735 // StringCharCodeAtGenerator
4782 4736
4783 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) { 4737 void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {
4784 Label flat_string; 4738 Label flat_string;
4785 Label ascii_string; 4739 Label ascii_string;
4786 Label got_char_code; 4740 Label got_char_code;
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
6338 __ Drop(1); 6292 __ Drop(1);
6339 __ ret(2 * kPointerSize); 6293 __ ret(2 * kPointerSize);
6340 } 6294 }
6341 6295
6342 6296
6343 #undef __ 6297 #undef __
6344 6298
6345 } } // namespace v8::internal 6299 } } // namespace v8::internal
6346 6300
6347 #endif // V8_TARGET_ARCH_IA32 6301 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/mips/code-stubs-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698