OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 Code::StubType type, | 1435 Code::StubType type, |
1436 IcCheckType check) { | 1436 IcCheckType check) { |
1437 Label miss; | 1437 Label miss; |
1438 | 1438 |
1439 if (check == PROPERTY && | 1439 if (check == PROPERTY && |
1440 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { | 1440 (kind() == Code::KEYED_LOAD_IC || kind() == Code::KEYED_STORE_IC)) { |
1441 __ Branch(&miss, ne, this->name(), Operand(name)); | 1441 __ Branch(&miss, ne, this->name(), Operand(name)); |
1442 } | 1442 } |
1443 | 1443 |
1444 Label number_case; | 1444 Label number_case; |
| 1445 Register match = scratch1(); |
1445 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; | 1446 Label* smi_target = IncludesNumberType(types) ? &number_case : &miss; |
1446 __ JumpIfSmi(receiver(), smi_target); | 1447 __ JumpIfSmi(receiver(), smi_target, match); // Reg match is 0 if Smi. |
1447 | 1448 |
1448 Register map_reg = scratch1(); | 1449 Register map_reg = scratch2(); |
1449 | 1450 |
1450 int receiver_count = types->length(); | 1451 int receiver_count = types->length(); |
1451 int number_of_handled_maps = 0; | 1452 int number_of_handled_maps = 0; |
1452 __ lw(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); | 1453 __ lw(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
1453 for (int current = 0; current < receiver_count; ++current) { | 1454 for (int current = 0; current < receiver_count; ++current) { |
1454 Handle<HeapType> type = types->at(current); | 1455 Handle<HeapType> type = types->at(current); |
1455 Handle<Map> map = IC::TypeToMap(*type, isolate()); | 1456 Handle<Map> map = IC::TypeToMap(*type, isolate()); |
1456 if (!map->is_deprecated()) { | 1457 if (!map->is_deprecated()) { |
1457 number_of_handled_maps++; | 1458 number_of_handled_maps++; |
| 1459 // Check map and tail call if there's a match. |
| 1460 // Separate compare from branch, to provide path for above JumpIfSmi(). |
| 1461 __ Subu(match, map_reg, Operand(map)); |
1458 if (type->Is(HeapType::Number())) { | 1462 if (type->Is(HeapType::Number())) { |
1459 ASSERT(!number_case.is_unused()); | 1463 ASSERT(!number_case.is_unused()); |
1460 __ bind(&number_case); | 1464 __ bind(&number_case); |
1461 } | 1465 } |
1462 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, | 1466 __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, |
1463 eq, map_reg, Operand(map)); | 1467 eq, match, Operand(zero_reg)); |
1464 } | 1468 } |
1465 } | 1469 } |
1466 ASSERT(number_of_handled_maps != 0); | 1470 ASSERT(number_of_handled_maps != 0); |
1467 | 1471 |
1468 __ bind(&miss); | 1472 __ bind(&miss); |
1469 TailCallBuiltin(masm(), MissBuiltin(kind())); | 1473 TailCallBuiltin(masm(), MissBuiltin(kind())); |
1470 | 1474 |
1471 // Return the generated code. | 1475 // Return the generated code. |
1472 InlineCacheState state = | 1476 InlineCacheState state = |
1473 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; | 1477 number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 // ----------------------------------- | 1555 // ----------------------------------- |
1552 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 1556 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
1553 } | 1557 } |
1554 | 1558 |
1555 | 1559 |
1556 #undef __ | 1560 #undef __ |
1557 | 1561 |
1558 } } // namespace v8::internal | 1562 } } // namespace v8::internal |
1559 | 1563 |
1560 #endif // V8_TARGET_ARCH_MIPS | 1564 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |