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

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

Issue 18551: Optimizes an assembly-language conversion from int to Smi in codegen. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 11 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 } else { 1119 } else {
1120 int shift_value = int_value & 0x1f; // only least significant 5 bits 1120 int shift_value = int_value & 0x1f; // only least significant 5 bits
1121 DeferredCode* deferred = 1121 DeferredCode* deferred =
1122 new DeferredInlinedSmiOperation(this, Token::SHL, shift_value, 1122 new DeferredInlinedSmiOperation(this, Token::SHL, shift_value,
1123 overwrite_mode); 1123 overwrite_mode);
1124 frame_->Pop(eax); 1124 frame_->Pop(eax);
1125 __ test(eax, Immediate(kSmiTagMask)); 1125 __ test(eax, Immediate(kSmiTagMask));
1126 __ mov(ebx, Operand(eax)); 1126 __ mov(ebx, Operand(eax));
1127 __ j(not_zero, deferred->enter(), not_taken); 1127 __ j(not_zero, deferred->enter(), not_taken);
1128 __ sar(ebx, kSmiTagSize); 1128 __ sar(ebx, kSmiTagSize);
1129 __ shl(ebx, shift_value); 1129 __ shl(ebx, shift_value);
Kevin Millikin (Chromium) 2009/01/23 18:48:08 It's late in the day so I could be wrong. Do we r
1130 // This is the Smi check for the shifted result. 1130 // Convert the int to a Smi, and check that it is in
1131 // After signed subtraction of 0xc0000000, the valid 1131 // the range of valid Smis.
1132 // Smis are positive. 1132 ASSERT(kSmiTagSize == times_2); // Adjust code if not true.
iposva 2009/01/23 16:58:38 kSmiTagSize is a number of bits, times_2 is a inst
1133 __ cmp(ebx, 0xc0000000); 1133 ASSERT(kSmiTag == 0); // Adjust code if not true.
1134 __ j(sign, deferred->enter(), not_taken); 1134 __ add(ebx, Operand(ebx));
1135 // tag result and store it in TOS (eax) 1135 __ j(overflow, deferred->enter(), not_taken);
1136 ASSERT(kSmiTagSize == times_2); // adjust code if not the case 1136 __ mov(eax, Operand(ebx));
1137 __ lea(eax, Operand(ebx, ebx, times_1, kSmiTag)); 1137
1138 __ bind(deferred->exit()); 1138 __ bind(deferred->exit());
1139 frame_->Push(eax); 1139 frame_->Push(eax);
1140 } 1140 }
1141 break; 1141 break;
1142 } 1142 }
1143 1143
1144 case Token::BIT_OR: 1144 case Token::BIT_OR:
1145 case Token::BIT_XOR: 1145 case Token::BIT_XOR:
1146 case Token::BIT_AND: { 1146 case Token::BIT_AND: {
1147 DeferredCode* deferred = NULL; 1147 DeferredCode* deferred = NULL;
(...skipping 4162 matching lines...) Expand 10 before | Expand all | Expand 10 after
5310 5310
5311 // Slow-case: Go through the JavaScript implementation. 5311 // Slow-case: Go through the JavaScript implementation.
5312 __ bind(&slow); 5312 __ bind(&slow);
5313 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 5313 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
5314 } 5314 }
5315 5315
5316 5316
5317 #undef __ 5317 #undef __
5318 5318
5319 } } // namespace v8::internal 5319 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698