OLD | NEW |
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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 | 827 |
828 StubCompiler* stub_compiler_; | 828 StubCompiler* stub_compiler_; |
829 const ParameterCount& arguments_; | 829 const ParameterCount& arguments_; |
830 Register name_; | 830 Register name_; |
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 MUST_USE_RESULT static MaybeObject* GenerateCheckPropertyCell( |
838 GlobalObject* global, | 838 MacroAssembler* masm, |
839 String* name, | 839 GlobalObject* global, |
840 Register scratch, | 840 String* name, |
841 Label* miss) { | 841 Register scratch, |
842 Object* probe = global->EnsurePropertyCell(name); | 842 Label* miss) { |
843 if (probe->IsFailure()) return probe; | 843 Object* probe; |
| 844 { MaybeObject* maybe_probe = global->EnsurePropertyCell(name); |
| 845 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
| 846 } |
844 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe); | 847 JSGlobalPropertyCell* cell = JSGlobalPropertyCell::cast(probe); |
845 ASSERT(cell->value()->IsTheHole()); | 848 ASSERT(cell->value()->IsTheHole()); |
846 __ mov(scratch, Operand(Handle<Object>(cell))); | 849 __ mov(scratch, Operand(Handle<Object>(cell))); |
847 __ ldr(scratch, | 850 __ ldr(scratch, |
848 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); | 851 FieldMemOperand(scratch, JSGlobalPropertyCell::kValueOffset)); |
849 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 852 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
850 __ cmp(scratch, ip); | 853 __ cmp(scratch, ip); |
851 __ b(ne, miss); | 854 __ b(ne, miss); |
852 return cell; | 855 return cell; |
853 } | 856 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 890 |
888 // Only global objects and objects that do not require access | 891 // Only global objects and objects that do not require access |
889 // checks are allowed in stubs. | 892 // checks are allowed in stubs. |
890 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); | 893 ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded()); |
891 | 894 |
892 JSObject* prototype = JSObject::cast(current->GetPrototype()); | 895 JSObject* prototype = JSObject::cast(current->GetPrototype()); |
893 if (!current->HasFastProperties() && | 896 if (!current->HasFastProperties() && |
894 !current->IsJSGlobalObject() && | 897 !current->IsJSGlobalObject() && |
895 !current->IsJSGlobalProxy()) { | 898 !current->IsJSGlobalProxy()) { |
896 if (!name->IsSymbol()) { | 899 if (!name->IsSymbol()) { |
897 Object* lookup_result = Heap::LookupSymbol(name); | 900 MaybeObject* lookup_result = Heap::LookupSymbol(name); |
898 if (lookup_result->IsFailure()) { | 901 if (lookup_result->IsFailure()) { |
899 set_failure(Failure::cast(lookup_result)); | 902 set_failure(Failure::cast(lookup_result)); |
900 return reg; | 903 return reg; |
901 } else { | 904 } else { |
902 name = String::cast(lookup_result); | 905 name = String::cast(lookup_result->ToObjectUnchecked()); |
903 } | 906 } |
904 } | 907 } |
905 ASSERT(current->property_dictionary()->FindEntry(name) == | 908 ASSERT(current->property_dictionary()->FindEntry(name) == |
906 StringDictionary::kNotFound); | 909 StringDictionary::kNotFound); |
907 | 910 |
908 GenerateDictionaryNegativeLookup(masm(), | 911 GenerateDictionaryNegativeLookup(masm(), |
909 miss, | 912 miss, |
910 reg, | 913 reg, |
911 name, | 914 name, |
912 scratch1, | 915 scratch1, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 if (current->IsJSGlobalProxy()) { | 970 if (current->IsJSGlobalProxy()) { |
968 __ CheckAccessGlobalProxy(reg, scratch1, miss); | 971 __ CheckAccessGlobalProxy(reg, scratch1, miss); |
969 } | 972 } |
970 | 973 |
971 // If we've skipped any global objects, it's not enough to verify | 974 // If we've skipped any global objects, it's not enough to verify |
972 // that their maps haven't changed. We also need to check that the | 975 // that their maps haven't changed. We also need to check that the |
973 // property cell for the property is still empty. | 976 // property cell for the property is still empty. |
974 current = object; | 977 current = object; |
975 while (current != holder) { | 978 while (current != holder) { |
976 if (current->IsGlobalObject()) { | 979 if (current->IsGlobalObject()) { |
977 Object* cell = GenerateCheckPropertyCell(masm(), | 980 MaybeObject* cell = GenerateCheckPropertyCell(masm(), |
978 GlobalObject::cast(current), | 981 GlobalObject::cast(current), |
979 name, | 982 name, |
980 scratch1, | 983 scratch1, |
981 miss); | 984 miss); |
982 if (cell->IsFailure()) { | 985 if (cell->IsFailure()) { |
983 set_failure(Failure::cast(cell)); | 986 set_failure(Failure::cast(cell)); |
984 return reg; | 987 return reg; |
985 } | 988 } |
986 } | 989 } |
987 current = JSObject::cast(current->GetPrototype()); | 990 current = JSObject::cast(current->GetPrototype()); |
988 } | 991 } |
989 | 992 |
990 // Return the register containing the holder. | 993 // Return the register containing the holder. |
991 return reg; | 994 return reg; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1274 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1277 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
1275 __ cmp(r4, r3); | 1278 __ cmp(r4, r3); |
1276 __ b(ne, miss); | 1279 __ b(ne, miss); |
1277 } else { | 1280 } else { |
1278 __ cmp(r1, Operand(Handle<JSFunction>(function))); | 1281 __ cmp(r1, Operand(Handle<JSFunction>(function))); |
1279 __ b(ne, miss); | 1282 __ b(ne, miss); |
1280 } | 1283 } |
1281 } | 1284 } |
1282 | 1285 |
1283 | 1286 |
1284 Object* CallStubCompiler::GenerateMissBranch() { | 1287 MaybeObject* CallStubCompiler::GenerateMissBranch() { |
1285 Object* obj = StubCache::ComputeCallMiss(arguments().immediate(), kind_); | 1288 Object* obj; |
1286 if (obj->IsFailure()) return obj; | 1289 { MaybeObject* maybe_obj = |
| 1290 StubCache::ComputeCallMiss(arguments().immediate(), kind_); |
| 1291 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1292 } |
1287 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); | 1293 __ Jump(Handle<Code>(Code::cast(obj)), RelocInfo::CODE_TARGET); |
1288 return obj; | 1294 return obj; |
1289 } | 1295 } |
1290 | 1296 |
1291 | 1297 |
1292 Object* CallStubCompiler::CompileCallField(JSObject* object, | 1298 MaybeObject* CallStubCompiler::CompileCallField(JSObject* object, |
1293 JSObject* holder, | 1299 JSObject* holder, |
1294 int index, | 1300 int index, |
1295 String* name) { | 1301 String* name) { |
1296 // ----------- S t a t e ------------- | 1302 // ----------- S t a t e ------------- |
1297 // -- r2 : name | 1303 // -- r2 : name |
1298 // -- lr : return address | 1304 // -- lr : return address |
1299 // ----------------------------------- | 1305 // ----------------------------------- |
1300 Label miss; | 1306 Label miss; |
1301 | 1307 |
1302 GenerateNameCheck(name, &miss); | 1308 GenerateNameCheck(name, &miss); |
1303 | 1309 |
1304 const int argc = arguments().immediate(); | 1310 const int argc = arguments().immediate(); |
1305 | 1311 |
1306 // Get the receiver of the function from the stack into r0. | 1312 // Get the receiver of the function from the stack into r0. |
1307 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); | 1313 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
1308 // Check that the receiver isn't a smi. | 1314 // Check that the receiver isn't a smi. |
1309 __ tst(r0, Operand(kSmiTagMask)); | 1315 __ tst(r0, Operand(kSmiTagMask)); |
1310 __ b(eq, &miss); | 1316 __ b(eq, &miss); |
1311 | 1317 |
1312 // Do the right check and compute the holder register. | 1318 // Do the right check and compute the holder register. |
1313 Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss); | 1319 Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss); |
1314 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); | 1320 GenerateFastPropertyLoad(masm(), r1, reg, holder, index); |
1315 | 1321 |
1316 GenerateCallFunction(masm(), object, arguments(), &miss); | 1322 GenerateCallFunction(masm(), object, arguments(), &miss); |
1317 | 1323 |
1318 // Handle call cache miss. | 1324 // Handle call cache miss. |
1319 __ bind(&miss); | 1325 __ bind(&miss); |
1320 Object* obj = GenerateMissBranch(); | 1326 Object* obj; |
1321 if (obj->IsFailure()) return obj; | 1327 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1328 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1329 } |
1322 | 1330 |
1323 // Return the generated code. | 1331 // Return the generated code. |
1324 return GetCode(FIELD, name); | 1332 return GetCode(FIELD, name); |
1325 } | 1333 } |
1326 | 1334 |
1327 | 1335 |
1328 Object* CallStubCompiler::CompileArrayPushCall(Object* object, | 1336 MaybeObject* CallStubCompiler::CompileArrayPushCall(Object* object, |
1329 JSObject* holder, | 1337 JSObject* holder, |
1330 JSGlobalPropertyCell* cell, | 1338 JSGlobalPropertyCell* cell, |
1331 JSFunction* function, | 1339 JSFunction* function, |
1332 String* name) { | 1340 String* name) { |
1333 // ----------- S t a t e ------------- | 1341 // ----------- S t a t e ------------- |
1334 // -- r2 : name | 1342 // -- r2 : name |
1335 // -- lr : return address | 1343 // -- lr : return address |
1336 // ----------------------------------- | 1344 // ----------------------------------- |
1337 | 1345 |
1338 // TODO(639): faster implementation. | 1346 // TODO(639): faster implementation. |
1339 | 1347 |
1340 // If object is not an array, bail out to regular call. | 1348 // If object is not an array, bail out to regular call. |
1341 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value(); | 1349 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value(); |
1342 | 1350 |
(...skipping 11 matching lines...) Expand all Loading... |
1354 | 1362 |
1355 // Check that the maps haven't changed. | 1363 // Check that the maps haven't changed. |
1356 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, r4, name, &miss); | 1364 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, r4, name, &miss); |
1357 | 1365 |
1358 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), | 1366 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPush), |
1359 argc + 1, | 1367 argc + 1, |
1360 1); | 1368 1); |
1361 | 1369 |
1362 // Handle call cache miss. | 1370 // Handle call cache miss. |
1363 __ bind(&miss); | 1371 __ bind(&miss); |
1364 Object* obj = GenerateMissBranch(); | 1372 Object* obj; |
1365 if (obj->IsFailure()) return obj; | 1373 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1374 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1375 } |
1366 | 1376 |
1367 // Return the generated code. | 1377 // Return the generated code. |
1368 return GetCode(function); | 1378 return GetCode(function); |
1369 } | 1379 } |
1370 | 1380 |
1371 | 1381 |
1372 Object* CallStubCompiler::CompileArrayPopCall(Object* object, | 1382 MaybeObject* CallStubCompiler::CompileArrayPopCall(Object* object, |
1373 JSObject* holder, | 1383 JSObject* holder, |
1374 JSGlobalPropertyCell* cell, | 1384 JSGlobalPropertyCell* cell, |
1375 JSFunction* function, | 1385 JSFunction* function, |
1376 String* name) { | 1386 String* name) { |
1377 // ----------- S t a t e ------------- | 1387 // ----------- S t a t e ------------- |
1378 // -- r2 : name | 1388 // -- r2 : name |
1379 // -- lr : return address | 1389 // -- lr : return address |
1380 // ----------------------------------- | 1390 // ----------------------------------- |
1381 | 1391 |
1382 // TODO(642): faster implementation. | 1392 // TODO(642): faster implementation. |
1383 | 1393 |
1384 // If object is not an array, bail out to regular call. | 1394 // If object is not an array, bail out to regular call. |
1385 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value(); | 1395 if (!object->IsJSArray() || cell != NULL) return Heap::undefined_value(); |
1386 | 1396 |
(...skipping 11 matching lines...) Expand all Loading... |
1398 | 1408 |
1399 // Check that the maps haven't changed. | 1409 // Check that the maps haven't changed. |
1400 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, r4, name, &miss); | 1410 CheckPrototypes(JSObject::cast(object), r1, holder, r3, r0, r4, name, &miss); |
1401 | 1411 |
1402 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), | 1412 __ TailCallExternalReference(ExternalReference(Builtins::c_ArrayPop), |
1403 argc + 1, | 1413 argc + 1, |
1404 1); | 1414 1); |
1405 | 1415 |
1406 // Handle call cache miss. | 1416 // Handle call cache miss. |
1407 __ bind(&miss); | 1417 __ bind(&miss); |
1408 Object* obj = GenerateMissBranch(); | 1418 Object* obj; |
1409 if (obj->IsFailure()) return obj; | 1419 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1420 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1421 } |
1410 | 1422 |
1411 // Return the generated code. | 1423 // Return the generated code. |
1412 return GetCode(function); | 1424 return GetCode(function); |
1413 } | 1425 } |
1414 | 1426 |
1415 | 1427 |
1416 Object* CallStubCompiler::CompileStringCharCodeAtCall( | 1428 MaybeObject* CallStubCompiler::CompileStringCharCodeAtCall( |
1417 Object* object, | 1429 Object* object, |
1418 JSObject* holder, | 1430 JSObject* holder, |
1419 JSGlobalPropertyCell* cell, | 1431 JSGlobalPropertyCell* cell, |
1420 JSFunction* function, | 1432 JSFunction* function, |
1421 String* name) { | 1433 String* name) { |
1422 // ----------- S t a t e ------------- | 1434 // ----------- S t a t e ------------- |
1423 // -- r2 : function name | 1435 // -- r2 : function name |
1424 // -- lr : return address | 1436 // -- lr : return address |
1425 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) | 1437 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
1426 // -- ... | 1438 // -- ... |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 | 1482 |
1471 ICRuntimeCallHelper call_helper; | 1483 ICRuntimeCallHelper call_helper; |
1472 char_code_at_generator.GenerateSlow(masm(), call_helper); | 1484 char_code_at_generator.GenerateSlow(masm(), call_helper); |
1473 | 1485 |
1474 __ bind(&index_out_of_range); | 1486 __ bind(&index_out_of_range); |
1475 __ LoadRoot(r0, Heap::kNanValueRootIndex); | 1487 __ LoadRoot(r0, Heap::kNanValueRootIndex); |
1476 __ Drop(argc + 1); | 1488 __ Drop(argc + 1); |
1477 __ Ret(); | 1489 __ Ret(); |
1478 | 1490 |
1479 __ bind(&miss); | 1491 __ bind(&miss); |
1480 Object* obj = GenerateMissBranch(); | 1492 Object* obj; |
1481 if (obj->IsFailure()) return obj; | 1493 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1494 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1495 } |
1482 | 1496 |
1483 // Return the generated code. | 1497 // Return the generated code. |
1484 return GetCode(function); | 1498 return GetCode(function); |
1485 } | 1499 } |
1486 | 1500 |
1487 | 1501 |
1488 Object* CallStubCompiler::CompileStringCharAtCall(Object* object, | 1502 MaybeObject* CallStubCompiler::CompileStringCharAtCall( |
1489 JSObject* holder, | 1503 Object* object, |
1490 JSGlobalPropertyCell* cell, | 1504 JSObject* holder, |
1491 JSFunction* function, | 1505 JSGlobalPropertyCell* cell, |
1492 String* name) { | 1506 JSFunction* function, |
| 1507 String* name) { |
1493 // ----------- S t a t e ------------- | 1508 // ----------- S t a t e ------------- |
1494 // -- r2 : function name | 1509 // -- r2 : function name |
1495 // -- lr : return address | 1510 // -- lr : return address |
1496 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) | 1511 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
1497 // -- ... | 1512 // -- ... |
1498 // -- sp[argc * 4] : receiver | 1513 // -- sp[argc * 4] : receiver |
1499 // ----------------------------------- | 1514 // ----------------------------------- |
1500 | 1515 |
1501 // If object is not a string, bail out to regular call. | 1516 // If object is not a string, bail out to regular call. |
1502 if (!object->IsString() || cell != NULL) return Heap::undefined_value(); | 1517 if (!object->IsString() || cell != NULL) return Heap::undefined_value(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 | 1559 |
1545 ICRuntimeCallHelper call_helper; | 1560 ICRuntimeCallHelper call_helper; |
1546 char_at_generator.GenerateSlow(masm(), call_helper); | 1561 char_at_generator.GenerateSlow(masm(), call_helper); |
1547 | 1562 |
1548 __ bind(&index_out_of_range); | 1563 __ bind(&index_out_of_range); |
1549 __ LoadRoot(r0, Heap::kEmptyStringRootIndex); | 1564 __ LoadRoot(r0, Heap::kEmptyStringRootIndex); |
1550 __ Drop(argc + 1); | 1565 __ Drop(argc + 1); |
1551 __ Ret(); | 1566 __ Ret(); |
1552 | 1567 |
1553 __ bind(&miss); | 1568 __ bind(&miss); |
1554 Object* obj = GenerateMissBranch(); | 1569 Object* obj; |
1555 if (obj->IsFailure()) return obj; | 1570 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1571 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1572 } |
1556 | 1573 |
1557 // Return the generated code. | 1574 // Return the generated code. |
1558 return GetCode(function); | 1575 return GetCode(function); |
1559 } | 1576 } |
1560 | 1577 |
1561 | 1578 |
1562 Object* CallStubCompiler::CompileStringFromCharCodeCall( | 1579 MaybeObject* CallStubCompiler::CompileStringFromCharCodeCall( |
1563 Object* object, | 1580 Object* object, |
1564 JSObject* holder, | 1581 JSObject* holder, |
1565 JSGlobalPropertyCell* cell, | 1582 JSGlobalPropertyCell* cell, |
1566 JSFunction* function, | 1583 JSFunction* function, |
1567 String* name) { | 1584 String* name) { |
1568 // ----------- S t a t e ------------- | 1585 // ----------- S t a t e ------------- |
1569 // -- r2 : function name | 1586 // -- r2 : function name |
1570 // -- lr : return address | 1587 // -- lr : return address |
1571 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) | 1588 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
1572 // -- ... | 1589 // -- ... |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 ICRuntimeCallHelper call_helper; | 1635 ICRuntimeCallHelper call_helper; |
1619 char_from_code_generator.GenerateSlow(masm(), call_helper); | 1636 char_from_code_generator.GenerateSlow(masm(), call_helper); |
1620 | 1637 |
1621 // Tail call the full function. We do not have to patch the receiver | 1638 // Tail call the full function. We do not have to patch the receiver |
1622 // because the function makes no use of it. | 1639 // because the function makes no use of it. |
1623 __ bind(&slow); | 1640 __ bind(&slow); |
1624 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1641 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
1625 | 1642 |
1626 __ bind(&miss); | 1643 __ bind(&miss); |
1627 // r2: function name. | 1644 // r2: function name. |
1628 Object* obj = GenerateMissBranch(); | 1645 Object* obj; |
1629 if (obj->IsFailure()) return obj; | 1646 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1647 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1648 } |
1630 | 1649 |
1631 // Return the generated code. | 1650 // Return the generated code. |
1632 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 1651 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
1633 } | 1652 } |
1634 | 1653 |
1635 | 1654 |
1636 Object* CallStubCompiler::CompileMathFloorCall(Object* object, | 1655 MaybeObject* CallStubCompiler::CompileMathFloorCall(Object* object, |
1637 JSObject* holder, | 1656 JSObject* holder, |
1638 JSGlobalPropertyCell* cell, | 1657 JSGlobalPropertyCell* cell, |
1639 JSFunction* function, | 1658 JSFunction* function, |
1640 String* name) { | 1659 String* name) { |
1641 // TODO(872): implement this. | 1660 // TODO(872): implement this. |
1642 return Heap::undefined_value(); | 1661 return Heap::undefined_value(); |
1643 } | 1662 } |
1644 | 1663 |
1645 | 1664 |
1646 Object* CallStubCompiler::CompileMathAbsCall(Object* object, | 1665 MaybeObject* CallStubCompiler::CompileMathAbsCall(Object* object, |
1647 JSObject* holder, | 1666 JSObject* holder, |
1648 JSGlobalPropertyCell* cell, | 1667 JSGlobalPropertyCell* cell, |
1649 JSFunction* function, | 1668 JSFunction* function, |
1650 String* name) { | 1669 String* name) { |
1651 // ----------- S t a t e ------------- | 1670 // ----------- S t a t e ------------- |
1652 // -- r2 : function name | 1671 // -- r2 : function name |
1653 // -- lr : return address | 1672 // -- lr : return address |
1654 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) | 1673 // -- sp[(argc - n - 1) * 4] : arg[n] (zero-based) |
1655 // -- ... | 1674 // -- ... |
1656 // -- sp[argc * 4] : receiver | 1675 // -- sp[argc * 4] : receiver |
1657 // ----------------------------------- | 1676 // ----------------------------------- |
1658 | 1677 |
1659 const int argc = arguments().immediate(); | 1678 const int argc = arguments().immediate(); |
1660 | 1679 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1730 __ Drop(argc + 1); | 1749 __ Drop(argc + 1); |
1731 __ Ret(); | 1750 __ Ret(); |
1732 | 1751 |
1733 // Tail call the full function. We do not have to patch the receiver | 1752 // Tail call the full function. We do not have to patch the receiver |
1734 // because the function makes no use of it. | 1753 // because the function makes no use of it. |
1735 __ bind(&slow); | 1754 __ bind(&slow); |
1736 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1755 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
1737 | 1756 |
1738 __ bind(&miss); | 1757 __ bind(&miss); |
1739 // r2: function name. | 1758 // r2: function name. |
1740 Object* obj = GenerateMissBranch(); | 1759 Object* obj; |
1741 if (obj->IsFailure()) return obj; | 1760 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1761 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1762 } |
1742 | 1763 |
1743 // Return the generated code. | 1764 // Return the generated code. |
1744 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); | 1765 return (cell == NULL) ? GetCode(function) : GetCode(NORMAL, name); |
1745 } | 1766 } |
1746 | 1767 |
1747 | 1768 |
1748 Object* CallStubCompiler::CompileCallConstant(Object* object, | 1769 MaybeObject* CallStubCompiler::CompileCallConstant(Object* object, |
1749 JSObject* holder, | 1770 JSObject* holder, |
1750 JSFunction* function, | 1771 JSFunction* function, |
1751 String* name, | 1772 String* name, |
1752 CheckType check) { | 1773 CheckType check) { |
1753 // ----------- S t a t e ------------- | 1774 // ----------- S t a t e ------------- |
1754 // -- r2 : name | 1775 // -- r2 : name |
1755 // -- lr : return address | 1776 // -- lr : return address |
1756 // ----------------------------------- | 1777 // ----------------------------------- |
1757 SharedFunctionInfo* function_info = function->shared(); | 1778 SharedFunctionInfo* function_info = function->shared(); |
1758 if (function_info->HasCustomCallGenerator()) { | 1779 if (function_info->HasCustomCallGenerator()) { |
1759 const int id = function_info->custom_call_generator_id(); | 1780 const int id = function_info->custom_call_generator_id(); |
1760 Object* result = CompileCustomCall( | 1781 MaybeObject* maybe_result = CompileCustomCall( |
1761 id, object, holder, NULL, function, name); | 1782 id, object, holder, NULL, function, name); |
| 1783 Object* result; |
| 1784 if (!maybe_result->ToObject(&result)) return maybe_result; |
1762 // undefined means bail out to regular compiler. | 1785 // undefined means bail out to regular compiler. |
1763 if (!result->IsUndefined()) { | 1786 if (!result->IsUndefined()) { |
1764 return result; | 1787 return result; |
1765 } | 1788 } |
1766 } | 1789 } |
1767 | 1790 |
1768 Label miss_in_smi_check; | 1791 Label miss_in_smi_check; |
1769 | 1792 |
1770 GenerateNameCheck(name, &miss_in_smi_check); | 1793 GenerateNameCheck(name, &miss_in_smi_check); |
1771 | 1794 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1884 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); | 1907 __ InvokeFunction(function, arguments(), JUMP_FUNCTION); |
1885 } | 1908 } |
1886 | 1909 |
1887 // Handle call cache miss. | 1910 // Handle call cache miss. |
1888 __ bind(&miss); | 1911 __ bind(&miss); |
1889 if (depth != kInvalidProtoDepth) { | 1912 if (depth != kInvalidProtoDepth) { |
1890 FreeSpaceForFastApiCall(masm()); | 1913 FreeSpaceForFastApiCall(masm()); |
1891 } | 1914 } |
1892 | 1915 |
1893 __ bind(&miss_in_smi_check); | 1916 __ bind(&miss_in_smi_check); |
1894 Object* obj = GenerateMissBranch(); | 1917 Object* obj; |
1895 if (obj->IsFailure()) return obj; | 1918 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1919 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1920 } |
1896 | 1921 |
1897 // Return the generated code. | 1922 // Return the generated code. |
1898 return GetCode(function); | 1923 return GetCode(function); |
1899 } | 1924 } |
1900 | 1925 |
1901 | 1926 |
1902 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, | 1927 MaybeObject* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
1903 JSObject* holder, | 1928 JSObject* holder, |
1904 String* name) { | 1929 String* name) { |
1905 // ----------- S t a t e ------------- | 1930 // ----------- S t a t e ------------- |
1906 // -- r2 : name | 1931 // -- r2 : name |
1907 // -- lr : return address | 1932 // -- lr : return address |
1908 // ----------------------------------- | 1933 // ----------------------------------- |
1909 | 1934 |
1910 Label miss; | 1935 Label miss; |
1911 | 1936 |
1912 GenerateNameCheck(name, &miss); | 1937 GenerateNameCheck(name, &miss); |
1913 | 1938 |
1914 // Get the number of arguments. | 1939 // Get the number of arguments. |
(...skipping 19 matching lines...) Expand all Loading... |
1934 | 1959 |
1935 // Move returned value, the function to call, to r1. | 1960 // Move returned value, the function to call, to r1. |
1936 __ mov(r1, r0); | 1961 __ mov(r1, r0); |
1937 // Restore receiver. | 1962 // Restore receiver. |
1938 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); | 1963 __ ldr(r0, MemOperand(sp, argc * kPointerSize)); |
1939 | 1964 |
1940 GenerateCallFunction(masm(), object, arguments(), &miss); | 1965 GenerateCallFunction(masm(), object, arguments(), &miss); |
1941 | 1966 |
1942 // Handle call cache miss. | 1967 // Handle call cache miss. |
1943 __ bind(&miss); | 1968 __ bind(&miss); |
1944 Object* obj = GenerateMissBranch(); | 1969 Object* obj; |
1945 if (obj->IsFailure()) return obj; | 1970 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 1971 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 1972 } |
1946 | 1973 |
1947 // Return the generated code. | 1974 // Return the generated code. |
1948 return GetCode(INTERCEPTOR, name); | 1975 return GetCode(INTERCEPTOR, name); |
1949 } | 1976 } |
1950 | 1977 |
1951 | 1978 |
1952 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, | 1979 MaybeObject* CallStubCompiler::CompileCallGlobal(JSObject* object, |
1953 GlobalObject* holder, | 1980 GlobalObject* holder, |
1954 JSGlobalPropertyCell* cell, | 1981 JSGlobalPropertyCell* cell, |
1955 JSFunction* function, | 1982 JSFunction* function, |
1956 String* name) { | 1983 String* name) { |
1957 // ----------- S t a t e ------------- | 1984 // ----------- S t a t e ------------- |
1958 // -- r2 : name | 1985 // -- r2 : name |
1959 // -- lr : return address | 1986 // -- lr : return address |
1960 // ----------------------------------- | 1987 // ----------------------------------- |
1961 | 1988 |
1962 SharedFunctionInfo* function_info = function->shared(); | 1989 SharedFunctionInfo* function_info = function->shared(); |
1963 if (function_info->HasCustomCallGenerator()) { | 1990 if (function_info->HasCustomCallGenerator()) { |
1964 const int id = function_info->custom_call_generator_id(); | 1991 const int id = function_info->custom_call_generator_id(); |
1965 Object* result = CompileCustomCall( | 1992 MaybeObject* maybe_result = CompileCustomCall( |
1966 id, object, holder, cell, function, name); | 1993 id, object, holder, cell, function, name); |
| 1994 Object* result; |
| 1995 if (!maybe_result->ToObject(&result)) return maybe_result; |
1967 // undefined means bail out to regular compiler. | 1996 // undefined means bail out to regular compiler. |
1968 if (!result->IsUndefined()) return result; | 1997 if (!result->IsUndefined()) return result; |
1969 } | 1998 } |
1970 | 1999 |
1971 Label miss; | 2000 Label miss; |
1972 | 2001 |
1973 GenerateNameCheck(name, &miss); | 2002 GenerateNameCheck(name, &miss); |
1974 | 2003 |
1975 // Get the number of arguments. | 2004 // Get the number of arguments. |
1976 const int argc = arguments().immediate(); | 2005 const int argc = arguments().immediate(); |
(...skipping 16 matching lines...) Expand all Loading... |
1993 __ IncrementCounter(&Counters::call_global_inline, 1, r3, r4); | 2022 __ IncrementCounter(&Counters::call_global_inline, 1, r3, r4); |
1994 ASSERT(function->is_compiled()); | 2023 ASSERT(function->is_compiled()); |
1995 Handle<Code> code(function->code()); | 2024 Handle<Code> code(function->code()); |
1996 ParameterCount expected(function->shared()->formal_parameter_count()); | 2025 ParameterCount expected(function->shared()->formal_parameter_count()); |
1997 __ InvokeCode(code, expected, arguments(), | 2026 __ InvokeCode(code, expected, arguments(), |
1998 RelocInfo::CODE_TARGET, JUMP_FUNCTION); | 2027 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
1999 | 2028 |
2000 // Handle call cache miss. | 2029 // Handle call cache miss. |
2001 __ bind(&miss); | 2030 __ bind(&miss); |
2002 __ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3); | 2031 __ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3); |
2003 Object* obj = GenerateMissBranch(); | 2032 Object* obj; |
2004 if (obj->IsFailure()) return obj; | 2033 { MaybeObject* maybe_obj = GenerateMissBranch(); |
| 2034 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2035 } |
2005 | 2036 |
2006 // Return the generated code. | 2037 // Return the generated code. |
2007 return GetCode(NORMAL, name); | 2038 return GetCode(NORMAL, name); |
2008 } | 2039 } |
2009 | 2040 |
2010 | 2041 |
2011 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 2042 MaybeObject* StoreStubCompiler::CompileStoreField(JSObject* object, |
2012 int index, | 2043 int index, |
2013 Map* transition, | 2044 Map* transition, |
2014 String* name) { | 2045 String* name) { |
2015 // ----------- S t a t e ------------- | 2046 // ----------- S t a t e ------------- |
2016 // -- r0 : value | 2047 // -- r0 : value |
2017 // -- r1 : receiver | 2048 // -- r1 : receiver |
2018 // -- r2 : name | 2049 // -- r2 : name |
2019 // -- lr : return address | 2050 // -- lr : return address |
2020 // ----------------------------------- | 2051 // ----------------------------------- |
2021 Label miss; | 2052 Label miss; |
2022 | 2053 |
2023 GenerateStoreField(masm(), | 2054 GenerateStoreField(masm(), |
2024 object, | 2055 object, |
2025 index, | 2056 index, |
2026 transition, | 2057 transition, |
2027 r1, r2, r3, | 2058 r1, r2, r3, |
2028 &miss); | 2059 &miss); |
2029 __ bind(&miss); | 2060 __ bind(&miss); |
2030 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2061 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2031 __ Jump(ic, RelocInfo::CODE_TARGET); | 2062 __ Jump(ic, RelocInfo::CODE_TARGET); |
2032 | 2063 |
2033 // Return the generated code. | 2064 // Return the generated code. |
2034 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 2065 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
2035 } | 2066 } |
2036 | 2067 |
2037 | 2068 |
2038 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, | 2069 MaybeObject* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
2039 AccessorInfo* callback, | 2070 AccessorInfo* callback, |
2040 String* name) { | 2071 String* name) { |
2041 // ----------- S t a t e ------------- | 2072 // ----------- S t a t e ------------- |
2042 // -- r0 : value | 2073 // -- r0 : value |
2043 // -- r1 : receiver | 2074 // -- r1 : receiver |
2044 // -- r2 : name | 2075 // -- r2 : name |
2045 // -- lr : return address | 2076 // -- lr : return address |
2046 // ----------------------------------- | 2077 // ----------------------------------- |
2047 Label miss; | 2078 Label miss; |
2048 | 2079 |
2049 // Check that the object isn't a smi. | 2080 // Check that the object isn't a smi. |
2050 __ tst(r1, Operand(kSmiTagMask)); | 2081 __ tst(r1, Operand(kSmiTagMask)); |
(...skipping 25 matching lines...) Expand all Loading... |
2076 // Handle store cache miss. | 2107 // Handle store cache miss. |
2077 __ bind(&miss); | 2108 __ bind(&miss); |
2078 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2109 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2079 __ Jump(ic, RelocInfo::CODE_TARGET); | 2110 __ Jump(ic, RelocInfo::CODE_TARGET); |
2080 | 2111 |
2081 // Return the generated code. | 2112 // Return the generated code. |
2082 return GetCode(CALLBACKS, name); | 2113 return GetCode(CALLBACKS, name); |
2083 } | 2114 } |
2084 | 2115 |
2085 | 2116 |
2086 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, | 2117 MaybeObject* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
2087 String* name) { | 2118 String* name) { |
2088 // ----------- S t a t e ------------- | 2119 // ----------- S t a t e ------------- |
2089 // -- r0 : value | 2120 // -- r0 : value |
2090 // -- r1 : receiver | 2121 // -- r1 : receiver |
2091 // -- r2 : name | 2122 // -- r2 : name |
2092 // -- lr : return address | 2123 // -- lr : return address |
2093 // ----------------------------------- | 2124 // ----------------------------------- |
2094 Label miss; | 2125 Label miss; |
2095 | 2126 |
2096 // Check that the object isn't a smi. | 2127 // Check that the object isn't a smi. |
2097 __ tst(r1, Operand(kSmiTagMask)); | 2128 __ tst(r1, Operand(kSmiTagMask)); |
(...skipping 23 matching lines...) Expand all Loading... |
2121 // Handle store cache miss. | 2152 // Handle store cache miss. |
2122 __ bind(&miss); | 2153 __ bind(&miss); |
2123 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2154 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2124 __ Jump(ic, RelocInfo::CODE_TARGET); | 2155 __ Jump(ic, RelocInfo::CODE_TARGET); |
2125 | 2156 |
2126 // Return the generated code. | 2157 // Return the generated code. |
2127 return GetCode(INTERCEPTOR, name); | 2158 return GetCode(INTERCEPTOR, name); |
2128 } | 2159 } |
2129 | 2160 |
2130 | 2161 |
2131 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, | 2162 MaybeObject* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, |
2132 JSGlobalPropertyCell* cell, | 2163 JSGlobalPropertyCell* cell, |
2133 String* name) { | 2164 String* name) { |
2134 // ----------- S t a t e ------------- | 2165 // ----------- S t a t e ------------- |
2135 // -- r0 : value | 2166 // -- r0 : value |
2136 // -- r1 : receiver | 2167 // -- r1 : receiver |
2137 // -- r2 : name | 2168 // -- r2 : name |
2138 // -- lr : return address | 2169 // -- lr : return address |
2139 // ----------------------------------- | 2170 // ----------------------------------- |
2140 Label miss; | 2171 Label miss; |
2141 | 2172 |
2142 // Check that the map of the global has not changed. | 2173 // Check that the map of the global has not changed. |
2143 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); | 2174 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); |
(...skipping 11 matching lines...) Expand all Loading... |
2155 __ bind(&miss); | 2186 __ bind(&miss); |
2156 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1, r4, r3); | 2187 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1, r4, r3); |
2157 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 2188 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
2158 __ Jump(ic, RelocInfo::CODE_TARGET); | 2189 __ Jump(ic, RelocInfo::CODE_TARGET); |
2159 | 2190 |
2160 // Return the generated code. | 2191 // Return the generated code. |
2161 return GetCode(NORMAL, name); | 2192 return GetCode(NORMAL, name); |
2162 } | 2193 } |
2163 | 2194 |
2164 | 2195 |
2165 Object* LoadStubCompiler::CompileLoadNonexistent(String* name, | 2196 MaybeObject* LoadStubCompiler::CompileLoadNonexistent(String* name, |
2166 JSObject* object, | 2197 JSObject* object, |
2167 JSObject* last) { | 2198 JSObject* last) { |
2168 // ----------- S t a t e ------------- | 2199 // ----------- S t a t e ------------- |
2169 // -- r0 : receiver | 2200 // -- r0 : receiver |
2170 // -- lr : return address | 2201 // -- lr : return address |
2171 // ----------------------------------- | 2202 // ----------------------------------- |
2172 Label miss; | 2203 Label miss; |
2173 | 2204 |
2174 // Check that receiver is not a smi. | 2205 // Check that receiver is not a smi. |
2175 __ tst(r0, Operand(kSmiTagMask)); | 2206 __ tst(r0, Operand(kSmiTagMask)); |
2176 __ b(eq, &miss); | 2207 __ b(eq, &miss); |
2177 | 2208 |
2178 // Check the maps of the full prototype chain. | 2209 // Check the maps of the full prototype chain. |
2179 CheckPrototypes(object, r0, last, r3, r1, r4, name, &miss); | 2210 CheckPrototypes(object, r0, last, r3, r1, r4, name, &miss); |
2180 | 2211 |
2181 // If the last object in the prototype chain is a global object, | 2212 // If the last object in the prototype chain is a global object, |
2182 // check that the global property cell is empty. | 2213 // check that the global property cell is empty. |
2183 if (last->IsGlobalObject()) { | 2214 if (last->IsGlobalObject()) { |
2184 Object* cell = GenerateCheckPropertyCell(masm(), | 2215 MaybeObject* cell = GenerateCheckPropertyCell(masm(), |
2185 GlobalObject::cast(last), | 2216 GlobalObject::cast(last), |
2186 name, | 2217 name, |
2187 r1, | 2218 r1, |
2188 &miss); | 2219 &miss); |
2189 if (cell->IsFailure()) { | 2220 if (cell->IsFailure()) { |
2190 miss.Unuse(); | 2221 miss.Unuse(); |
2191 return cell; | 2222 return cell; |
2192 } | 2223 } |
2193 } | 2224 } |
2194 | 2225 |
2195 // Return undefined if maps of the full prototype chain are still the | 2226 // Return undefined if maps of the full prototype chain are still the |
2196 // same and no global property with this name contains a value. | 2227 // same and no global property with this name contains a value. |
2197 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 2228 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
2198 __ Ret(); | 2229 __ Ret(); |
2199 | 2230 |
2200 __ bind(&miss); | 2231 __ bind(&miss); |
2201 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2232 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2202 | 2233 |
2203 // Return the generated code. | 2234 // Return the generated code. |
2204 return GetCode(NONEXISTENT, Heap::empty_string()); | 2235 return GetCode(NONEXISTENT, Heap::empty_string()); |
2205 } | 2236 } |
2206 | 2237 |
2207 | 2238 |
2208 Object* LoadStubCompiler::CompileLoadField(JSObject* object, | 2239 MaybeObject* LoadStubCompiler::CompileLoadField(JSObject* object, |
2209 JSObject* holder, | 2240 JSObject* holder, |
2210 int index, | 2241 int index, |
2211 String* name) { | 2242 String* name) { |
2212 // ----------- S t a t e ------------- | 2243 // ----------- S t a t e ------------- |
2213 // -- r0 : receiver | 2244 // -- r0 : receiver |
2214 // -- r2 : name | 2245 // -- r2 : name |
2215 // -- lr : return address | 2246 // -- lr : return address |
2216 // ----------------------------------- | 2247 // ----------------------------------- |
2217 Label miss; | 2248 Label miss; |
2218 | 2249 |
2219 GenerateLoadField(object, holder, r0, r3, r1, r4, index, name, &miss); | 2250 GenerateLoadField(object, holder, r0, r3, r1, r4, index, name, &miss); |
2220 __ bind(&miss); | 2251 __ bind(&miss); |
2221 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2252 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2222 | 2253 |
2223 // Return the generated code. | 2254 // Return the generated code. |
2224 return GetCode(FIELD, name); | 2255 return GetCode(FIELD, name); |
2225 } | 2256 } |
2226 | 2257 |
2227 | 2258 |
2228 Object* LoadStubCompiler::CompileLoadCallback(String* name, | 2259 MaybeObject* LoadStubCompiler::CompileLoadCallback(String* name, |
2229 JSObject* object, | 2260 JSObject* object, |
2230 JSObject* holder, | 2261 JSObject* holder, |
2231 AccessorInfo* callback) { | 2262 AccessorInfo* callback) { |
2232 // ----------- S t a t e ------------- | 2263 // ----------- S t a t e ------------- |
2233 // -- r0 : receiver | 2264 // -- r0 : receiver |
2234 // -- r2 : name | 2265 // -- r2 : name |
2235 // -- lr : return address | 2266 // -- lr : return address |
2236 // ----------------------------------- | 2267 // ----------------------------------- |
2237 Label miss; | 2268 Label miss; |
2238 | 2269 |
2239 Failure* failure = Failure::InternalError(); | 2270 Failure* failure = Failure::InternalError(); |
2240 bool success = GenerateLoadCallback(object, holder, r0, r2, r3, r1, r4, | 2271 bool success = GenerateLoadCallback(object, holder, r0, r2, r3, r1, r4, |
2241 callback, name, &miss, &failure); | 2272 callback, name, &miss, &failure); |
2242 if (!success) { | 2273 if (!success) { |
2243 miss.Unuse(); | 2274 miss.Unuse(); |
2244 return failure; | 2275 return failure; |
2245 } | 2276 } |
2246 | 2277 |
2247 __ bind(&miss); | 2278 __ bind(&miss); |
2248 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2279 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2249 | 2280 |
2250 // Return the generated code. | 2281 // Return the generated code. |
2251 return GetCode(CALLBACKS, name); | 2282 return GetCode(CALLBACKS, name); |
2252 } | 2283 } |
2253 | 2284 |
2254 | 2285 |
2255 Object* LoadStubCompiler::CompileLoadConstant(JSObject* object, | 2286 MaybeObject* LoadStubCompiler::CompileLoadConstant(JSObject* object, |
2256 JSObject* holder, | 2287 JSObject* holder, |
2257 Object* value, | 2288 Object* value, |
2258 String* name) { | 2289 String* name) { |
2259 // ----------- S t a t e ------------- | 2290 // ----------- S t a t e ------------- |
2260 // -- r0 : receiver | 2291 // -- r0 : receiver |
2261 // -- r2 : name | 2292 // -- r2 : name |
2262 // -- lr : return address | 2293 // -- lr : return address |
2263 // ----------------------------------- | 2294 // ----------------------------------- |
2264 Label miss; | 2295 Label miss; |
2265 | 2296 |
2266 GenerateLoadConstant(object, holder, r0, r3, r1, r4, value, name, &miss); | 2297 GenerateLoadConstant(object, holder, r0, r3, r1, r4, value, name, &miss); |
2267 __ bind(&miss); | 2298 __ bind(&miss); |
2268 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2299 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2269 | 2300 |
2270 // Return the generated code. | 2301 // Return the generated code. |
2271 return GetCode(CONSTANT_FUNCTION, name); | 2302 return GetCode(CONSTANT_FUNCTION, name); |
2272 } | 2303 } |
2273 | 2304 |
2274 | 2305 |
2275 Object* LoadStubCompiler::CompileLoadInterceptor(JSObject* object, | 2306 MaybeObject* LoadStubCompiler::CompileLoadInterceptor(JSObject* object, |
2276 JSObject* holder, | 2307 JSObject* holder, |
2277 String* name) { | 2308 String* name) { |
2278 // ----------- S t a t e ------------- | 2309 // ----------- S t a t e ------------- |
2279 // -- r0 : receiver | 2310 // -- r0 : receiver |
2280 // -- r2 : name | 2311 // -- r2 : name |
2281 // -- lr : return address | 2312 // -- lr : return address |
2282 // ----------------------------------- | 2313 // ----------------------------------- |
2283 Label miss; | 2314 Label miss; |
2284 | 2315 |
2285 LookupResult lookup; | 2316 LookupResult lookup; |
2286 LookupPostInterceptor(holder, name, &lookup); | 2317 LookupPostInterceptor(holder, name, &lookup); |
2287 GenerateLoadInterceptor(object, | 2318 GenerateLoadInterceptor(object, |
2288 holder, | 2319 holder, |
2289 &lookup, | 2320 &lookup, |
2290 r0, | 2321 r0, |
2291 r2, | 2322 r2, |
2292 r3, | 2323 r3, |
2293 r1, | 2324 r1, |
2294 r4, | 2325 r4, |
2295 name, | 2326 name, |
2296 &miss); | 2327 &miss); |
2297 __ bind(&miss); | 2328 __ bind(&miss); |
2298 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2329 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2299 | 2330 |
2300 // Return the generated code. | 2331 // Return the generated code. |
2301 return GetCode(INTERCEPTOR, name); | 2332 return GetCode(INTERCEPTOR, name); |
2302 } | 2333 } |
2303 | 2334 |
2304 | 2335 |
2305 Object* LoadStubCompiler::CompileLoadGlobal(JSObject* object, | 2336 MaybeObject* LoadStubCompiler::CompileLoadGlobal(JSObject* object, |
2306 GlobalObject* holder, | 2337 GlobalObject* holder, |
2307 JSGlobalPropertyCell* cell, | 2338 JSGlobalPropertyCell* cell, |
2308 String* name, | 2339 String* name, |
2309 bool is_dont_delete) { | 2340 bool is_dont_delete) { |
2310 // ----------- S t a t e ------------- | 2341 // ----------- S t a t e ------------- |
2311 // -- r0 : receiver | 2342 // -- r0 : receiver |
2312 // -- r2 : name | 2343 // -- r2 : name |
2313 // -- lr : return address | 2344 // -- lr : return address |
2314 // ----------------------------------- | 2345 // ----------------------------------- |
2315 Label miss; | 2346 Label miss; |
2316 | 2347 |
2317 // If the object is the holder then we know that it's a global | 2348 // If the object is the holder then we know that it's a global |
2318 // object which can only happen for contextual calls. In this case, | 2349 // object which can only happen for contextual calls. In this case, |
2319 // the receiver cannot be a smi. | 2350 // the receiver cannot be a smi. |
(...skipping 22 matching lines...) Expand all Loading... |
2342 | 2373 |
2343 __ bind(&miss); | 2374 __ bind(&miss); |
2344 __ IncrementCounter(&Counters::named_load_global_stub_miss, 1, r1, r3); | 2375 __ IncrementCounter(&Counters::named_load_global_stub_miss, 1, r1, r3); |
2345 GenerateLoadMiss(masm(), Code::LOAD_IC); | 2376 GenerateLoadMiss(masm(), Code::LOAD_IC); |
2346 | 2377 |
2347 // Return the generated code. | 2378 // Return the generated code. |
2348 return GetCode(NORMAL, name); | 2379 return GetCode(NORMAL, name); |
2349 } | 2380 } |
2350 | 2381 |
2351 | 2382 |
2352 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, | 2383 MaybeObject* KeyedLoadStubCompiler::CompileLoadField(String* name, |
2353 JSObject* receiver, | 2384 JSObject* receiver, |
2354 JSObject* holder, | 2385 JSObject* holder, |
2355 int index) { | 2386 int index) { |
2356 // ----------- S t a t e ------------- | 2387 // ----------- S t a t e ------------- |
2357 // -- lr : return address | 2388 // -- lr : return address |
2358 // -- r0 : key | 2389 // -- r0 : key |
2359 // -- r1 : receiver | 2390 // -- r1 : receiver |
2360 // ----------------------------------- | 2391 // ----------------------------------- |
2361 Label miss; | 2392 Label miss; |
2362 | 2393 |
2363 // Check the key is the cached one. | 2394 // Check the key is the cached one. |
2364 __ cmp(r0, Operand(Handle<String>(name))); | 2395 __ cmp(r0, Operand(Handle<String>(name))); |
2365 __ b(ne, &miss); | 2396 __ b(ne, &miss); |
2366 | 2397 |
2367 GenerateLoadField(receiver, holder, r1, r2, r3, r4, index, name, &miss); | 2398 GenerateLoadField(receiver, holder, r1, r2, r3, r4, index, name, &miss); |
2368 __ bind(&miss); | 2399 __ bind(&miss); |
2369 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2400 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2370 | 2401 |
2371 return GetCode(FIELD, name); | 2402 return GetCode(FIELD, name); |
2372 } | 2403 } |
2373 | 2404 |
2374 | 2405 |
2375 Object* KeyedLoadStubCompiler::CompileLoadCallback(String* name, | 2406 MaybeObject* KeyedLoadStubCompiler::CompileLoadCallback( |
2376 JSObject* receiver, | 2407 String* name, |
2377 JSObject* holder, | 2408 JSObject* receiver, |
2378 AccessorInfo* callback) { | 2409 JSObject* holder, |
| 2410 AccessorInfo* callback) { |
2379 // ----------- S t a t e ------------- | 2411 // ----------- S t a t e ------------- |
2380 // -- lr : return address | 2412 // -- lr : return address |
2381 // -- r0 : key | 2413 // -- r0 : key |
2382 // -- r1 : receiver | 2414 // -- r1 : receiver |
2383 // ----------------------------------- | 2415 // ----------------------------------- |
2384 Label miss; | 2416 Label miss; |
2385 | 2417 |
2386 // Check the key is the cached one. | 2418 // Check the key is the cached one. |
2387 __ cmp(r0, Operand(Handle<String>(name))); | 2419 __ cmp(r0, Operand(Handle<String>(name))); |
2388 __ b(ne, &miss); | 2420 __ b(ne, &miss); |
2389 | 2421 |
2390 Failure* failure = Failure::InternalError(); | 2422 Failure* failure = Failure::InternalError(); |
2391 bool success = GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, r4, | 2423 bool success = GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, r4, |
2392 callback, name, &miss, &failure); | 2424 callback, name, &miss, &failure); |
2393 if (!success) { | 2425 if (!success) { |
2394 miss.Unuse(); | 2426 miss.Unuse(); |
2395 return failure; | 2427 return failure; |
2396 } | 2428 } |
2397 | 2429 |
2398 __ bind(&miss); | 2430 __ bind(&miss); |
2399 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2431 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2400 | 2432 |
2401 return GetCode(CALLBACKS, name); | 2433 return GetCode(CALLBACKS, name); |
2402 } | 2434 } |
2403 | 2435 |
2404 | 2436 |
2405 Object* KeyedLoadStubCompiler::CompileLoadConstant(String* name, | 2437 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, |
2406 JSObject* receiver, | 2438 JSObject* receiver, |
2407 JSObject* holder, | 2439 JSObject* holder, |
2408 Object* value) { | 2440 Object* value) { |
2409 // ----------- S t a t e ------------- | 2441 // ----------- S t a t e ------------- |
2410 // -- lr : return address | 2442 // -- lr : return address |
2411 // -- r0 : key | 2443 // -- r0 : key |
2412 // -- r1 : receiver | 2444 // -- r1 : receiver |
2413 // ----------------------------------- | 2445 // ----------------------------------- |
2414 Label miss; | 2446 Label miss; |
2415 | 2447 |
2416 // Check the key is the cached one. | 2448 // Check the key is the cached one. |
2417 __ cmp(r0, Operand(Handle<String>(name))); | 2449 __ cmp(r0, Operand(Handle<String>(name))); |
2418 __ b(ne, &miss); | 2450 __ b(ne, &miss); |
2419 | 2451 |
2420 GenerateLoadConstant(receiver, holder, r1, r2, r3, r4, value, name, &miss); | 2452 GenerateLoadConstant(receiver, holder, r1, r2, r3, r4, value, name, &miss); |
2421 __ bind(&miss); | 2453 __ bind(&miss); |
2422 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2454 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2423 | 2455 |
2424 // Return the generated code. | 2456 // Return the generated code. |
2425 return GetCode(CONSTANT_FUNCTION, name); | 2457 return GetCode(CONSTANT_FUNCTION, name); |
2426 } | 2458 } |
2427 | 2459 |
2428 | 2460 |
2429 Object* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, | 2461 MaybeObject* KeyedLoadStubCompiler::CompileLoadInterceptor(JSObject* receiver, |
2430 JSObject* holder, | 2462 JSObject* holder, |
2431 String* name) { | 2463 String* name) { |
2432 // ----------- S t a t e ------------- | 2464 // ----------- S t a t e ------------- |
2433 // -- lr : return address | 2465 // -- lr : return address |
2434 // -- r0 : key | 2466 // -- r0 : key |
2435 // -- r1 : receiver | 2467 // -- r1 : receiver |
2436 // ----------------------------------- | 2468 // ----------------------------------- |
2437 Label miss; | 2469 Label miss; |
2438 | 2470 |
2439 // Check the key is the cached one. | 2471 // Check the key is the cached one. |
2440 __ cmp(r0, Operand(Handle<String>(name))); | 2472 __ cmp(r0, Operand(Handle<String>(name))); |
2441 __ b(ne, &miss); | 2473 __ b(ne, &miss); |
(...skipping 10 matching lines...) Expand all Loading... |
2452 r4, | 2484 r4, |
2453 name, | 2485 name, |
2454 &miss); | 2486 &miss); |
2455 __ bind(&miss); | 2487 __ bind(&miss); |
2456 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2488 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2457 | 2489 |
2458 return GetCode(INTERCEPTOR, name); | 2490 return GetCode(INTERCEPTOR, name); |
2459 } | 2491 } |
2460 | 2492 |
2461 | 2493 |
2462 Object* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { | 2494 MaybeObject* KeyedLoadStubCompiler::CompileLoadArrayLength(String* name) { |
2463 // ----------- S t a t e ------------- | 2495 // ----------- S t a t e ------------- |
2464 // -- lr : return address | 2496 // -- lr : return address |
2465 // -- r0 : key | 2497 // -- r0 : key |
2466 // -- r1 : receiver | 2498 // -- r1 : receiver |
2467 // ----------------------------------- | 2499 // ----------------------------------- |
2468 Label miss; | 2500 Label miss; |
2469 | 2501 |
2470 // Check the key is the cached one. | 2502 // Check the key is the cached one. |
2471 __ cmp(r0, Operand(Handle<String>(name))); | 2503 __ cmp(r0, Operand(Handle<String>(name))); |
2472 __ b(ne, &miss); | 2504 __ b(ne, &miss); |
2473 | 2505 |
2474 GenerateLoadArrayLength(masm(), r1, r2, &miss); | 2506 GenerateLoadArrayLength(masm(), r1, r2, &miss); |
2475 __ bind(&miss); | 2507 __ bind(&miss); |
2476 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2508 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2477 | 2509 |
2478 return GetCode(CALLBACKS, name); | 2510 return GetCode(CALLBACKS, name); |
2479 } | 2511 } |
2480 | 2512 |
2481 | 2513 |
2482 Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { | 2514 MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
2483 // ----------- S t a t e ------------- | 2515 // ----------- S t a t e ------------- |
2484 // -- lr : return address | 2516 // -- lr : return address |
2485 // -- r0 : key | 2517 // -- r0 : key |
2486 // -- r1 : receiver | 2518 // -- r1 : receiver |
2487 // ----------------------------------- | 2519 // ----------------------------------- |
2488 Label miss; | 2520 Label miss; |
2489 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 2521 __ IncrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); |
2490 | 2522 |
2491 // Check the key is the cached one. | 2523 // Check the key is the cached one. |
2492 __ cmp(r0, Operand(Handle<String>(name))); | 2524 __ cmp(r0, Operand(Handle<String>(name))); |
2493 __ b(ne, &miss); | 2525 __ b(ne, &miss); |
2494 | 2526 |
2495 GenerateLoadStringLength(masm(), r1, r2, r3, &miss); | 2527 GenerateLoadStringLength(masm(), r1, r2, r3, &miss); |
2496 __ bind(&miss); | 2528 __ bind(&miss); |
2497 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); | 2529 __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); |
2498 | 2530 |
2499 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2531 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2500 | 2532 |
2501 return GetCode(CALLBACKS, name); | 2533 return GetCode(CALLBACKS, name); |
2502 } | 2534 } |
2503 | 2535 |
2504 | 2536 |
2505 // TODO(1224671): implement the fast case. | 2537 // TODO(1224671): implement the fast case. |
2506 Object* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { | 2538 MaybeObject* KeyedLoadStubCompiler::CompileLoadFunctionPrototype(String* name) { |
2507 // ----------- S t a t e ------------- | 2539 // ----------- S t a t e ------------- |
2508 // -- lr : return address | 2540 // -- lr : return address |
2509 // -- r0 : key | 2541 // -- r0 : key |
2510 // -- r1 : receiver | 2542 // -- r1 : receiver |
2511 // ----------------------------------- | 2543 // ----------------------------------- |
2512 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 2544 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
2513 | 2545 |
2514 return GetCode(CALLBACKS, name); | 2546 return GetCode(CALLBACKS, name); |
2515 } | 2547 } |
2516 | 2548 |
2517 | 2549 |
2518 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 2550 MaybeObject* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
2519 int index, | 2551 int index, |
2520 Map* transition, | 2552 Map* transition, |
2521 String* name) { | 2553 String* name) { |
2522 // ----------- S t a t e ------------- | 2554 // ----------- S t a t e ------------- |
2523 // -- r0 : value | 2555 // -- r0 : value |
2524 // -- r1 : key | 2556 // -- r1 : key |
2525 // -- r2 : receiver | 2557 // -- r2 : receiver |
2526 // -- lr : return address | 2558 // -- lr : return address |
2527 // ----------------------------------- | 2559 // ----------------------------------- |
2528 Label miss; | 2560 Label miss; |
2529 | 2561 |
2530 __ IncrementCounter(&Counters::keyed_store_field, 1, r3, r4); | 2562 __ IncrementCounter(&Counters::keyed_store_field, 1, r3, r4); |
2531 | 2563 |
(...skipping 14 matching lines...) Expand all Loading... |
2546 __ DecrementCounter(&Counters::keyed_store_field, 1, r3, r4); | 2578 __ DecrementCounter(&Counters::keyed_store_field, 1, r3, r4); |
2547 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 2579 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); |
2548 | 2580 |
2549 __ Jump(ic, RelocInfo::CODE_TARGET); | 2581 __ Jump(ic, RelocInfo::CODE_TARGET); |
2550 | 2582 |
2551 // Return the generated code. | 2583 // Return the generated code. |
2552 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); | 2584 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); |
2553 } | 2585 } |
2554 | 2586 |
2555 | 2587 |
2556 Object* ConstructStubCompiler::CompileConstructStub( | 2588 MaybeObject* ConstructStubCompiler::CompileConstructStub( |
2557 SharedFunctionInfo* shared) { | 2589 SharedFunctionInfo* shared) { |
2558 // ----------- S t a t e ------------- | 2590 // ----------- S t a t e ------------- |
2559 // -- r0 : argc | 2591 // -- r0 : argc |
2560 // -- r1 : constructor | 2592 // -- r1 : constructor |
2561 // -- lr : return address | 2593 // -- lr : return address |
2562 // -- [sp] : last argument | 2594 // -- [sp] : last argument |
2563 // ----------------------------------- | 2595 // ----------------------------------- |
2564 Label generic_stub_call; | 2596 Label generic_stub_call; |
2565 | 2597 |
2566 // Use r7 for holding undefined which is used in several places below. | 2598 // Use r7 for holding undefined which is used in several places below. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2694 // Return the generated code. | 2726 // Return the generated code. |
2695 return GetCode(); | 2727 return GetCode(); |
2696 } | 2728 } |
2697 | 2729 |
2698 | 2730 |
2699 #undef __ | 2731 #undef __ |
2700 | 2732 |
2701 } } // namespace v8::internal | 2733 } } // namespace v8::internal |
2702 | 2734 |
2703 #endif // V8_TARGET_ARCH_ARM | 2735 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |