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

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

Issue 21507: Experimental: port bleeding_edge r1276 (a grab bag of optimizations)... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 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/array.js ('k') | src/date-delay.js » ('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 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 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 } else { 1183 } else {
1184 deferred = new DeferredInlineSmiOperationReversed(this, op, smi_value, 1184 deferred = new DeferredInlineSmiOperationReversed(this, op, smi_value,
1185 overwrite_mode); 1185 overwrite_mode);
1186 } 1186 }
1187 Result operand = frame_->Pop(); 1187 Result operand = frame_->Pop();
1188 operand.ToRegister(); 1188 operand.ToRegister();
1189 __ test(operand.reg(), Immediate(kSmiTagMask)); 1189 __ test(operand.reg(), Immediate(kSmiTagMask));
1190 deferred->enter()->Branch(not_zero, &operand, not_taken); 1190 deferred->enter()->Branch(not_zero, &operand, not_taken);
1191 frame_->Spill(operand.reg()); 1191 frame_->Spill(operand.reg());
1192 if (op == Token::BIT_AND) { 1192 if (op == Token::BIT_AND) {
1193 __ and_(Operand(operand.reg()), Immediate(value)); 1193 if (int_value == 0) {
1194 __ xor_(Operand(operand.reg()), operand.reg());
1195 } else {
1196 __ and_(Operand(operand.reg()), Immediate(value));
1197 }
1194 } else if (op == Token::BIT_XOR) { 1198 } else if (op == Token::BIT_XOR) {
1195 __ xor_(Operand(operand.reg()), Immediate(value)); 1199 if (int_value != 0) {
1200 __ xor_(Operand(operand.reg()), Immediate(value));
1201 }
1196 } else { 1202 } else {
1197 ASSERT(op == Token::BIT_OR); 1203 ASSERT(op == Token::BIT_OR);
1198 __ or_(Operand(operand.reg()), Immediate(value)); 1204 if (int_value != 0) {
1205 __ or_(Operand(opernand.reg()), Immediate(value));
Lasse Reichstein 2009/02/19 12:19:37 "opernand" typo?
Kevin Millikin (Chromium) 2009/02/19 12:21:06 Duh. Thanks.
1206 }
1199 } 1207 }
1200 deferred->BindExit(&operand); 1208 deferred->BindExit(&operand);
1201 frame_->Push(&operand); 1209 frame_->Push(&operand);
1202 break; 1210 break;
1203 } 1211 }
1204 1212
1205 default: { 1213 default: {
1206 if (!reversed) { 1214 if (!reversed) {
1207 frame_->Push(value); 1215 frame_->Push(value);
1208 } else { 1216 } else {
(...skipping 2905 matching lines...) Expand 10 before | Expand all | Expand 10 after
4114 frame_->SetElementAt(0, Factory::true_value()); 4122 frame_->SetElementAt(0, Factory::true_value());
4115 } 4123 }
4116 4124
4117 } else if (op == Token::TYPEOF) { 4125 } else if (op == Token::TYPEOF) {
4118 // Special case for loading the typeof expression; see comment on 4126 // Special case for loading the typeof expression; see comment on
4119 // LoadTypeofExpression(). 4127 // LoadTypeofExpression().
4120 LoadTypeofExpression(node->expression()); 4128 LoadTypeofExpression(node->expression());
4121 Result answer = frame_->CallRuntime(Runtime::kTypeof, 1); 4129 Result answer = frame_->CallRuntime(Runtime::kTypeof, 1);
4122 frame_->Push(&answer); 4130 frame_->Push(&answer);
4123 4131
4132 } else if (op == Token::VOID) {
4133 Expression* expression = node->expression();
4134 if (expression && expression->AsLiteral() && (
4135 expression->AsLiteral()->IsTrue() ||
4136 expression->AsLiteral()->IsFalse() ||
4137 expression->AsLiteral()->handle()->IsNumber() ||
4138 expression->AsLiteral()->handle()->IsString() ||
4139 expression->AsLiteral()->handle()->IsJSRegExp() ||
4140 expression->AsLiteral()->IsNull())) {
4141 // Omit evaluating the value of the primitive literal.
4142 // It will be discarded anyway, and can have no side effect.
4143 frame_->Push(Factory::undefined_value());
4144 } else {
4145 Load(node->expression());
4146 frame_->SetElementAt(0, Factory::undefined_value());
4147 }
4148
4124 } else { 4149 } else {
4125 Load(node->expression()); 4150 Load(node->expression());
4126 switch (op) { 4151 switch (op) {
4127 case Token::NOT: 4152 case Token::NOT:
4128 case Token::DELETE: 4153 case Token::DELETE:
4129 case Token::TYPEOF: 4154 case Token::TYPEOF:
4130 UNREACHABLE(); // handled above 4155 UNREACHABLE(); // handled above
4131 break; 4156 break;
4132 4157
4133 case Token::SUB: { 4158 case Token::SUB: {
(...skipping 23 matching lines...) Expand all
4157 smi_label.Bind(&answer); 4182 smi_label.Bind(&answer);
4158 answer.ToRegister(); 4183 answer.ToRegister();
4159 frame_->Spill(answer.reg()); 4184 frame_->Spill(answer.reg());
4160 __ not_(answer.reg()); 4185 __ not_(answer.reg());
4161 __ and_(answer.reg(), ~kSmiTagMask); // Remove inverted smi-tag. 4186 __ and_(answer.reg(), ~kSmiTagMask); // Remove inverted smi-tag.
4162 continue_label.Bind(&answer); 4187 continue_label.Bind(&answer);
4163 frame_->Push(&answer); 4188 frame_->Push(&answer);
4164 break; 4189 break;
4165 } 4190 }
4166 4191
4167 case Token::VOID: {
4168 frame_->SetElementAt(0, Factory::undefined_value());
4169 break;
4170 }
4171
4172 case Token::ADD: { 4192 case Token::ADD: {
4173 // Smi check. 4193 // Smi check.
4174 JumpTarget continue_label(this); 4194 JumpTarget continue_label(this);
4175 Result operand = frame_->Pop(); 4195 Result operand = frame_->Pop();
4176 operand.ToRegister(); 4196 operand.ToRegister();
4177 __ test(operand.reg(), Immediate(kSmiTagMask)); 4197 __ test(operand.reg(), Immediate(kSmiTagMask));
4178 continue_label.Branch(zero, &operand, taken); 4198 continue_label.Branch(zero, &operand, taken);
4179 4199
4180 frame_->Push(&operand); 4200 frame_->Push(&operand);
4181 Result answer = frame_->InvokeBuiltin(Builtins::TO_NUMBER, 4201 Result answer = frame_->InvokeBuiltin(Builtins::TO_NUMBER,
(...skipping 2385 matching lines...) Expand 10 before | Expand all | Expand 10 after
6567 6587
6568 // Slow-case: Go through the JavaScript implementation. 6588 // Slow-case: Go through the JavaScript implementation.
6569 __ bind(&slow); 6589 __ bind(&slow);
6570 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION); 6590 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_FUNCTION);
6571 } 6591 }
6572 6592
6573 6593
6574 #undef __ 6594 #undef __
6575 6595
6576 } } // namespace v8::internal 6596 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/date-delay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698