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

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

Issue 557016: Implement SUB and BIT_NOT unary operations in full codegenerator.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | « no previous file | src/full-codegen.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 Label no_conversion; 1357 Label no_conversion;
1358 __ tst(result_register(), Operand(kSmiTagMask)); 1358 __ tst(result_register(), Operand(kSmiTagMask));
1359 __ b(eq, &no_conversion); 1359 __ b(eq, &no_conversion);
1360 __ push(r0); 1360 __ push(r0);
1361 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS); 1361 __ InvokeBuiltin(Builtins::TO_NUMBER, CALL_JS);
1362 __ bind(&no_conversion); 1362 __ bind(&no_conversion);
1363 Apply(context_, result_register()); 1363 Apply(context_, result_register());
1364 break; 1364 break;
1365 } 1365 }
1366 1366
1367 case Token::SUB: {
1368 Comment cmt(masm_, "[ UnaryOperation (SUB)");
1369 bool overwrite =
1370 (expr->expression()->AsBinaryOperation() != NULL &&
1371 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
1372 GenericUnaryOpStub stub(Token::SUB, overwrite);
1373 // GenericUnaryOpStub expects the argument to be in the
1374 // accumulator register r0.
1375 VisitForValue(expr->expression(), kAccumulator);
1376 __ CallStub(&stub);
1377 Apply(context_, r0);
1378 break;
1379 }
1380
1381 case Token::BIT_NOT: {
1382 Comment cmt(masm_, "[ UnaryOperation (BIT_NOT)");
1383 bool overwrite =
1384 (expr->expression()->AsBinaryOperation() != NULL &&
1385 expr->expression()->AsBinaryOperation()->ResultOverwriteAllowed());
1386 GenericUnaryOpStub stub(Token::BIT_NOT, overwrite);
1387 // GenericUnaryOpStub expects the argument to be in the
1388 // accumulator register r0.
1389 VisitForValue(expr->expression(), kAccumulator);
1390 // Avoid calling the stub for Smis.
1391 Label smi, done;
1392 __ tst(result_register(), Operand(kSmiTagMask));
1393 __ b(eq, &smi);
1394 // Non-smi: call stub leaving result in accumulator register.
1395 __ CallStub(&stub);
1396 __ b(&done);
1397 // Perform operation directly on Smis.
1398 __ bind(&smi);
1399 __ mvn(result_register(), Operand(result_register()));
1400 // Bit-clear inverted smi-tag.
1401 __ bic(result_register(), result_register(), Operand(kSmiTagMask));
1402 __ bind(&done);
1403 Apply(context_, result_register());
1404 }
1405
1367 default: 1406 default:
1368 UNREACHABLE(); 1407 UNREACHABLE();
1369 } 1408 }
1370 } 1409 }
1371 1410
1372 1411
1373 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { 1412 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
1374 Comment cmnt(masm_, "[ CountOperation"); 1413 Comment cmnt(masm_, "[ CountOperation");
1375 1414
1376 // Expression can only be a property, a global or a (parameter or local) 1415 // Expression can only be a property, a global or a (parameter or local)
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 __ pop(result_register()); 1752 __ pop(result_register());
1714 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); 1753 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize);
1715 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 1754 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
1716 __ add(pc, r1, Operand(masm_->CodeObject())); 1755 __ add(pc, r1, Operand(masm_->CodeObject()));
1717 } 1756 }
1718 1757
1719 1758
1720 #undef __ 1759 #undef __
1721 1760
1722 } } // namespace v8::internal 1761 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698