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

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

Issue 465028: String check for binary add on x64 and ARM... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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 | 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 5197 matching lines...) Expand 10 before | Expand all | Expand 10 after
5208 ConvertToDoubleStub stub2(r1, r0, r7, r6); 5208 ConvertToDoubleStub stub2(r1, r0, r7, r6);
5209 __ Call(stub2.GetCode(), RelocInfo::CODE_TARGET); 5209 __ Call(stub2.GetCode(), RelocInfo::CODE_TARGET);
5210 __ pop(lr); 5210 __ pop(lr);
5211 } 5211 }
5212 5212
5213 __ jmp(&do_the_call); // Tail call. No return. 5213 __ jmp(&do_the_call); // Tail call. No return.
5214 5214
5215 // We jump to here if something goes wrong (one param is not a number of any 5215 // We jump to here if something goes wrong (one param is not a number of any
5216 // sort or new-space allocation fails). 5216 // sort or new-space allocation fails).
5217 __ bind(&slow); 5217 __ bind(&slow);
5218
5219 // Push arguments to the stack
5218 __ push(r1); 5220 __ push(r1);
5219 __ push(r0); 5221 __ push(r0);
5222
5223 if (Token::ADD == operation) {
5224 // Test for string arguments before calling runtime.
5225 // r1 : first argument
5226 // r0 : second argument
5227 // sp[0] : second argument
5228 // sp[1] : first argument
5229
5230 Label not_strings, not_string1, string1;
5231 __ tst(r1, Operand(kSmiTagMask));
5232 __ b(eq, &not_string1);
5233 __ CompareObjectType(r1, r2, r2, FIRST_NONSTRING_TYPE);
5234 __ b(ge, &not_string1);
5235
5236 // First argument is a a string, test second.
5237 __ tst(r0, Operand(kSmiTagMask));
5238 __ b(eq, &string1);
5239 __ CompareObjectType(r0, r2, r2, FIRST_NONSTRING_TYPE);
5240 __ b(ge, &string1);
5241
5242 // First and second argument are strings.
5243 __ TailCallRuntime(ExternalReference(Runtime::kStringAdd), 2, 1);
5244
5245 // Only first argument is a string.
5246 __ bind(&string1);
5247 __ mov(r0, Operand(2)); // Set number of arguments.
5248 __ InvokeBuiltin(Builtins::STRING_ADD_LEFT, JUMP_JS);
5249
5250 // First argument was not a string, test second.
5251 __ bind(&not_string1);
5252 __ tst(r0, Operand(kSmiTagMask));
5253 __ b(eq, &not_strings);
5254 __ CompareObjectType(r0, r2, r2, FIRST_NONSTRING_TYPE);
5255 __ b(ge, &not_strings);
5256
5257 // Only second argument is a string.
5258 __ b(&not_strings);
5259 __ mov(r0, Operand(2)); // Set number of arguments.
5260 __ InvokeBuiltin(Builtins::STRING_ADD_RIGHT, JUMP_JS);
5261
5262 __ bind(&not_strings);
5263 }
5264
5220 __ mov(r0, Operand(1)); // Set number of arguments. 5265 __ mov(r0, Operand(1)); // Set number of arguments.
5221 __ InvokeBuiltin(builtin, JUMP_JS); // Tail call. No return. 5266 __ InvokeBuiltin(builtin, JUMP_JS); // Tail call. No return.
5222 5267
5223 // We branch here if at least one of r0 and r1 is not a Smi. 5268 // We branch here if at least one of r0 and r1 is not a Smi.
5224 __ bind(not_smi); 5269 __ bind(not_smi);
5225 if (mode == NO_OVERWRITE) { 5270 if (mode == NO_OVERWRITE) {
5226 // In the case where there is no chance of an overwritable float we may as 5271 // In the case where there is no chance of an overwritable float we may as
5227 // well do the allocation immediately while r0 and r1 are untouched. 5272 // well do the allocation immediately while r0 and r1 are untouched.
5228 AllocateHeapNumber(masm, &slow, r5, r6, r7); 5273 AllocateHeapNumber(masm, &slow, r5, r6, r7);
5229 } 5274 }
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
6539 int CompareStub::MinorKey() { 6584 int CompareStub::MinorKey() {
6540 // Encode the two parameters in a unique 16 bit value. 6585 // Encode the two parameters in a unique 16 bit value.
6541 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15)); 6586 ASSERT(static_cast<unsigned>(cc_) >> 28 < (1 << 15));
6542 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0); 6587 return (static_cast<unsigned>(cc_) >> 27) | (strict_ ? 1 : 0);
6543 } 6588 }
6544 6589
6545 6590
6546 #undef __ 6591 #undef __
6547 6592
6548 } } // namespace v8::internal 6593 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698