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

Side by Side Diff: src/arm/stub-cache-arm.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/accessors.cc ('k') | src/builtins.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 }; 831 };
832 832
833 833
834 // Generate code to check that a global property cell is empty. Create 834 // Generate code to check that a global property cell is empty. Create
835 // the property cell at compilation time if no cell exists for the 835 // the property cell at compilation time if no cell exists for the
836 // property. 836 // property.
837 static Object* GenerateCheckPropertyCell(MacroAssembler* masm, 837 static Object* GenerateCheckPropertyCell(MacroAssembler* masm,
838 GlobalObject* global, 838 GlobalObject* global,
839 String* name, 839 String* name,
840 Register scratch, 840 Register scratch,
841 Object* probe;
842 { TryAllocation t = global->EnsurePropertyCell(name);
843 if (!t->ToObject(&probe)) return t;
844 }
841 Label* miss) { 845 Label* miss) {
842 Object* probe = global->EnsurePropertyCell(name);
843 if (probe->IsFailure()) return probe;
844 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe); 846 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe);
845 ASSERT(cell->value()->IsTheHole()); 847 ASSERT(cell->value()->IsTheHole());
846 __ mov(scratch, Operand(Handle<Object>(cell))); 848 __ mov(scratch, Operand(Handle<Object>(cell)));
847 __ ldr(scratch, 849 __ ldr(scratch,
848 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); 850 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset));
849 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 851 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
850 __ cmp(scratch, ip); 852 __ cmp(scratch, ip);
851 __ b(ne, miss); 853 __ b(ne, miss);
852 return cell; 854 return cell;
853 } 855 }
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 1276 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
1275 __ cmp(r4, r3); 1277 __ cmp(r4, r3);
1276 __ b(ne, miss); 1278 __ b(ne, miss);
1277 } else { 1279 } else {
1278 __ cmp(r1, Operand(Handle<JSFunction>(function))); 1280 __ cmp(r1, Operand(Handle<JSFunction>(function)));
1279 __ b(ne, miss); 1281 __ b(ne, miss);
1280 } 1282 }
1281 } 1283 }
1282 1284
1283 1285
1286 Object* obj;
1287 { TryAllocation t =
1288 StubCache::ComputeCallMiss(arguments().immediate(), kind_);
1289 if (!t->ToObject(&obj)) return t;
1290 }
1284 Object* CallStubCompiler::GenerateMissBranch() { 1291 Object* CallStubCompiler::GenerateMissBranch() {
1285 Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_);
1286 if (obj->IsFailure()) return obj;
1287 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); 1292 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET);
1288 return obj; 1293 return obj;
1289 } 1294 }
1290 1295
1291 1296
1292 Object* CallStubCompiler::CompileCallField(JSObject* object, 1297 Object* CallStubCompiler::CompileCallField(JSObject* object,
1293 JSObject* holder, 1298 JSObject* holder,
1294 int index, 1299 int index,
1295 String* name) { 1300 String* name) {
1296 // ----------- S t a t e ------------- 1301 // ----------- S t a t e -------------
(...skipping 12 matching lines...) Expand all
1309 __ tst(r0, Operand(kSmiTagMask)); 1314 __ tst(r0, Operand(kSmiTagMask));
1310 __ b(eq, &miss); 1315 __ b(eq, &miss);
1311 1316
1312 // Do the right check and compute the holder register. 1317 // Do the right check and compute the holder register.
1313 Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss); 1318 Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss);
1314 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); 1319 GenerateFastPropertyLoad(masm(), r1, reg, holder, index);
1315 1320
1316 GenerateCallFunction(masm(), object, arguments(), &miss); 1321 GenerateCallFunction(masm(), object, arguments(), &miss);
1317 1322
1318 // Handle call cache miss. 1323 // Handle call cache miss.
1324 Object* obj;
1325 { TryAllocation t = GenerateMissBranch();
1326 if (!t->ToObject(&obj)) return t;
1327 }
1319 __ bind(&miss); 1328 __ bind(&miss);
1320 Object* obj = GenerateMissBranch();
1321 if (obj->IsFailure()) return obj;
1322 1329
1323 // Return the generated code. 1330 // Return the generated code.
1324 return GetCode(FIELD, name); 1331 return GetCode(FIELD, name);
1325 } 1332 }
1326 1333
1327 1334
1328 Object* CallStubCompiler::CompileArrayPushCall(Object* object, 1335 Object* CallStubCompiler::CompileArrayPushCall(Object* object,
1329 JSObject* holder, 1336 JSObject* holder,
1330 JSGlobalPropertyCell* cell, 1337 JSGlobalPropertyCell* cell,
1331 JSFunction* function, 1338 JSFunction* function,
(...skipping 21 matching lines...) Expand all
1353 __ b(eq, &miss); 1360 __ b(eq, &miss);
1354 1361
1355 // Check that the maps haven't changed. 1362 // Check that the maps haven't changed.
1356 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, r4, name, &miss); 1363 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, r4, name, &miss);
1357 1364
1358 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), 1365 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush),
1359 argc + 1, 1366 argc + 1,
1360 1); 1367 1);
1361 1368
1362 // Handle call cache miss. 1369 // Handle call cache miss.
1370 Object* obj;
1371 { TryAllocation t = GenerateMissBranch();
1372 if (!t->ToObject(&obj)) return t;
1373 }
1363 __ bind(&miss); 1374 __ bind(&miss);
1364 Object* obj = GenerateMissBranch();
1365 if (obj->IsFailure()) return obj;
1366 1375
1367 // Return the generated code. 1376 // Return the generated code.
1368 return GetCode(function); 1377 return GetCode(function);
1369 } 1378 }
1370 1379
1371 1380
1372 Object* CallStubCompiler::CompileArrayPopCall(Object* object, 1381 Object* CallStubCompiler::CompileArrayPopCall(Object* object,
1373 JSObject* holder, 1382 JSObject* holder,
1374 JSGlobalPropertyCell* cell, 1383 JSGlobalPropertyCell* cell,
1375 JSFunction* function, 1384 JSFunction* function,
(...skipping 21 matching lines...) Expand all
1397 __ b(eq, &miss); 1406 __ b(eq, &miss);
1398 1407
1399 // Check that the maps haven't changed. 1408 // Check that the maps haven't changed.
1400 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, r4, name, &miss); 1409 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, r4, name, &miss);
1401 1410
1402 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), 1411 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop),
1403 argc + 1, 1412 argc + 1,
1404 1); 1413 1);
1405 1414
1406 // Handle call cache miss. 1415 // Handle call cache miss.
1416 Object* obj;
1417 { TryAllocation t = GenerateMissBranch();
1418 if (!t->ToObject(&obj)) return t;
1419 }
1407 __ bind(&miss); 1420 __ bind(&miss);
1408 Object* obj = GenerateMissBranch();
1409 if (obj->IsFailure()) return obj;
1410 1421
1411 // Return the generated code. 1422 // Return the generated code.
1412 return GetCode(function); 1423 return GetCode(function);
1413 } 1424 }
1414 1425
1415 1426
1416 Object* CallStubCompiler::CompileStringCharCodeAtCall( 1427 Object* CallStubCompiler::CompileStringCharCodeAtCall(
1417 Object* object, 1428 Object* object,
1418 JSObject* holder, 1429 JSObject* holder,
1419 JSGlobalPropertyCell* cell, 1430 JSGlobalPropertyCell* cell,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 __ Ret(); 1480 __ Ret();
1470 1481
1471 ICRuntimeCallHelper call_helper; 1482 ICRuntimeCallHelper call_helper;
1472 char_code_at_generator.GenerateSlow(masm(), call_helper); 1483 char_code_at_generator.GenerateSlow(masm(), call_helper);
1473 1484
1474 __ bind(&index_out_of_range); 1485 __ bind(&index_out_of_range);
1475 __ LoadRoot(r0, Heap::kNanValueRootIndex); 1486 __ LoadRoot(r0, Heap::kNanValueRootIndex);
1476 __ Drop(argc + 1); 1487 __ Drop(argc + 1);
1477 __ Ret(); 1488 __ Ret();
1478 1489
1490 Object* obj;
1491 { TryAllocation t = GenerateMissBranch();
1492 if (!t->ToObject(&obj)) return t;
1493 }
1479 __ bind(&miss); 1494 __ bind(&miss);
1480 Object* obj = GenerateMissBranch();
1481 if (obj->IsFailure()) return obj;
1482 1495
1483 // Return the generated code. 1496 // Return the generated code.
1484 return GetCode(function); 1497 return GetCode(function);
1485 } 1498 }
1486 1499
1487 1500
1488 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, 1501 Object* CallStubCompiler::CompileStringCharAtCall(Object* object,
1489 JSObject* holder, 1502 JSObject* holder,
1490 JSGlobalPropertyCell* cell, 1503 JSGlobalPropertyCell* cell,
1491 JSFunction* function, 1504 JSFunction* function,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 __ Ret(); 1556 __ Ret();
1544 1557
1545 ICRuntimeCallHelper call_helper; 1558 ICRuntimeCallHelper call_helper;
1546 char_at_generator.GenerateSlow(masm(), call_helper); 1559 char_at_generator.GenerateSlow(masm(), call_helper);
1547 1560
1548 __ bind(&index_out_of_range); 1561 __ bind(&index_out_of_range);
1549 __ LoadRoot(r0, Heap::kEmptyStringRootIndex); 1562 __ LoadRoot(r0, Heap::kEmptyStringRootIndex);
1550 __ Drop(argc + 1); 1563 __ Drop(argc + 1);
1551 __ Ret(); 1564 __ Ret();
1552 1565
1566 Object* obj;
1567 { TryAllocation t = GenerateMissBranch();
1568 if (!t->ToObject(&obj)) return t;
1569 }
1553 __ bind(&miss); 1570 __ bind(&miss);
1554 Object* obj = GenerateMissBranch();
1555 if (obj->IsFailure()) return obj;
1556 1571
1557 // Return the generated code. 1572 // Return the generated code.
1558 return GetCode(function); 1573 return GetCode(function);
1559 } 1574 }
1560 1575
1561 1576
1562 Object* CallStubCompiler::CompileStringFromCharCodeCall( 1577 Object* CallStubCompiler::CompileStringFromCharCodeCall(
1563 Object* object, 1578 Object* object,
1564 JSObject* holder, 1579 JSObject* holder,
1565 JSGlobalPropertyCell* cell, 1580 JSGlobalPropertyCell* cell,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1617 1632
1618 ICRuntimeCallHelper call_helper; 1633 ICRuntimeCallHelper call_helper;
1619 char_from_code_generator.GenerateSlow(masm(), call_helper); 1634 char_from_code_generator.GenerateSlow(masm(), call_helper);
1620 1635
1621 // Tail call the full function. We do not have to patch the receiver 1636 // Tail call the full function. We do not have to patch the receiver
1622 // because the function makes no use of it. 1637 // because the function makes no use of it.
1623 __ bind(&slow); 1638 __ bind(&slow);
1624 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1639 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1625 1640
1626 __ bind(&miss); 1641 __ bind(&miss);
1642 Object* obj;
1643 { TryAllocation t = GenerateMissBranch();
1644 if (!t->ToObject(&obj)) return t;
1645 }
1627 // r2: function name. 1646 // r2: function name.
1628 Object* obj = GenerateMissBranch();
1629 if (obj->IsFailure()) return obj;
1630 1647
1631 // Return the generated code. 1648 // Return the generated code.
1632 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 1649 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
1633 } 1650 }
1634 1651
1635 1652
1636 Object* CallStubCompiler::CompileMathFloorCall(Object* object, 1653 Object* CallStubCompiler::CompileMathFloorCall(Object* object,
1637 JSObject* holder, 1654 JSObject* holder,
1638 JSGlobalPropertyCell* cell, 1655 JSGlobalPropertyCell* cell,
1639 JSFunction* function, 1656 JSFunction* function,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1729 __ str(r3, FieldMemOperand(r0, HeapNumber::kMantissaOffset)); 1746 __ str(r3, FieldMemOperand(r0, HeapNumber::kMantissaOffset));
1730 __ Drop(argc + 1); 1747 __ Drop(argc + 1);
1731 __ Ret(); 1748 __ Ret();
1732 1749
1733 // Tail call the full function. We do not have to patch the receiver 1750 // Tail call the full function. We do not have to patch the receiver
1734 // because the function makes no use of it. 1751 // because the function makes no use of it.
1735 __ bind(&slow); 1752 __ bind(&slow);
1736 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1753 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1737 1754
1738 __ bind(&miss); 1755 __ bind(&miss);
1756 Object* obj;
1757 { TryAllocation t = GenerateMissBranch();
1758 if (!t->ToObject(&obj)) return t;
1759 }
1739 // r2: function name. 1760 // r2: function name.
1740 Object* obj = GenerateMissBranch();
1741 if (obj->IsFailure()) return obj;
1742 1761
1743 // Return the generated code. 1762 // Return the generated code.
1744 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); 1763 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name);
1745 } 1764 }
1746 1765
1747 1766
1748 Object* CallStubCompiler::CompileCallConstant(Object* object, 1767 Object* CallStubCompiler::CompileCallConstant(Object* object,
1749 JSObject* holder, 1768 JSObject* holder,
1750 JSFunction* function, 1769 JSFunction* function,
1751 String* name, 1770 String* name,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 } else { 1902 } else {
1884 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); 1903 __ InvokeFunction(function, arguments(), JUMP_FUNCTION);
1885 } 1904 }
1886 1905
1887 // Handle call cache miss. 1906 // Handle call cache miss.
1888 __ bind(&miss); 1907 __ bind(&miss);
1889 if (depth != kInvalidProtoDepth) { 1908 if (depth != kInvalidProtoDepth) {
1890 FreeSpaceForFastApiCall(masm()); 1909 FreeSpaceForFastApiCall(masm());
1891 } 1910 }
1892 1911
1912 Object* obj;
1913 { TryAllocation t = GenerateMissBranch();
1914 if (!t->ToObject(&obj)) return t;
1915 }
1893 __ bind(&miss_in_smi_check); 1916 __ bind(&miss_in_smi_check);
1894 Object* obj = GenerateMissBranch();
1895 if (obj->IsFailure()) return obj;
1896 1917
1897 // Return the generated code. 1918 // Return the generated code.
1898 return GetCode(function); 1919 return GetCode(function);
1899 } 1920 }
1900 1921
1901 1922
1902 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, 1923 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object,
1903 JSObject* holder, 1924 JSObject* holder,
1904 String* name) { 1925 String* name) {
1905 // ----------- S t a t e ------------- 1926 // ----------- S t a t e -------------
(...skipping 27 matching lines...) Expand all
1933 &miss); 1954 &miss);
1934 1955
1935 // Move returned value, the function to call, to r1. 1956 // Move returned value, the function to call, to r1.
1936 __ mov(r1, r0); 1957 __ mov(r1, r0);
1937 // Restore receiver. 1958 // Restore receiver.
1938 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); 1959 __ ldr(r0, MemOperand(sp, argc * kPointerSize));
1939 1960
1940 GenerateCallFunction(masm(), object, arguments(), &miss); 1961 GenerateCallFunction(masm(), object, arguments(), &miss);
1941 1962
1942 // Handle call cache miss. 1963 // Handle call cache miss.
1964 Object* obj;
1965 { TryAllocation t = GenerateMissBranch();
1966 if (!t->ToObject(&obj)) return t;
1967 }
1943 __ bind(&miss); 1968 __ bind(&miss);
1944 Object* obj = GenerateMissBranch();
1945 if (obj->IsFailure()) return obj;
1946 1969
1947 // Return the generated code. 1970 // Return the generated code.
1948 return GetCode(INTERCEPTOR, name); 1971 return GetCode(INTERCEPTOR, name);
1949 } 1972 }
1950 1973
1951 1974
1952 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, 1975 Object* CallStubCompiler::CompileCallGlobal(JSObject* object,
1953 GlobalObject* holder, 1976 GlobalObject* holder,
1954 JSGlobalPropertyCell* cell, 1977 JSGlobalPropertyCell* cell,
1955 JSFunction* function, 1978 JSFunction* function,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1992 // Jump to the cached code (tail call). 2015 // Jump to the cached code (tail call).
1993 __ IncrementCounter(&Counters::call_global_inline, 1, r3, r4); 2016 __ IncrementCounter(&Counters::call_global_inline, 1, r3, r4);
1994 ASSERT(function->is_compiled()); 2017 ASSERT(function->is_compiled());
1995 Handle<Code> code(function->code()); 2018 Handle<Code> code(function->code());
1996 ParameterCount expected(function->shared()->formal_parameter_count()); 2019 ParameterCount expected(function->shared()->formal_parameter_count());
1997 __ InvokeCode(code, expected, arguments(), 2020 __ InvokeCode(code, expected, arguments(),
1998 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 2021 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
1999 2022
2000 // Handle call cache miss. 2023 // Handle call cache miss.
2001 __ bind(&miss); 2024 __ bind(&miss);
2025 Object* obj;
2026 { TryAllocation t = GenerateMissBranch();
2027 if (!t->ToObject(&obj)) return t;
2028 }
2002 __ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3); 2029 __ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3);
2003 Object* obj = GenerateMissBranch();
2004 if (obj->IsFailure()) return obj;
2005 2030
2006 // Return the generated code. 2031 // Return the generated code.
2007 return GetCode(NORMAL, name); 2032 return GetCode(NORMAL, name);
2008 } 2033 }
2009 2034
2010 2035
2011 Object* StoreStubCompiler::CompileStoreField(JSObject* object, 2036 Object* StoreStubCompiler::CompileStoreField(JSObject* object,
2012 int index, 2037 int index,
2013 Map* transition, 2038 Map* transition,
2014 String* name) { 2039 String* name) {
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
2694 // Return the generated code. 2719 // Return the generated code.
2695 return GetCode(); 2720 return GetCode();
2696 } 2721 }
2697 2722
2698 2723
2699 #undef __ 2724 #undef __
2700 2725
2701 } } // namespace v8::internal 2726 } } // namespace v8::internal
2702 2727
2703 #endif // V8_TARGET_ARCH_ARM 2728 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/accessors.cc ('k') | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698