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

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

Issue 6606002: Merge revision 6500-6600 from bleeding_edge to the isolates branch. (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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 646
647 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) { 647 LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
648 HEnvironment* hydrogen_env = current_block_->last_environment(); 648 HEnvironment* hydrogen_env = current_block_->last_environment();
649 instr->set_environment(CreateEnvironment(hydrogen_env)); 649 instr->set_environment(CreateEnvironment(hydrogen_env));
650 return instr; 650 return instr;
651 } 651 }
652 652
653 653
654 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment( 654 LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment(
655 LInstruction* instr, int ast_id) { 655 LInstruction* instr, int ast_id) {
656 ASSERT(instructions_pending_deoptimization_environment_ == NULL); 656 ASSERT(instruction_pending_deoptimization_environment_ == NULL);
657 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber); 657 ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber);
658 instructions_pending_deoptimization_environment_ = instr; 658 instruction_pending_deoptimization_environment_ = instr;
659 pending_deoptimization_ast_id_ = ast_id; 659 pending_deoptimization_ast_id_ = ast_id;
660 return instr; 660 return instr;
661 } 661 }
662 662
663 663
664 void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() { 664 void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() {
665 instructions_pending_deoptimization_environment_ = NULL; 665 instruction_pending_deoptimization_environment_ = NULL;
666 pending_deoptimization_ast_id_ = AstNode::kNoNumber; 666 pending_deoptimization_ast_id_ = AstNode::kNoNumber;
667 } 667 }
668 668
669 669
670 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr, 670 LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
671 HInstruction* hinstr, 671 HInstruction* hinstr,
672 CanDeoptimize can_deoptimize) { 672 CanDeoptimize can_deoptimize) {
673 allocator_->MarkAsCall(); 673 allocator_->MarkAsCall();
674 instr = AssignPointerMap(instr); 674 instr = AssignPointerMap(instr);
675 675
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 } 1036 }
1037 1037
1038 1038
1039 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { 1039 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1040 Abort("Unimplemented: %s", "DoApplyArguments"); 1040 Abort("Unimplemented: %s", "DoApplyArguments");
1041 return NULL; 1041 return NULL;
1042 } 1042 }
1043 1043
1044 1044
1045 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) { 1045 LInstruction* LChunkBuilder::DoPushArgument(HPushArgument* instr) {
1046 Abort("Unimplemented: %s", "DoPushArgument"); 1046 ++argument_count_;
1047 return NULL; 1047 LOperand* argument = UseOrConstant(instr->argument());
1048 return new LPushArgument(argument);
1048 } 1049 }
1049 1050
1050 1051
1051 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) { 1052 LInstruction* LChunkBuilder::DoGlobalObject(HGlobalObject* instr) {
1052 return DefineAsRegister(new LGlobalObject); 1053 return DefineAsRegister(new LGlobalObject);
1053 } 1054 }
1054 1055
1055 1056
1056 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) { 1057 LInstruction* LChunkBuilder::DoGlobalReceiver(HGlobalReceiver* instr) {
1057 Abort("Unimplemented: %s", "DoGlobalReceiver"); 1058 return DefineAsRegister(new LGlobalReceiver);
1058 return NULL;
1059 } 1059 }
1060 1060
1061 1061
1062 LInstruction* LChunkBuilder::DoCallConstantFunction( 1062 LInstruction* LChunkBuilder::DoCallConstantFunction(
1063 HCallConstantFunction* instr) { 1063 HCallConstantFunction* instr) {
1064 Abort("Unimplemented: %s", "DoCallConstantFunction"); 1064 Abort("Unimplemented: %s", "DoCallConstantFunction");
1065 return NULL; 1065 return NULL;
1066 } 1066 }
1067 1067
1068 1068
(...skipping 21 matching lines...) Expand all
1090 } 1090 }
1091 1091
1092 1092
1093 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) { 1093 LInstruction* LChunkBuilder::DoCallKnownGlobal(HCallKnownGlobal* instr) {
1094 Abort("Unimplemented: %s", "DoCallKnownGlobal"); 1094 Abort("Unimplemented: %s", "DoCallKnownGlobal");
1095 return NULL; 1095 return NULL;
1096 } 1096 }
1097 1097
1098 1098
1099 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) { 1099 LInstruction* LChunkBuilder::DoCallNew(HCallNew* instr) {
1100 Abort("Unimplemented: %s", "DoCallNew"); 1100 LOperand* constructor = UseFixed(instr->constructor(), rdi);
1101 return NULL; 1101 argument_count_ -= instr->argument_count();
1102 LCallNew* result = new LCallNew(constructor);
1103 return MarkAsCall(DefineFixed(result, rax), instr);
1102 } 1104 }
1103 1105
1104 1106
1105 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) { 1107 LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
1106 Abort("Unimplemented: %s", "DoCallFunction"); 1108 Abort("Unimplemented: %s", "DoCallFunction");
1107 return NULL; 1109 return NULL;
1108 } 1110 }
1109 1111
1110 1112
1111 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) { 1113 LInstruction* LChunkBuilder::DoCallRuntime(HCallRuntime* instr) {
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 return NULL; 1321 return NULL;
1320 } 1322 }
1321 1323
1322 1324
1323 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) { 1325 LInstruction* LChunkBuilder::DoBoundsCheck(HBoundsCheck* instr) {
1324 Abort("Unimplemented: %s", "DoBoundsCheck"); 1326 Abort("Unimplemented: %s", "DoBoundsCheck");
1325 return NULL; 1327 return NULL;
1326 } 1328 }
1327 1329
1328 1330
1331 LInstruction* LChunkBuilder::DoAbnormalExit(HAbnormalExit* instr) {
1332 // The control instruction marking the end of a block that completed
1333 // abruptly (e.g., threw an exception). There is nothing specific to do.
1334 return NULL;
1335 }
1336
1337
1329 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) { 1338 LInstruction* LChunkBuilder::DoThrow(HThrow* instr) {
1330 Abort("Unimplemented: %s", "DoThrow"); 1339 Abort("Unimplemented: %s", "DoThrow");
1331 return NULL; 1340 return NULL;
1332 } 1341 }
1333 1342
1334 1343
1335 LInstruction* LChunkBuilder::DoChange(HChange* instr) { 1344 LInstruction* LChunkBuilder::DoChange(HChange* instr) {
1336 Representation from = instr->from(); 1345 Representation from = instr->from();
1337 Representation to = instr->to(); 1346 Representation to = instr->to();
1338 if (from.IsTagged()) { 1347 if (from.IsTagged()) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 ASSERT(to.IsDouble()); 1397 ASSERT(to.IsDouble());
1389 return DefineAsRegister(new LInteger32ToDouble(Use(instr->value()))); 1398 return DefineAsRegister(new LInteger32ToDouble(Use(instr->value())));
1390 } 1399 }
1391 } 1400 }
1392 UNREACHABLE(); 1401 UNREACHABLE();
1393 return NULL; 1402 return NULL;
1394 } 1403 }
1395 1404
1396 1405
1397 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) { 1406 LInstruction* LChunkBuilder::DoCheckNonSmi(HCheckNonSmi* instr) {
1398 Abort("Unimplemented: %s", "DoCheckNonSmi"); 1407 LOperand* value = UseRegisterAtStart(instr->value());
1399 return NULL; 1408 return AssignEnvironment(new LCheckSmi(value, zero));
1400 } 1409 }
1401 1410
1402 1411
1403 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) { 1412 LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
1404 Abort("Unimplemented: %s", "DoCheckInstanceType"); 1413 Abort("Unimplemented: %s", "DoCheckInstanceType");
1405 return NULL; 1414 return NULL;
1406 } 1415 }
1407 1416
1408 1417
1409 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) { 1418 LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
1410 Abort("Unimplemented: %s", "DoCheckPrototypeMaps"); 1419 LOperand* temp = TempRegister();
1411 return NULL; 1420 LCheckPrototypeMaps* result = new LCheckPrototypeMaps(temp);
1421 return AssignEnvironment(result);
1412 } 1422 }
1413 1423
1414 1424
1415 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) { 1425 LInstruction* LChunkBuilder::DoCheckSmi(HCheckSmi* instr) {
1416 Abort("Unimplemented: %s", "DoCheckSmi"); 1426 LOperand* value = UseRegisterAtStart(instr->value());
1417 return NULL; 1427 return AssignEnvironment(new LCheckSmi(value, not_zero));
1418 } 1428 }
1419 1429
1420 1430
1421 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) { 1431 LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
1422 Abort("Unimplemented: %s", "DoCheckFunction"); 1432 LOperand* value = UseRegisterAtStart(instr->value());
1423 return NULL; 1433 return AssignEnvironment(new LCheckFunction(value));
1424 } 1434 }
1425 1435
1426 1436
1427 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) { 1437 LInstruction* LChunkBuilder::DoCheckMap(HCheckMap* instr) {
1428 Abort("Unimplemented: %s", "DoCheckMap"); 1438 LOperand* value = UseRegisterAtStart(instr->value());
1429 return NULL; 1439 LCheckMap* result = new LCheckMap(value);
1440 return AssignEnvironment(result);
1430 } 1441 }
1431 1442
1432 1443
1433 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) { 1444 LInstruction* LChunkBuilder::DoReturn(HReturn* instr) {
1434 return new LReturn(UseFixed(instr->value(), rax)); 1445 return new LReturn(UseFixed(instr->value(), rax));
1435 } 1446 }
1436 1447
1437 1448
1438 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) { 1449 LInstruction* LChunkBuilder::DoConstant(HConstant* instr) {
1439 Representation r = instr->representation(); 1450 Representation r = instr->representation();
1440 if (r.IsInteger32()) { 1451 if (r.IsInteger32()) {
1441 int32_t value = instr->Integer32Value(); 1452 int32_t value = instr->Integer32Value();
1442 return DefineAsRegister(new LConstantI(value)); 1453 return DefineAsRegister(new LConstantI(value));
1443 } else if (r.IsDouble()) { 1454 } else if (r.IsDouble()) {
1444 double value = instr->DoubleValue(); 1455 double value = instr->DoubleValue();
1445 LOperand* temp = TempRegister(); 1456 LOperand* temp = TempRegister();
1446 return DefineAsRegister(new LConstantD(value, temp)); 1457 return DefineAsRegister(new LConstantD(value, temp));
1447 } else if (r.IsTagged()) { 1458 } else if (r.IsTagged()) {
1448 return DefineAsRegister(new LConstantT(instr->handle())); 1459 return DefineAsRegister(new LConstantT(instr->handle()));
1449 } else { 1460 } else {
1450 UNREACHABLE(); 1461 UNREACHABLE();
1451 return NULL; 1462 return NULL;
1452 } 1463 }
1453 } 1464 }
1454 1465
1455 1466
1456 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) { 1467 LInstruction* LChunkBuilder::DoLoadGlobal(HLoadGlobal* instr) {
1457 Abort("Unimplemented: %s", "DoLoadGlobal"); 1468 LLoadGlobal* result = new LLoadGlobal;
1458 return NULL; 1469 return instr->check_hole_value()
1470 ? AssignEnvironment(DefineAsRegister(result))
1471 : DefineAsRegister(result);
1459 } 1472 }
1460 1473
1461 1474
1462 LInstruction* LChunkBuilder::DoStoreGlobal(HStoreGlobal* instr) { 1475 LInstruction* LChunkBuilder::DoStoreGlobal(HStoreGlobal* instr) {
1463 Abort("Unimplemented: %s", "DoStoreGlobal"); 1476 return new LStoreGlobal(UseRegisterAtStart(instr->value()));}
1464 return NULL;
1465 }
1466 1477
1467 1478
1468 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) { 1479 LInstruction* LChunkBuilder::DoLoadContextSlot(HLoadContextSlot* instr) {
1469 Abort("Unimplemented: %s", "DoLoadContextSlot"); 1480 Abort("Unimplemented: %s", "DoLoadContextSlot");
1470 return NULL; 1481 return NULL;
1471 } 1482 }
1472 1483
1473 1484
1474 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) { 1485 LInstruction* LChunkBuilder::DoLoadNamedField(HLoadNamedField* instr) {
1475 Abort("Unimplemented: %s", "DoLoadNamedField"); 1486 ASSERT(instr->representation().IsTagged());
1476 return NULL; 1487 LOperand* obj = UseRegisterAtStart(instr->object());
1488 return DefineAsRegister(new LLoadNamedField(obj));
1477 } 1489 }
1478 1490
1479 1491
1480 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) { 1492 LInstruction* LChunkBuilder::DoLoadNamedGeneric(HLoadNamedGeneric* instr) {
1481 Abort("Unimplemented: %s", "DoLoadNamedGeneric"); 1493 Abort("Unimplemented: %s", "DoLoadNamedGeneric");
1482 return NULL; 1494 return NULL;
1483 } 1495 }
1484 1496
1485 1497
1486 LInstruction* LChunkBuilder::DoLoadFunctionPrototype( 1498 LInstruction* LChunkBuilder::DoLoadFunctionPrototype(
(...skipping 29 matching lines...) Expand all
1516 } 1528 }
1517 1529
1518 1530
1519 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) { 1531 LInstruction* LChunkBuilder::DoStoreKeyedGeneric(HStoreKeyedGeneric* instr) {
1520 Abort("Unimplemented: %s", "DoStoreKeyedGeneric"); 1532 Abort("Unimplemented: %s", "DoStoreKeyedGeneric");
1521 return NULL; 1533 return NULL;
1522 } 1534 }
1523 1535
1524 1536
1525 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) { 1537 LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
1526 Abort("Unimplemented: %s", "DoStoreNamedField"); 1538 bool needs_write_barrier = instr->NeedsWriteBarrier();
1527 return NULL; 1539
1540 LOperand* obj = needs_write_barrier
1541 ? UseTempRegister(instr->object())
1542 : UseRegisterAtStart(instr->object());
1543
1544 LOperand* val = needs_write_barrier
1545 ? UseTempRegister(instr->value())
1546 : UseRegister(instr->value());
1547
1548 // We only need a scratch register if we have a write barrier or we
1549 // have a store into the properties array (not in-object-property).
1550 LOperand* temp = (!instr->is_in_object() || needs_write_barrier)
1551 ? TempRegister() : NULL;
1552
1553 return new LStoreNamedField(obj, val, temp);
1528 } 1554 }
1529 1555
1530 1556
1531 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) { 1557 LInstruction* LChunkBuilder::DoStoreNamedGeneric(HStoreNamedGeneric* instr) {
1532 Abort("Unimplemented: %s", "DoStoreNamedGeneric"); 1558 Abort("Unimplemented: %s", "DoStoreNamedGeneric");
1533 return NULL; 1559 return NULL;
1534 } 1560 }
1535 1561
1536 1562
1537 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) { 1563 LInstruction* LChunkBuilder::DoStringCharCodeAt(HStringCharCodeAt* instr) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1638 env->Push(value); 1664 env->Push(value);
1639 } 1665 }
1640 } 1666 }
1641 ASSERT(env->length() == instr->environment_length()); 1667 ASSERT(env->length() == instr->environment_length());
1642 1668
1643 // If there is an instruction pending deoptimization environment create a 1669 // If there is an instruction pending deoptimization environment create a
1644 // lazy bailout instruction to capture the environment. 1670 // lazy bailout instruction to capture the environment.
1645 if (pending_deoptimization_ast_id_ == instr->ast_id()) { 1671 if (pending_deoptimization_ast_id_ == instr->ast_id()) {
1646 LLazyBailout* lazy_bailout = new LLazyBailout; 1672 LLazyBailout* lazy_bailout = new LLazyBailout;
1647 LInstruction* result = AssignEnvironment(lazy_bailout); 1673 LInstruction* result = AssignEnvironment(lazy_bailout);
1648 instructions_pending_deoptimization_environment_-> 1674 instruction_pending_deoptimization_environment_->
1649 set_deoptimization_environment(result->environment()); 1675 set_deoptimization_environment(result->environment());
1650 ClearInstructionPendingDeoptimizationEnvironment(); 1676 ClearInstructionPendingDeoptimizationEnvironment();
1651 return result; 1677 return result;
1652 } 1678 }
1653 1679
1654 return NULL; 1680 return NULL;
1655 } 1681 }
1656 1682
1657 1683
1658 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 1684 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
1659 return MarkAsCall(new LStackCheck, instr); 1685 return MarkAsCall(new LStackCheck, instr);
1660 } 1686 }
1661 1687
1662 1688
1663 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { 1689 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
1664 Abort("Unimplemented: %s", "DoEnterInlined"); 1690 HEnvironment* outer = current_block_->last_environment();
1691 HConstant* undefined = graph()->GetConstantUndefined();
1692 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
1693 instr->function(),
1694 false,
1695 undefined);
1696 current_block_->UpdateEnvironment(inner);
1697 chunk_->AddInlinedClosure(instr->closure());
1665 return NULL; 1698 return NULL;
1666 } 1699 }
1667 1700
1668 1701
1669 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) { 1702 LInstruction* LChunkBuilder::DoLeaveInlined(HLeaveInlined* instr) {
1670 Abort("Unimplemented: %s", "DoLeaveInlined"); 1703 Abort("Unimplemented: %s", "DoLeaveInlined");
1671 return NULL; 1704 return NULL;
1672 } 1705 }
1673 1706
1674 } } // namespace v8::internal 1707 } } // namespace v8::internal
1675 1708
1676 #endif // V8_TARGET_ARCH_X64 1709 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/ast.cc ('K') | « src/x64/lithium-x64.h ('k') | src/x64/macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698