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

Side by Side Diff: src/ia32/codegen-ia32.cc

Issue 1108006: Fix GetName and Print for CompareStub (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 9 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/codegen.h ('k') | src/x64/codegen-x64.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 11678 matching lines...) Expand 10 before | Expand all | Expand 10 after
11689 __ bind(&is_not_instance); 11689 __ bind(&is_not_instance);
11690 __ Set(eax, Immediate(Smi::FromInt(1))); 11690 __ Set(eax, Immediate(Smi::FromInt(1)));
11691 __ ret(2 * kPointerSize); 11691 __ ret(2 * kPointerSize);
11692 11692
11693 // Slow-case: Go through the JavaScript implementation. 11693 // Slow-case: Go through the JavaScript implementation.
11694 __ bind(&slow); 11694 __ bind(&slow);
11695 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 11695 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
11696 } 11696 }
11697 11697
11698 11698
11699 // Unfortunately you have to run without snapshots to see most of these
11700 // names in the profile since most compare stubs end up in the snapshot.
11701 const char* CompareStub::GetName() {
11702 switch (cc_) {
11703 case less: return "CompareStub_LT";
11704 case greater: return "CompareStub_GT";
11705 case less_equal: return "CompareStub_LE";
11706 case greater_equal: return "CompareStub_GE";
11707 case not_equal: {
11708 if (strict_) {
11709 if (never_nan_nan_) {
11710 return "CompareStub_NE_STRICT_NO_NAN";
11711 } else {
11712 return "CompareStub_NE_STRICT";
11713 }
11714 } else {
11715 if (never_nan_nan_) {
11716 return "CompareStub_NE_NO_NAN";
11717 } else {
11718 return "CompareStub_NE";
11719 }
11720 }
11721 }
11722 case equal: {
11723 if (strict_) {
11724 if (never_nan_nan_) {
11725 return "CompareStub_EQ_STRICT_NO_NAN";
11726 } else {
11727 return "CompareStub_EQ_STRICT";
11728 }
11729 } else {
11730 if (never_nan_nan_) {
11731 return "CompareStub_EQ_NO_NAN";
11732 } else {
11733 return "CompareStub_EQ";
11734 }
11735 }
11736 }
11737 default: return "CompareStub";
11738 }
11739 }
11740
11741
11742 int CompareStub::MinorKey() { 11699 int CompareStub::MinorKey() {
11743 // Encode the three parameters in a unique 16 bit value. To avoid duplicate 11700 // Encode the three parameters in a unique 16 bit value. To avoid duplicate
11744 // stubs the never NaN NaN condition is only taken into account if the 11701 // stubs the never NaN NaN condition is only taken into account if the
11745 // condition is equals. 11702 // condition is equals.
11746 ASSERT(static_cast<unsigned>(cc_) < (1 << 13)); 11703 ASSERT(static_cast<unsigned>(cc_) < (1 << 13));
11747 return ConditionField::encode(static_cast<unsigned>(cc_)) 11704 return ConditionField::encode(static_cast<unsigned>(cc_))
11748 | StrictField::encode(strict_) 11705 | StrictField::encode(strict_)
11749 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false) 11706 | NeverNanNanField::encode(cc_ == equal ? never_nan_nan_ : false)
11750 | IncludeNumberCompareField::encode(include_number_compare_); 11707 | IncludeNumberCompareField::encode(include_number_compare_);
11751 } 11708 }
11752 11709
11753 11710
11711 // Unfortunately you have to run without snapshots to see most of these
11712 // names in the profile since most compare stubs end up in the snapshot.
11713 const char* CompareStub::GetName() {
11714 if (name_ != NULL) return name_;
11715 const int kMaxNameLength = 100;
11716 name_ = Bootstrapper::AllocateAutoDeletedArray(kMaxNameLength);
11717 if (name_ == NULL) return "OOM";
11718
11719 const char* cc_name;
11720 switch (cc_) {
11721 case less: cc_name = "LT"; break;
11722 case greater: cc_name = "GT"; break;
11723 case less_equal: cc_name = "LE"; break;
11724 case greater_equal: cc_name = "GE"; break;
11725 case equal: cc_name = "EQ"; break;
11726 case not_equal: cc_name = "NE"; break;
11727 default: cc_name = "UnknownCondition"; break;
11728 }
11729
11730 const char* strict_name = "";
11731 if (strict_ && (cc_ == equal || cc_ == not_equal)) {
11732 strict_name = "_STRICT";
11733 }
11734
11735 const char* never_nan_nan_name = "";
11736 if (never_nan_nan_ && (cc_ == equal || cc_ == not_equal)) {
11737 never_nan_nan_name = "_NO_NAN";
11738 }
11739
11740 const char* include_number_compare_name = "";
11741 if (!include_number_compare_) {
11742 include_number_compare_name = "_NO_NUMBER";
11743 }
11744
11745 OS::SNPrintF(Vector<char>(name_, kMaxNameLength),
11746 "CompareStub_%s%s%s%s",
11747 cc_name,
11748 strict_name,
11749 never_nan_nan_name,
11750 include_number_compare_name);
11751 return name_;
11752 }
11753
11754
11754 void StringAddStub::Generate(MacroAssembler* masm) { 11755 void StringAddStub::Generate(MacroAssembler* masm) {
11755 Label string_add_runtime; 11756 Label string_add_runtime;
11756 11757
11757 // Load the two arguments. 11758 // Load the two arguments.
11758 __ mov(eax, Operand(esp, 2 * kPointerSize)); // First argument. 11759 __ mov(eax, Operand(esp, 2 * kPointerSize)); // First argument.
11759 __ mov(edx, Operand(esp, 1 * kPointerSize)); // Second argument. 11760 __ mov(edx, Operand(esp, 1 * kPointerSize)); // Second argument.
11760 11761
11761 // Make sure that both arguments are strings if not known in advance. 11762 // Make sure that both arguments are strings if not known in advance.
11762 if (string_check_) { 11763 if (string_check_) {
11763 __ test(eax, Immediate(kSmiTagMask)); 11764 __ test(eax, Immediate(kSmiTagMask));
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
12485 12486
12486 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 12487 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
12487 // tagged as a small integer. 12488 // tagged as a small integer.
12488 __ bind(&runtime); 12489 __ bind(&runtime);
12489 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 12490 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
12490 } 12491 }
12491 12492
12492 #undef __ 12493 #undef __
12493 12494
12494 } } // namespace v8::internal 12495 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/codegen.h ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698