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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 3522008: This is a little experiment to move Failure to a superclass above Object... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 2 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/x64/macro-assembler-x64.cc ('k') | no next file » | 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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 }; 793 };
794 794
795 795
796 // Generate code to check that a global property cell is empty. Create 796 // Generate code to check that a global property cell is empty. Create
797 // the property cell at compilation time if no cell exists for the 797 // the property cell at compilation time if no cell exists for the
798 // property. 798 // property.
799 static Object* GenerateCheckPropertyCell(MacroAssembler* masm, 799 static Object* GenerateCheckPropertyCell(MacroAssembler* masm,
800 GlobalObject* global, 800 GlobalObject* global,
801 String* name, 801 String* name,
802 Register scratch, 802 Register scratch,
803 Object* probe;
804 { TryAllocation t = global->EnsurePropertyCell(name);
805 if (!t->ToObject(&probe)) return t;
806 }
803 Label* miss) { 807 Label* miss) {
804 Object* probe = global->EnsurePropertyCell(name);
805 if (probe->IsFailure()) return probe;
806 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe); 808 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe);
807 ASSERT(cell->value()->IsTheHole()); 809 ASSERT(cell->value()->IsTheHole());
808 __ Move(scratch, Handle<Object>(cell)); 810 __ Move(scratch, Handle<Object>(cell));
809 __ Cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset), 811 __ Cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
810 Factory::the_hole_value()); 812 Factory::the_hole_value());
811 __ j(not_equal, miss); 813 __ j(not_equal, miss);
812 return cell; 814 return cell;
813 } 815 }
814 816
815 817
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 __ Move(rax, Handle<SharedFunctionInfo>(function->shared())); 874 __ Move(rax, Handle<SharedFunctionInfo>(function->shared()));
873 __ cmpq(FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset), rax); 875 __ cmpq(FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset), rax);
874 __ j(not_equal, miss); 876 __ j(not_equal, miss);
875 } else { 877 } else {
876 __ Cmp(rdi, Handle<JSFunction>(function)); 878 __ Cmp(rdi, Handle<JSFunction>(function));
877 __ j(not_equal, miss); 879 __ j(not_equal, miss);
878 } 880 }
879 } 881 }
880 882
881 883
884 Object* obj;
885 { TryAllocation t =
886 StubCache::ComputeCallMiss(arguments().immediate(), kind_);
887 if (!t->ToObject(&obj)) return t;
888 }
882 Object* CallStubCompiler::GenerateMissBranch() { 889 Object* CallStubCompiler::GenerateMissBranch() {
883 Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_);
884 if (obj->IsFailure()) return obj;
885 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); 890 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
886 return obj; 891 return obj;
887 } 892 }
888 893
889 894
890 Object* CallStubCompiler::CompileCallConstant(Object* object, 895 Object* CallStubCompiler::CompileCallConstant(Object* object,
891 JSObject* holder, 896 JSObject* holder,
892 JSFunction* function, 897 JSFunction* function,
893 String* name, 898 String* name,
894 StubCompiler::CheckType check) { 899 StubCompiler::CheckType check) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1031 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1027 } 1032 }
1028 1033
1029 // Handle call cache miss. 1034 // Handle call cache miss.
1030 __ bind(&miss); 1035 __ bind(&miss);
1031 if (depth != kInvalidProtoDepth) { 1036 if (depth != kInvalidProtoDepth) {
1032 FreeSpaceForFastApiCall(masm(), rax); 1037 FreeSpaceForFastApiCall(masm(), rax);
1033 } 1038 }
1034 1039
1035 // Handle call cache miss. 1040 // Handle call cache miss.
1041 Object* obj;
1042 { TryAllocation t = GenerateMissBranch();
1043 if (!t->ToObject(&obj)) return t;
1044 }
1036 __ bind(&miss_in_smi_check); 1045 __ bind(&miss_in_smi_check);
1037 Object* obj = GenerateMissBranch();
1038 if (obj->IsFailure()) return obj;
1039 1046
1040 // Return the generated code. 1047 // Return the generated code.
1041 return GetCode(function); 1048 return GetCode(function);
1042 } 1049 }
1043 1050
1044 1051
1045 Object* CallStubCompiler::CompileCallField(JSObject* object, 1052 Object* CallStubCompiler::CompileCallField(JSObject* object,
1046 JSObject* holder, 1053 JSObject* holder,
1047 int index, 1054 int index,
1048 String* name) { 1055 String* name) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 // necessary. 1088 // necessary.
1082 if (object->IsGlobalObject()) { 1089 if (object->IsGlobalObject()) {
1083 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); 1090 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
1084 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); 1091 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
1085 } 1092 }
1086 1093
1087 // Invoke the function. 1094 // Invoke the function.
1088 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); 1095 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION);
1089 1096
1090 // Handle call cache miss. 1097 // Handle call cache miss.
1098 Object* obj;
1099 { TryAllocation t = GenerateMissBranch();
1100 if (!t->ToObject(&obj)) return t;
1101 }
1091 __ bind(&miss); 1102 __ bind(&miss);
1092 Object* obj = GenerateMissBranch();
1093 if (obj->IsFailure()) return obj;
1094 1103
1095 // Return the generated code. 1104 // Return the generated code.
1096 return GetCode(FIELD, name); 1105 return GetCode(FIELD, name);
1097 } 1106 }
1098 1107
1099 1108
1100 Object* CallStubCompiler::CompileArrayPushCall(Object* object, 1109 Object* CallStubCompiler::CompileArrayPushCall(Object* object,
1101 JSObject* holder, 1110 JSObject* holder,
1102 JSGlobalPropertyCell* cell, 1111 JSGlobalPropertyCell* cell,
1103 JSFunction* function, 1112 JSFunction* function,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 // Elements are in new space, so write barrier is not required. 1248 // Elements are in new space, so write barrier is not required.
1240 __ ret((argc + 1) * kPointerSize); 1249 __ ret((argc + 1) * kPointerSize);
1241 } 1250 }
1242 1251
1243 __ bind(&call_builtin); 1252 __ bind(&call_builtin);
1244 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), 1253 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
1245 argc + 1, 1254 argc + 1,
1246 1); 1255 1);
1247 } 1256 }
1248 1257
1258 Object* obj;
1259 { TryAllocation t = GenerateMissBranch();
1260 if (!t->ToObject(&obj)) return t;
1261 }
1249 __ bind(&miss); 1262 __ bind(&miss);
1250 Object* obj = GenerateMissBranch();
1251 if (obj->IsFailure()) return obj;
1252 1263
1253 // Return the generated code. 1264 // Return the generated code.
1254 return GetCode(function); 1265 return GetCode(function);
1255 } 1266 }
1256 1267
1257 1268
1258 Object* CallStubCompiler::CompileArrayPopCall(Object* object, 1269 Object* CallStubCompiler::CompileArrayPopCall(Object* object,
1259 JSObject* holder, 1270 JSObject* holder,
1260 JSGlobalPropertyCell* cell, 1271 JSGlobalPropertyCell* cell,
1261 JSFunction* function, 1272 JSFunction* function,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 1332
1322 __ bind(&return_undefined); 1333 __ bind(&return_undefined);
1323 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 1334 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
1324 __ ret((argc + 1) * kPointerSize); 1335 __ ret((argc + 1) * kPointerSize);
1325 1336
1326 __ bind(&call_builtin); 1337 __ bind(&call_builtin);
1327 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), 1338 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop),
1328 argc + 1, 1339 argc + 1,
1329 1); 1340 1);
1330 1341
1342 Object* obj;
1343 { TryAllocation t = GenerateMissBranch();
1344 if (!t->ToObject(&obj)) return t;
1345 }
1331 __ bind(&miss); 1346 __ bind(&miss);
1332 Object* obj = GenerateMissBranch();
1333 if (obj->IsFailure()) return obj;
1334 1347
1335 // Return the generated code. 1348 // Return the generated code.
1336 return GetCode(function); 1349 return GetCode(function);
1337 } 1350 }
1338 1351
1339 1352
1340 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, 1353 Object* CallStubCompiler::CompileStringCharAtCall(Object* object,
1341 JSObject* holder, 1354 JSObject* holder,
1342 JSGlobalPropertyCell* cell, 1355 JSGlobalPropertyCell* cell,
1343 JSFunction* function, 1356 JSFunction* function,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 char_at_generator.GenerateFast(masm()); 1406 char_at_generator.GenerateFast(masm());
1394 __ ret((argc + 1) * kPointerSize); 1407 __ ret((argc + 1) * kPointerSize);
1395 1408
1396 ICRuntimeCallHelper call_helper; 1409 ICRuntimeCallHelper call_helper;
1397 char_at_generator.GenerateSlow(masm(), call_helper); 1410 char_at_generator.GenerateSlow(masm(), call_helper);
1398 1411
1399 __ bind(&index_out_of_range); 1412 __ bind(&index_out_of_range);
1400 __ LoadRoot(rax, Heap::kEmptyStringRootIndex); 1413 __ LoadRoot(rax, Heap::kEmptyStringRootIndex);
1401 __ ret((argc + 1) * kPointerSize); 1414 __ ret((argc + 1) * kPointerSize);
1402 1415
1416 Object* obj;
1417 { TryAllocation t = GenerateMissBranch();
1418 if (!t->ToObject(&obj)) return t;
1419 }
1403 __ bind(&miss); 1420 __ bind(&miss);
1404 Object* obj = GenerateMissBranch();
1405 if (obj->IsFailure()) return obj;
1406 1421
1407 // Return the generated code. 1422 // Return the generated code.
1408 return GetCode(function); 1423 return GetCode(function);
1409 } 1424 }
1410 1425
1411 1426
1412 Object* CallStubCompiler::CompileStringCharCodeAtCall( 1427 Object* CallStubCompiler::CompileStringCharCodeAtCall(
1413 Object* object, 1428 Object* object,
1414 JSObject* holder, 1429 JSObject* holder,
1415 JSGlobalPropertyCell* cell, 1430 JSGlobalPropertyCell* cell,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 char_code_at_generator.GenerateFast(masm()); 1478 char_code_at_generator.GenerateFast(masm());
1464 __ ret((argc + 1) * kPointerSize); 1479 __ ret((argc + 1) * kPointerSize);
1465 1480
1466 ICRuntimeCallHelper call_helper; 1481 ICRuntimeCallHelper call_helper;
1467 char_code_at_generator.GenerateSlow(masm(), call_helper); 1482 char_code_at_generator.GenerateSlow(masm(), call_helper);
1468 1483
1469 __ bind(&index_out_of_range); 1484 __ bind(&index_out_of_range);
1470 __ LoadRoot(rax, Heap::kNanValueRootIndex); 1485 __ LoadRoot(rax, Heap::kNanValueRootIndex);
1471 __ ret((argc + 1) * kPointerSize); 1486 __ ret((argc + 1) * kPointerSize);
1472 1487
1488 Object* obj;
1489 { TryAllocation t = GenerateMissBranch();
1490 if (!t->ToObject(&obj)) return t;
1491 }
1473 __ bind(&miss); 1492 __ bind(&miss);
1474 Object* obj = GenerateMissBranch();
1475 if (obj->IsFailure()) return obj;
1476 1493
1477 // Return the generated code. 1494 // Return the generated code.
1478 return GetCode(function); 1495 return GetCode(function);
1479 } 1496 }
1480 1497
1481 1498
1482 Object* CallStubCompiler::CompileStringFromCharCodeCall( 1499 Object* CallStubCompiler::CompileStringFromCharCodeCall(
1483 Object* object, 1500 Object* object,
1484 JSObject* holder, 1501 JSObject* holder,
1485 JSGlobalPropertyCell* cell, 1502 JSGlobalPropertyCell* cell,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 1549
1533 ICRuntimeCallHelper call_helper; 1550 ICRuntimeCallHelper call_helper;
1534 char_from_code_generator.GenerateSlow(masm(), call_helper); 1551 char_from_code_generator.GenerateSlow(masm(), call_helper);
1535 1552
1536 // Tail call the full function. We do not have to patch the receiver 1553 // Tail call the full function. We do not have to patch the receiver
1537 // because the function makes no use of it. 1554 // because the function makes no use of it.
1538 __ bind(&slow); 1555 __ bind(&slow);
1539 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1556 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1540 1557
1541 __ bind(&miss); 1558 __ bind(&miss);
1559 Object* obj;
1560 { TryAllocation t = GenerateMissBranch();
1561 if (!t->ToObject(&obj)) return t;
1562 }
1542 // rcx: function name. 1563 // rcx: function name.
1543 Object* obj = GenerateMissBranch();
1544 if (obj->IsFailure()) return obj;
1545 1564
1546 // Return the generated code. 1565 // Return the generated code.
1547 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 1566 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
1548 } 1567 }
1549 1568
1550 1569
1551 Object* CallStubCompiler::CompileMathFloorCall(Object* object, 1570 Object* CallStubCompiler::CompileMathFloorCall(Object* object,
1552 JSObject* holder, 1571 JSObject* holder,
1553 JSGlobalPropertyCell* cell, 1572 JSGlobalPropertyCell* cell,
1554 JSFunction* function, 1573 JSFunction* function,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1645 __ AllocateHeapNumber(rax, rdx, &slow); 1664 __ AllocateHeapNumber(rax, rdx, &slow);
1646 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx); 1665 __ movq(FieldOperand(rax, HeapNumber::kValueOffset), rbx);
1647 __ ret(2 * kPointerSize); 1666 __ ret(2 * kPointerSize);
1648 1667
1649 // Tail call the full function. We do not have to patch the receiver 1668 // Tail call the full function. We do not have to patch the receiver
1650 // because the function makes no use of it. 1669 // because the function makes no use of it.
1651 __ bind(&slow); 1670 __ bind(&slow);
1652 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1671 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1653 1672
1654 __ bind(&miss); 1673 __ bind(&miss);
1674 Object* obj;
1675 { TryAllocation t = GenerateMissBranch();
1676 if (!t->ToObject(&obj)) return t;
1677 }
1655 // rcx: function name. 1678 // rcx: function name.
1656 Object* obj = GenerateMissBranch();
1657 if (obj->IsFailure()) return obj;
1658 1679
1659 // Return the generated code. 1680 // Return the generated code.
1660 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 1681 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
1661 } 1682 }
1662 1683
1663 1684
1664 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, 1685 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object,
1665 JSObject* holder, 1686 JSObject* holder,
1666 String* name) { 1687 String* name) {
1667 // ----------- S t a t e ------------- 1688 // ----------- S t a t e -------------
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 if (object->IsGlobalObject()) { 1732 if (object->IsGlobalObject()) {
1712 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); 1733 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
1713 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); 1734 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
1714 } 1735 }
1715 1736
1716 // Invoke the function. 1737 // Invoke the function.
1717 __ movq(rdi, rax); 1738 __ movq(rdi, rax);
1718 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION); 1739 __ InvokeFunction(rdi, arguments(), JUMP_FUNCTION);
1719 1740
1720 // Handle load cache miss. 1741 // Handle load cache miss.
1742 Object* obj;
1743 { TryAllocation t = GenerateMissBranch();
1744 if (!t->ToObject(&obj)) return t;
1745 }
1721 __ bind(&miss); 1746 __ bind(&miss);
1722 Object* obj = GenerateMissBranch();
1723 if (obj->IsFailure()) return obj;
1724 1747
1725 // Return the generated code. 1748 // Return the generated code.
1726 return GetCode(INTERCEPTOR, name); 1749 return GetCode(INTERCEPTOR, name);
1727 } 1750 }
1728 1751
1729 1752
1730 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, 1753 Object* CallStubCompiler::CompileCallGlobal(JSObject* object,
1731 GlobalObject* holder, 1754 GlobalObject* holder,
1732 JSGlobalPropertyCell* cell, 1755 JSGlobalPropertyCell* cell,
1733 JSFunction* function, 1756 JSFunction* function,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 // Jump to the cached code (tail call). 1797 // Jump to the cached code (tail call).
1775 __ IncrementCounter(&Counters::call_global_inline, 1); 1798 __ IncrementCounter(&Counters::call_global_inline, 1);
1776 ASSERT(function->is_compiled()); 1799 ASSERT(function->is_compiled());
1777 Handle<Code> code(function->code()); 1800 Handle<Code> code(function->code());
1778 ParameterCount expected(function->shared()->formal_parameter_count()); 1801 ParameterCount expected(function->shared()->formal_parameter_count());
1779 __ InvokeCode(code, expected, arguments(), 1802 __ InvokeCode(code, expected, arguments(),
1780 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 1803 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
1781 1804
1782 // Handle call cache miss. 1805 // Handle call cache miss.
1783 __ bind(&miss); 1806 __ bind(&miss);
1807 Object* obj;
1808 { TryAllocation t = GenerateMissBranch();
1809 if (!t->ToObject(&obj)) return t;
1810 }
1784 __ IncrementCounter(&Counters::call_global_inline_miss, 1); 1811 __ IncrementCounter(&Counters::call_global_inline_miss, 1);
1785 Object* obj = GenerateMissBranch();
1786 if (obj->IsFailure()) return obj;
1787 1812
1788 // Return the generated code. 1813 // Return the generated code.
1789 return GetCode(NORMAL, name); 1814 return GetCode(NORMAL, name);
1790 } 1815 }
1791 1816
1792 1817
1793 Object* LoadStubCompiler::CompileLoadCallback(String* name, 1818 Object* LoadStubCompiler::CompileLoadCallback(String* name,
1794 JSObject* object, 1819 JSObject* object,
1795 JSObject* holder, 1820 JSObject* holder,
1796 AccessorInfo* callback) { 1821 AccessorInfo* callback) {
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 // Return the generated code. 2959 // Return the generated code.
2935 return GetCode(); 2960 return GetCode();
2936 } 2961 }
2937 2962
2938 2963
2939 #undef __ 2964 #undef __
2940 2965
2941 } } // namespace v8::internal 2966 } } // namespace v8::internal
2942 2967
2943 #endif // V8_TARGET_ARCH_X64 2968 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698