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

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

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 9 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/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('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 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 200
201 void LIsNullAndBranch::PrintDataTo(StringStream* stream) const { 201 void LIsNullAndBranch::PrintDataTo(StringStream* stream) const {
202 stream->Add("if "); 202 stream->Add("if ");
203 input()->PrintTo(stream); 203 input()->PrintTo(stream);
204 stream->Add(is_strict() ? " === null" : " == null"); 204 stream->Add(is_strict() ? " === null" : " == null");
205 stream->Add(" then B%d else B%d", true_block_id(), false_block_id()); 205 stream->Add(" then B%d else B%d", true_block_id(), false_block_id());
206 } 206 }
207 207
208 208
209 void LIsObjectAndBranch::PrintDataTo(StringStream* stream) const {
210 stream->Add("if is_object(");
211 input()->PrintTo(stream);
212 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
213 }
214
215
209 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) const { 216 void LIsSmiAndBranch::PrintDataTo(StringStream* stream) const {
210 stream->Add("if is_smi("); 217 stream->Add("if is_smi(");
211 input()->PrintTo(stream); 218 input()->PrintTo(stream);
212 stream->Add(") then B%d else B%d", true_block_id(), false_block_id()); 219 stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
213 } 220 }
214 221
215 222
216 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) const { 223 void LHasInstanceTypeAndBranch::PrintDataTo(StringStream* stream) const {
217 stream->Add("if has_instance_type("); 224 stream->Add("if has_instance_type(");
218 input()->PrintTo(stream); 225 input()->PrintTo(stream);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 return instructions_[index]->IsGap(); 460 return instructions_[index]->IsGap();
454 } 461 }
455 462
456 463
457 int LChunk::NearestGapPos(int index) const { 464 int LChunk::NearestGapPos(int index) const {
458 while (!IsGapAt(index)) index--; 465 while (!IsGapAt(index)) index--;
459 return index; 466 return index;
460 } 467 }
461 468
462 469
463 int LChunk::NearestNextGapPos(int index) const {
464 while (!IsGapAt(index)) index++;
465 return index;
466 }
467
468
469 void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) { 470 void LChunk::AddGapMove(int index, LOperand* from, LOperand* to) {
470 GetGapAt(index)->GetOrCreateParallelMove(LGap::START)->AddMove(from, to); 471 GetGapAt(index)->GetOrCreateParallelMove(LGap::START)->AddMove(from, to);
471 } 472 }
472 473
473 474
474 class LGapNode: public ZoneObject { 475 class LGapNode: public ZoneObject {
475 public: 476 public:
476 explicit LGapNode(LOperand* operand) 477 explicit LGapNode(LOperand* operand)
477 : operand_(operand), resolved_(false), visited_id_(-1) { } 478 : operand_(operand), resolved_(false), visited_id_(-1) { }
478 479
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 HIsNull* compare = HIsNull::cast(v); 1238 HIsNull* compare = HIsNull::cast(v);
1238 ASSERT(compare->value()->representation().IsTagged()); 1239 ASSERT(compare->value()->representation().IsTagged());
1239 1240
1240 // We only need a temp register for non-strict compare. 1241 // We only need a temp register for non-strict compare.
1241 LOperand* temp = compare->is_strict() ? NULL : TempRegister(); 1242 LOperand* temp = compare->is_strict() ? NULL : TempRegister();
1242 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()), 1243 return new LIsNullAndBranch(UseRegisterAtStart(compare->value()),
1243 compare->is_strict(), 1244 compare->is_strict(),
1244 temp, 1245 temp,
1245 first_id, 1246 first_id,
1246 second_id); 1247 second_id);
1248 } else if (v->IsIsObject()) {
1249 HIsObject* compare = HIsObject::cast(v);
1250 ASSERT(compare->value()->representation().IsTagged());
1251
1252 LOperand* temp1 = TempRegister();
1253 LOperand* temp2 = TempRegister();
1254 return new LIsObjectAndBranch(UseRegisterAtStart(compare->value()),
1255 temp1,
1256 temp2,
1257 first_id,
1258 second_id);
1247 } else if (v->IsCompareJSObjectEq()) { 1259 } else if (v->IsCompareJSObjectEq()) {
1248 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); 1260 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v);
1249 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), 1261 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()),
1250 UseRegisterAtStart(compare->right()), 1262 UseRegisterAtStart(compare->right()),
1251 first_id, 1263 first_id,
1252 second_id); 1264 second_id);
1253 } else if (v->IsInstanceOf()) { 1265 } else if (v->IsInstanceOf()) {
1254 HInstanceOf* instance_of = HInstanceOf::cast(v); 1266 HInstanceOf* instance_of = HInstanceOf::cast(v);
1255 LInstruction* result = 1267 LInstruction* result =
1256 new LInstanceOfAndBranch(Use(instance_of->left()), 1268 new LInstanceOfAndBranch(Use(instance_of->left()),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 } 1309 }
1298 1310
1299 1311
1300 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 1312 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1301 return DefineAsRegister(new LArgumentsElements); 1313 return DefineAsRegister(new LArgumentsElements);
1302 } 1314 }
1303 1315
1304 1316
1305 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 1317 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1306 LInstruction* result = 1318 LInstruction* result =
1307 new LInstanceOf(Use(instr->left()), Use(instr->right())); 1319 new LInstanceOf(UseFixed(instr->left(), r1),
1320 UseFixed(instr->right(), r0));
1308 return MarkAsCall(DefineFixed(result, r0), instr); 1321 return MarkAsCall(DefineFixed(result, r0), instr);
1309 } 1322 }
1310 1323
1311 1324
1312 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { 1325 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1313 LOperand* function = UseFixed(instr->function(), r1); 1326 LOperand* function = UseFixed(instr->function(), r1);
1314 LOperand* receiver = UseFixed(instr->receiver(), r0); 1327 LOperand* receiver = UseFixed(instr->receiver(), r0);
1315 LOperand* length = UseRegisterAtStart(instr->length()); 1328 LOperand* length = UseRegisterAtStart(instr->length());
1316 LOperand* elements = UseRegisterAtStart(instr->elements()); 1329 LOperand* elements = UseRegisterAtStart(instr->elements());
1317 LInstruction* result = new LApplyArguments(function, 1330 LInstruction* result = new LApplyArguments(function,
(...skipping 22 matching lines...) Expand all
1340 1353
1341 1354
1342 LInstruction* LChunkBuilder::DoCallConstantFunction( 1355 LInstruction* LChunkBuilder::DoCallConstantFunction(
1343 HCallConstantFunction* instr) { 1356 HCallConstantFunction* instr) {
1344 argument_count_ -= instr->argument_count(); 1357 argument_count_ -= instr->argument_count();
1345 return MarkAsCall(DefineFixed(new LCallConstantFunction, r0), instr); 1358 return MarkAsCall(DefineFixed(new LCallConstantFunction, r0), instr);
1346 } 1359 }
1347 1360
1348 1361
1349 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) { 1362 LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation* instr) {
1350 MathFunctionId op = instr->op(); 1363 BuiltinFunctionId op = instr->op();
1351 LOperand* input = UseRegisterAtStart(instr->value()); 1364 LOperand* input = UseRegisterAtStart(instr->value());
1352 LInstruction* result = new LUnaryMathOperation(input); 1365 LInstruction* result = new LUnaryMathOperation(input);
1353 switch (op) { 1366 switch (op) {
1354 case kMathAbs: 1367 case kMathAbs:
1355 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result))); 1368 return AssignEnvironment(AssignPointerMap(DefineSameAsFirst(result)));
1356 case kMathFloor: 1369 case kMathFloor:
1357 return AssignEnvironment(DefineAsRegister(result)); 1370 return AssignEnvironment(DefineAsRegister(result));
1358 case kMathSqrt: 1371 case kMathSqrt:
1359 return DefineSameAsFirst(result); 1372 return DefineSameAsFirst(result);
1373 case kMathPowHalf:
1374 Abort("MathPowHalf LUnaryMathOperation not implemented");
1375 return NULL;
1376 case kMathLog:
1377 Abort("MathLog LUnaryMathOperation not implemented");
1378 return NULL;
1379 case kMathCos:
1380 Abort("MathCos LUnaryMathOperation not implemented");
1381 return NULL;
1382 case kMathSin:
1383 Abort("MathSin LUnaryMathOperation not implemented");
1384 return NULL;
1360 default: 1385 default:
1361 UNREACHABLE(); 1386 UNREACHABLE();
1362 return NULL; 1387 return NULL;
1363 } 1388 }
1364 } 1389 }
1365 1390
1366 1391
1367 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) { 1392 LInstruction* LChunkBuilder::DoCallKeyed(HCallKeyed* instr) {
1368 ASSERT(instr->key()->representation().IsTagged()); 1393 ASSERT(instr->key()->representation().IsTagged());
1369 argument_count_ -= instr->argument_count(); 1394 argument_count_ -= instr->argument_count();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1547 return result; 1572 return result;
1548 } else if (instr->representation().IsDouble()) { 1573 } else if (instr->representation().IsDouble()) {
1549 return DoArithmeticD(Token::ADD, instr); 1574 return DoArithmeticD(Token::ADD, instr);
1550 } else { 1575 } else {
1551 ASSERT(instr->representation().IsTagged()); 1576 ASSERT(instr->representation().IsTagged());
1552 return DoArithmeticT(Token::ADD, instr); 1577 return DoArithmeticT(Token::ADD, instr);
1553 } 1578 }
1554 } 1579 }
1555 1580
1556 1581
1582 LInstruction* LChunkBuilder::DoPower(HPower* instr) {
1583 Abort("LPower instruction not implemented on ARM");
1584 return NULL;
1585 }
1586
1587
1557 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) { 1588 LInstruction* LChunkBuilder::DoCompare(HCompare* instr) {
1558 Token::Value op = instr->token(); 1589 Token::Value op = instr->token();
1559 if (instr->left()->representation().IsInteger32()) { 1590 if (instr->left()->representation().IsInteger32()) {
1560 ASSERT(instr->right()->representation().IsInteger32()); 1591 ASSERT(instr->right()->representation().IsInteger32());
1561 LOperand* left = UseRegisterAtStart(instr->left()); 1592 LOperand* left = UseRegisterAtStart(instr->left());
1562 LOperand* right = UseOrConstantAtStart(instr->right()); 1593 LOperand* right = UseOrConstantAtStart(instr->right());
1563 return DefineAsRegister(new LCmpID(op, left, right, false)); 1594 return DefineAsRegister(new LCmpID(op, left, right, false));
1564 } else if (instr->left()->representation().IsDouble()) { 1595 } else if (instr->left()->representation().IsDouble()) {
1565 ASSERT(instr->right()->representation().IsDouble()); 1596 ASSERT(instr->right()->representation().IsDouble());
1566 LOperand* left = UseRegisterAtStart(instr->left()); 1597 LOperand* left = UseRegisterAtStart(instr->left());
(...skipping 20 matching lines...) Expand all
1587 1618
1588 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) { 1619 LInstruction* LChunkBuilder::DoIsNull(HIsNull* instr) {
1589 ASSERT(instr->value()->representation().IsTagged()); 1620 ASSERT(instr->value()->representation().IsTagged());
1590 LOperand* value = UseRegisterAtStart(instr->value()); 1621 LOperand* value = UseRegisterAtStart(instr->value());
1591 1622
1592 return DefineAsRegister(new LIsNull(value, 1623 return DefineAsRegister(new LIsNull(value,
1593 instr->is_strict())); 1624 instr->is_strict()));
1594 } 1625 }
1595 1626
1596 1627
1628 LInstruction* LChunkBuilder::DoIsObject(HIsObject* instr) {
1629 ASSERT(instr->value()->representation().IsTagged());
1630 LOperand* value = UseRegisterAtStart(instr->value());
1631
1632 return DefineAsRegister(new LIsObject(value, TempRegister()));
1633 }
1634
1635
1597 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) { 1636 LInstruction* LChunkBuilder::DoIsSmi(HIsSmi* instr) {
1598 ASSERT(instr->value()->representation().IsTagged()); 1637 ASSERT(instr->value()->representation().IsTagged());
1599 LOperand* value = UseAtStart(instr->value()); 1638 LOperand* value = UseAtStart(instr->value());
1600 1639
1601 return DefineAsRegister(new LIsSmi(value)); 1640 return DefineAsRegister(new LIsSmi(value));
1602 } 1641 }
1603 1642
1604 1643
1605 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) { 1644 LInstruction* LChunkBuilder::DoHasInstanceType(HHasInstanceType* instr) {
1606 ASSERT(instr->value()->representation().IsTagged()); 1645 ASSERT(instr->value()->representation().IsTagged());
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 res = DefineSameAsFirst(new LSmiUntag(value, needs_check)); 1720 res = DefineSameAsFirst(new LSmiUntag(value, needs_check));
1682 } 1721 }
1683 if (needs_check) { 1722 if (needs_check) {
1684 res = AssignEnvironment(res); 1723 res = AssignEnvironment(res);
1685 } 1724 }
1686 return res; 1725 return res;
1687 } 1726 }
1688 } else if (from.IsDouble()) { 1727 } else if (from.IsDouble()) {
1689 if (to.IsTagged()) { 1728 if (to.IsTagged()) {
1690 LOperand* value = UseRegister(instr->value()); 1729 LOperand* value = UseRegister(instr->value());
1691 LOperand* temp = TempRegister(); 1730 LOperand* temp1 = TempRegister();
1731 LOperand* temp2 = TempRegister();
1692 1732
1693 // Make sure that temp and result_temp are different registers. 1733 // Make sure that the temp and result_temp registers are
1734 // different.
1694 LUnallocated* result_temp = TempRegister(); 1735 LUnallocated* result_temp = TempRegister();
1695 LInstruction* result = new LNumberTagD(value, temp); 1736 LInstruction* result = new LNumberTagD(value, temp1, temp2);
1696 Define(result, result_temp); 1737 Define(result, result_temp);
1697 return AssignPointerMap(result); 1738 return AssignPointerMap(result);
1698 } else { 1739 } else {
1699 ASSERT(to.IsInteger32()); 1740 ASSERT(to.IsInteger32());
1700 LOperand* value = UseRegister(instr->value()); 1741 LOperand* value = UseRegister(instr->value());
1701 LInstruction* res = new LDoubleToI(value); 1742 LInstruction* res = new LDoubleToI(value);
1702 return AssignEnvironment(DefineAsRegister(res)); 1743 return AssignEnvironment(DefineAsRegister(res));
1703 } 1744 }
1704 } else if (from.IsInteger32()) { 1745 } else if (from.IsInteger32()) {
1705 if (to.IsTagged()) { 1746 if (to.IsTagged()) {
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 void LPointerMap::PrintTo(StringStream* stream) const { 2113 void LPointerMap::PrintTo(StringStream* stream) const {
2073 stream->Add("{"); 2114 stream->Add("{");
2074 for (int i = 0; i < pointer_operands_.length(); ++i) { 2115 for (int i = 0; i < pointer_operands_.length(); ++i) {
2075 if (i != 0) stream->Add(";"); 2116 if (i != 0) stream->Add(";");
2076 pointer_operands_[i]->PrintTo(stream); 2117 pointer_operands_[i]->PrintTo(stream);
2077 } 2118 }
2078 stream->Add("} @%d", position()); 2119 stream->Add("} @%d", position());
2079 } 2120 }
2080 2121
2081 } } // namespace v8::internal 2122 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-arm.h ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698