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

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

Issue 2843049: Simplify the transitions in the Binary Op ICs. Now a single call... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 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
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 9848 matching lines...) Expand 10 before | Expand all | Expand 10 after
9859 case Token::MUL: 9859 case Token::MUL:
9860 case Token::DIV: { 9860 case Token::DIV: {
9861 if (runtime_operands_type_ == BinaryOpIC::DEFAULT && 9861 if (runtime_operands_type_ == BinaryOpIC::DEFAULT &&
9862 HasSmiCodeInStub()) { 9862 HasSmiCodeInStub()) {
9863 // Execution reaches this point when the first non-smi argument occurs 9863 // Execution reaches this point when the first non-smi argument occurs
9864 // (and only if smi code is generated). This is the right moment to 9864 // (and only if smi code is generated). This is the right moment to
9865 // patch to HEAP_NUMBERS state. The transition is attempted only for 9865 // patch to HEAP_NUMBERS state. The transition is attempted only for
9866 // the four basic operations. The stub stays in the DEFAULT state 9866 // the four basic operations. The stub stays in the DEFAULT state
9867 // forever for all other operations (also if smi code is skipped). 9867 // forever for all other operations (also if smi code is skipped).
9868 GenerateTypeTransition(masm); 9868 GenerateTypeTransition(masm);
9869 break;
9869 } 9870 }
9870 9871
9871 Label not_floats; 9872 Label not_floats;
9872 if (CpuFeatures::IsSupported(SSE2)) { 9873 if (CpuFeatures::IsSupported(SSE2)) {
9873 CpuFeatures::Scope use_sse2(SSE2); 9874 CpuFeatures::Scope use_sse2(SSE2);
9874 if (static_operands_type_.IsNumber()) { 9875 if (static_operands_type_.IsNumber()) {
9875 if (FLAG_debug_code) { 9876 if (FLAG_debug_code) {
9876 // Assert at runtime that inputs are only numbers. 9877 // Assert at runtime that inputs are only numbers.
9877 __ AbortIfNotNumber(edx); 9878 __ AbortIfNotNumber(edx);
9878 __ AbortIfNotNumber(eax); 9879 __ AbortIfNotNumber(eax);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
10206 __ push(edx); 10207 __ push(edx);
10207 } else { 10208 } else {
10208 __ push(edx); 10209 __ push(edx);
10209 __ push(eax); 10210 __ push(eax);
10210 } 10211 }
10211 __ push(ecx); 10212 __ push(ecx);
10212 } 10213 }
10213 10214
10214 10215
10215 void GenericBinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { 10216 void GenericBinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
10216 Label get_result; 10217 // Ensure the operands are on the stack.
10217
10218 // Keep a copy of operands on the stack and make sure they are also in
10219 // edx, eax.
10220 if (HasArgsInRegisters()) { 10218 if (HasArgsInRegisters()) {
10221 GenerateRegisterArgsPush(masm); 10219 GenerateRegisterArgsPush(masm);
10222 } else {
10223 GenerateLoadArguments(masm);
10224 } 10220 }
10225 10221
10226 // Internal frame is necessary to handle exceptions properly. 10222 __ pop(ecx); // Save return address.
10227 __ EnterInternalFrame();
10228 10223
10229 // Push arguments on stack if the stub expects them there.
10230 if (!HasArgsInRegisters()) {
10231 __ push(edx);
10232 __ push(eax);
10233 }
10234 // Call the stub proper to get the result in eax.
10235 __ call(&get_result);
10236 __ LeaveInternalFrame();
10237
10238 __ pop(ecx); // Return address.
10239 // Left and right arguments are now on top. 10224 // Left and right arguments are now on top.
10240 // Push the operation result. The tail call to BinaryOp_Patch will
10241 // return it to the original caller.
10242 __ push(eax);
10243 // Push this stub's key. Although the operation and the type info are 10225 // Push this stub's key. Although the operation and the type info are
10244 // encoded into the key, the encoding is opaque, so push them too. 10226 // encoded into the key, the encoding is opaque, so push them too.
10245 __ push(Immediate(Smi::FromInt(MinorKey()))); 10227 __ push(Immediate(Smi::FromInt(MinorKey())));
10246 __ push(Immediate(Smi::FromInt(op_))); 10228 __ push(Immediate(Smi::FromInt(op_)));
10247 __ push(Immediate(Smi::FromInt(runtime_operands_type_))); 10229 __ push(Immediate(Smi::FromInt(runtime_operands_type_)));
10248 10230
10249 __ push(ecx); // Return address. 10231 __ push(ecx); // Push return address.
10250 10232
10251 // Patch the caller to an appropriate specialized stub 10233 // Patch the caller to an appropriate specialized stub and return the
Kasper Lund 2010/07/06 11:56:35 I guess it doesn't really return anymore? Does it?
Erik Corry 2010/07/06 12:53:21 Well it's a tail call so it returns the answer to
10252 // and return the operation result. 10234 // operation result.
10253 __ TailCallExternalReference( 10235 __ TailCallExternalReference(
10254 ExternalReference(IC_Utility(IC::kBinaryOp_Patch)), 10236 ExternalReference(IC_Utility(IC::kBinaryOp_Patch)),
10255 6, 10237 5,
10256 1); 10238 1);
10257
10258 // The entry point for the result calculation is assumed to be immediately
10259 // after this sequence.
10260 __ bind(&get_result);
10261 } 10239 }
10262 10240
10263 10241
10264 Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) { 10242 Handle<Code> GetBinaryOpStub(int key, BinaryOpIC::TypeInfo type_info) {
10265 GenericBinaryOpStub stub(key, type_info); 10243 GenericBinaryOpStub stub(key, type_info);
10266 return stub.GetCode(); 10244 return stub.GetCode();
10267 } 10245 }
10268 10246
10269 10247
10270 void TranscendentalCacheStub::Generate(MacroAssembler* masm) { 10248 void TranscendentalCacheStub::Generate(MacroAssembler* masm) {
(...skipping 3503 matching lines...) Expand 10 before | Expand all | Expand 10 after
13774 masm.GetCode(&desc); 13752 masm.GetCode(&desc);
13775 // Call the function from C++. 13753 // Call the function from C++.
13776 return FUNCTION_CAST<MemCopyFunction>(buffer); 13754 return FUNCTION_CAST<MemCopyFunction>(buffer);
13777 } 13755 }
13778 13756
13779 #undef __ 13757 #undef __
13780 13758
13781 } } // namespace v8::internal 13759 } } // namespace v8::internal
13782 13760
13783 #endif // V8_TARGET_ARCH_IA32 13761 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698