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

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

Issue 5640004: Allow the optimizing code generator to call Math.pow with untagged doubles. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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
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 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 LInstruction* result = new LUnaryMathOperation(input); 1359 LInstruction* result = new LUnaryMathOperation(input);
1360 switch (op) { 1360 switch (op) {
1361 case kMathAbs: 1361 case kMathAbs:
1362 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1362 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1363 case kMathFloor: 1363 case kMathFloor:
1364 return AssignEnvironment(DefineAsRegister(result)); 1364 return AssignEnvironment(DefineAsRegister(result));
1365 case kMathRound: 1365 case kMathRound:
1366 return AssignEnvironment(DefineAsRegister(result)); 1366 return AssignEnvironment(DefineAsRegister(result));
1367 case kMathSqrt: 1367 case kMathSqrt:
1368 return DefineSameAsFirst(result); 1368 return DefineSameAsFirst(result);
1369 case kMathPowHalf:
1370 return AssignEnvironment(DefineSameAsFirst(result));
1369 default: 1371 default:
1370 UNREACHABLE(); 1372 UNREACHABLE();
1371 return NULL; 1373 return NULL;
1372 } 1374 }
1373 } 1375 }
1374 1376
1375 1377
1376 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1378 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1377 ASSERT(instr->key()->representation().IsTagged()); 1379 ASSERT(instr->key()->representation().IsTagged());
1378 argument_count_ -= instr->argument_count(); 1380 argument_count_ -= instr->argument_count();
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1559 return result; 1561 return result;
1560 } else if (instr->representation().IsDouble()) { 1562 } else if (instr->representation().IsDouble()) {
1561 return DoArithmeticD(Token::ADD, instr); 1563 return DoArithmeticD(Token::ADD, instr);
1562 } else { 1564 } else {
1563 ASSERT(instr->representation().IsTagged()); 1565 ASSERT(instr->representation().IsTagged());
1564 return DoArithmeticT(Token::ADD, instr); 1566 return DoArithmeticT(Token::ADD, instr);
1565 } 1567 }
1566 } 1568 }
1567 1569
1568 1570
1571 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1572 ASSERT(instr->representation().IsDouble());
1573 // We call a C function for double power. It can't trigger a GC.
1574 // We need to use fixed result register for the call.
1575 Representation exponent_type = instr->right()->representation();
1576 ASSERT(instr->left()->representation().IsDouble());
1577 // if (instr->right()->representation().IsTagged()) {
1578 // Abort("Tagged expoinent in Math.pow not yet workign.");
Florian Schneider 2010/12/08 14:09:27 Remove commented code?
William Hesse 2010/12/08 14:53:16 Done.
1579 // return NULL;
1580 // }
1581 LOperand* left = UseFixedDouble(instr->left(), xmm1);
1582 LOperand* right = exponent_type.IsDouble() ?
1583 UseFixedDouble(instr->right(), xmm2) :
1584 UseFixed(instr->right(), eax);
1585 LPower* result = new LPower(left, right, exponent_type);
1586 return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
Florian Schneider 2010/12/08 14:09:27 In case of a tagged exponent you need to pass CAN_
William Hesse 2010/12/08 14:53:16 Done.
1587 }
1588
1589
1569 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { 1590 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) {
1570 Token::Value op = instr->token(); 1591 Token::Value op = instr->token();
1571 if (instr->left()->representation().IsInteger32()) { 1592 if (instr->left()->representation().IsInteger32()) {
1572 ASSERT(instr->right()->representation().IsInteger32()); 1593 ASSERT(instr->right()->representation().IsInteger32());
1573 LOperand* left = UseRegisterAtStart(instr->left()); 1594 LOperand* left = UseRegisterAtStart(instr->left());
1574 LOperand* right = UseOrConstantAtStart(instr->right()); 1595 LOperand* right = UseOrConstantAtStart(instr->right());
1575 return DefineAsRegister(new LCmpID(op, left, right, false)); 1596 return DefineAsRegister(new LCmpID(op, left, right, false));
1576 } else if (instr->left()->representation().IsDouble()) { 1597 } else if (instr->left()->representation().IsDouble()) {
1577 ASSERT(instr->right()->representation().IsDouble()); 1598 ASSERT(instr->right()->representation().IsDouble());
1578 LOperand* left = UseRegisterAtStart(instr->left()); 1599 LOperand* left = UseRegisterAtStart(instr->left());
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 void LPointerMap::PrintTo(StringStream* stream) const { 2102 void LPointerMap::PrintTo(StringStream* stream) const {
2082 stream->Add("{"); 2103 stream->Add("{");
2083 for (int i = 0; i < pointer_operands_.length(); ++i) { 2104 for (int i = 0; i < pointer_operands_.length(); ++i) {
2084 if (i != 0) stream->Add(";"); 2105 if (i != 0) stream->Add(";");
2085 pointer_operands_[i]->PrintTo(stream); 2106 pointer_operands_[i]->PrintTo(stream);
2086 } 2107 }
2087 stream->Add("} @%d", position()); 2108 stream->Add("} @%d", position());
2088 } 2109 }
2089 2110
2090 } } // namespace v8::internal 2111 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698