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

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

Issue 12254036: Minor cleanup of CompareIC state (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Actually address all comments Created 7 years, 10 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/ic.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 932 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 943
944 // TODO(svenpanne): Use virtual functions instead of switch. 944 // TODO(svenpanne): Use virtual functions instead of switch.
945 void UnaryOpStub::Generate(MacroAssembler* masm) { 945 void UnaryOpStub::Generate(MacroAssembler* masm) {
946 switch (operand_type_) { 946 switch (operand_type_) {
947 case UnaryOpIC::UNINITIALIZED: 947 case UnaryOpIC::UNINITIALIZED:
948 GenerateTypeTransition(masm); 948 GenerateTypeTransition(masm);
949 break; 949 break;
950 case UnaryOpIC::SMI: 950 case UnaryOpIC::SMI:
951 GenerateSmiStub(masm); 951 GenerateSmiStub(masm);
952 break; 952 break;
953 case UnaryOpIC::HEAP_NUMBER: 953 case UnaryOpIC::NUMBER:
954 GenerateHeapNumberStub(masm); 954 GenerateNumberStub(masm);
955 break; 955 break;
956 case UnaryOpIC::GENERIC: 956 case UnaryOpIC::GENERIC:
957 GenerateGenericStub(masm); 957 GenerateGenericStub(masm);
958 break; 958 break;
959 } 959 }
960 } 960 }
961 961
962 962
963 void UnaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { 963 void UnaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
964 __ pop(ecx); // Save return address. 964 __ pop(ecx); // Save return address.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 __ ret(0); 1048 __ ret(0);
1049 } 1049 }
1050 1050
1051 1051
1052 void UnaryOpStub::GenerateSmiCodeUndo(MacroAssembler* masm) { 1052 void UnaryOpStub::GenerateSmiCodeUndo(MacroAssembler* masm) {
1053 __ mov(eax, edx); 1053 __ mov(eax, edx);
1054 } 1054 }
1055 1055
1056 1056
1057 // TODO(svenpanne): Use virtual functions instead of switch. 1057 // TODO(svenpanne): Use virtual functions instead of switch.
1058 void UnaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { 1058 void UnaryOpStub::GenerateNumberStub(MacroAssembler* masm) {
1059 switch (op_) { 1059 switch (op_) {
1060 case Token::SUB: 1060 case Token::SUB:
1061 GenerateHeapNumberStubSub(masm); 1061 GenerateNumberStubSub(masm);
1062 break; 1062 break;
1063 case Token::BIT_NOT: 1063 case Token::BIT_NOT:
1064 GenerateHeapNumberStubBitNot(masm); 1064 GenerateNumberStubBitNot(masm);
1065 break; 1065 break;
1066 default: 1066 default:
1067 UNREACHABLE(); 1067 UNREACHABLE();
1068 } 1068 }
1069 } 1069 }
1070 1070
1071 1071
1072 void UnaryOpStub::GenerateHeapNumberStubSub(MacroAssembler* masm) { 1072 void UnaryOpStub::GenerateNumberStubSub(MacroAssembler* masm) {
1073 Label non_smi, undo, slow, call_builtin; 1073 Label non_smi, undo, slow, call_builtin;
1074 GenerateSmiCodeSub(masm, &non_smi, &undo, &call_builtin, Label::kNear); 1074 GenerateSmiCodeSub(masm, &non_smi, &undo, &call_builtin, Label::kNear);
1075 __ bind(&non_smi); 1075 __ bind(&non_smi);
1076 GenerateHeapNumberCodeSub(masm, &slow); 1076 GenerateHeapNumberCodeSub(masm, &slow);
1077 __ bind(&undo); 1077 __ bind(&undo);
1078 GenerateSmiCodeUndo(masm); 1078 GenerateSmiCodeUndo(masm);
1079 __ bind(&slow); 1079 __ bind(&slow);
1080 GenerateTypeTransition(masm); 1080 GenerateTypeTransition(masm);
1081 __ bind(&call_builtin); 1081 __ bind(&call_builtin);
1082 GenerateGenericCodeFallback(masm); 1082 GenerateGenericCodeFallback(masm);
1083 } 1083 }
1084 1084
1085 1085
1086 void UnaryOpStub::GenerateHeapNumberStubBitNot( 1086 void UnaryOpStub::GenerateNumberStubBitNot(
1087 MacroAssembler* masm) { 1087 MacroAssembler* masm) {
1088 Label non_smi, slow; 1088 Label non_smi, slow;
1089 GenerateSmiCodeBitNot(masm, &non_smi, Label::kNear); 1089 GenerateSmiCodeBitNot(masm, &non_smi, Label::kNear);
1090 __ bind(&non_smi); 1090 __ bind(&non_smi);
1091 GenerateHeapNumberCodeBitNot(masm, &slow); 1091 GenerateHeapNumberCodeBitNot(masm, &slow);
1092 __ bind(&slow); 1092 __ bind(&slow);
1093 GenerateTypeTransition(masm); 1093 GenerateTypeTransition(masm);
1094 } 1094 }
1095 1095
1096 1096
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after
1971 __ bind(&check); 1971 __ bind(&check);
1972 __ cmp(eax, factory->undefined_value()); 1972 __ cmp(eax, factory->undefined_value());
1973 __ j(not_equal, &done, Label::kNear); 1973 __ j(not_equal, &done, Label::kNear);
1974 if (Token::IsBitOp(op_)) { 1974 if (Token::IsBitOp(op_)) {
1975 __ xor_(eax, eax); 1975 __ xor_(eax, eax);
1976 } else { 1976 } else {
1977 __ mov(eax, Immediate(factory->nan_value())); 1977 __ mov(eax, Immediate(factory->nan_value()));
1978 } 1978 }
1979 __ bind(&done); 1979 __ bind(&done);
1980 1980
1981 GenerateHeapNumberStub(masm); 1981 GenerateNumberStub(masm);
1982 } 1982 }
1983 1983
1984 1984
1985 void BinaryOpStub::GenerateHeapNumberStub(MacroAssembler* masm) { 1985 void BinaryOpStub::GenerateNumberStub(MacroAssembler* masm) {
1986 Label call_runtime; 1986 Label call_runtime;
1987 1987
1988 // Floating point case. 1988 // Floating point case.
1989 switch (op_) { 1989 switch (op_) {
1990 case Token::ADD: 1990 case Token::ADD:
1991 case Token::SUB: 1991 case Token::SUB:
1992 case Token::MUL: 1992 case Token::MUL:
1993 case Token::DIV: { 1993 case Token::DIV: {
1994 Label not_floats; 1994 Label not_floats;
1995 if (CpuFeatures::IsSupported(SSE2)) { 1995 if (CpuFeatures::IsSupported(SSE2)) {
(...skipping 2440 matching lines...) Expand 10 before | Expand all | Expand 10 after
4436 } 4436 }
4437 4437
4438 4438
4439 static void CheckInputType(MacroAssembler* masm, 4439 static void CheckInputType(MacroAssembler* masm,
4440 Register input, 4440 Register input,
4441 CompareIC::State expected, 4441 CompareIC::State expected,
4442 Label* fail) { 4442 Label* fail) {
4443 Label ok; 4443 Label ok;
4444 if (expected == CompareIC::SMI) { 4444 if (expected == CompareIC::SMI) {
4445 __ JumpIfNotSmi(input, fail); 4445 __ JumpIfNotSmi(input, fail);
4446 } else if (expected == CompareIC::HEAP_NUMBER) { 4446 } else if (expected == CompareIC::NUMBER) {
4447 __ JumpIfSmi(input, &ok); 4447 __ JumpIfSmi(input, &ok);
4448 __ cmp(FieldOperand(input, HeapObject::kMapOffset), 4448 __ cmp(FieldOperand(input, HeapObject::kMapOffset),
4449 Immediate(masm->isolate()->factory()->heap_number_map())); 4449 Immediate(masm->isolate()->factory()->heap_number_map()));
4450 __ j(not_equal, fail); 4450 __ j(not_equal, fail);
4451 } 4451 }
4452 // We could be strict about symbol/string here, but as long as 4452 // We could be strict about symbol/string here, but as long as
4453 // hydrogen doesn't care, the stub doesn't have to care either. 4453 // hydrogen doesn't care, the stub doesn't have to care either.
4454 __ bind(&ok); 4454 __ bind(&ok);
4455 } 4455 }
4456 4456
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after
6749 __ bind(&done); 6749 __ bind(&done);
6750 __ mov(eax, edx); 6750 __ mov(eax, edx);
6751 } 6751 }
6752 __ ret(0); 6752 __ ret(0);
6753 6753
6754 __ bind(&miss); 6754 __ bind(&miss);
6755 GenerateMiss(masm); 6755 GenerateMiss(masm);
6756 } 6756 }
6757 6757
6758 6758
6759 void ICCompareStub::GenerateHeapNumbers(MacroAssembler* masm) { 6759 void ICCompareStub::GenerateNumbers(MacroAssembler* masm) {
6760 ASSERT(state_ == CompareIC::HEAP_NUMBER); 6760 ASSERT(state_ == CompareIC::NUMBER);
6761 6761
6762 Label generic_stub; 6762 Label generic_stub;
6763 Label unordered, maybe_undefined1, maybe_undefined2; 6763 Label unordered, maybe_undefined1, maybe_undefined2;
6764 Label miss; 6764 Label miss;
6765 6765
6766 if (left_ == CompareIC::SMI) { 6766 if (left_ == CompareIC::SMI) {
6767 __ JumpIfNotSmi(edx, &miss); 6767 __ JumpIfNotSmi(edx, &miss);
6768 } 6768 }
6769 if (right_ == CompareIC::SMI) { 6769 if (right_ == CompareIC::SMI) {
6770 __ JumpIfNotSmi(eax, &miss); 6770 __ JumpIfNotSmi(eax, &miss);
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
7696 // Restore ecx. 7696 // Restore ecx.
7697 __ pop(ecx); 7697 __ pop(ecx);
7698 __ ret(0); 7698 __ ret(0);
7699 } 7699 }
7700 7700
7701 #undef __ 7701 #undef __
7702 7702
7703 } } // namespace v8::internal 7703 } } // namespace v8::internal
7704 7704
7705 #endif // V8_TARGET_ARCH_IA32 7705 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698