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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 // Don't clear debug break inline cache as it will remove the break point. | 218 // Don't clear debug break inline cache as it will remove the break point. |
219 if (target->ic_state() == DEBUG_BREAK) return; | 219 if (target->ic_state() == DEBUG_BREAK) return; |
220 | 220 |
221 switch (target->kind()) { | 221 switch (target->kind()) { |
222 case Code::LOAD_IC: return LoadIC::Clear(address, target); | 222 case Code::LOAD_IC: return LoadIC::Clear(address, target); |
223 case Code::KEYED_LOAD_IC: return KeyedLoadIC::Clear(address, target); | 223 case Code::KEYED_LOAD_IC: return KeyedLoadIC::Clear(address, target); |
224 case Code::STORE_IC: return StoreIC::Clear(address, target); | 224 case Code::STORE_IC: return StoreIC::Clear(address, target); |
225 case Code::KEYED_STORE_IC: return KeyedStoreIC::Clear(address, target); | 225 case Code::KEYED_STORE_IC: return KeyedStoreIC::Clear(address, target); |
226 case Code::CALL_IC: return CallIC::Clear(address, target); | 226 case Code::CALL_IC: return CallIC::Clear(address, target); |
227 case Code::BINARY_OP_IC: return BinaryOpIC::Clear(address, target); | 227 case Code::BINARY_OP_IC: return; // Clearing these is tricky and does not |
| 228 // make any performance difference. |
228 default: UNREACHABLE(); | 229 default: UNREACHABLE(); |
229 } | 230 } |
230 } | 231 } |
231 | 232 |
232 | 233 |
233 void CallIC::Clear(Address address, Code* target) { | 234 void CallIC::Clear(Address address, Code* target) { |
234 State state = target->ic_state(); | 235 State state = target->ic_state(); |
235 InLoopFlag in_loop = target->ic_in_loop(); | 236 InLoopFlag in_loop = target->ic_in_loop(); |
236 if (state == UNINITIALIZED) return; | 237 if (state == UNINITIALIZED) return; |
237 Code* code = | 238 Code* code = |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1397 return ic.Store(state, args.at<Object>(0), args.at<Object>(1), | 1398 return ic.Store(state, args.at<Object>(0), args.at<Object>(1), |
1398 args.at<Object>(2)); | 1399 args.at<Object>(2)); |
1399 } | 1400 } |
1400 | 1401 |
1401 | 1402 |
1402 void BinaryOpIC::patch(Code* code) { | 1403 void BinaryOpIC::patch(Code* code) { |
1403 set_target(code); | 1404 set_target(code); |
1404 } | 1405 } |
1405 | 1406 |
1406 | 1407 |
1407 void BinaryOpIC::Clear(Address address, Code* target) { | |
1408 if (target->ic_state() == UNINITIALIZED) return; | |
1409 | |
1410 // At the end of a fast case stub there should be a reference to | |
1411 // a corresponding UNINITIALIZED stub, so look for the last reloc info item. | |
1412 RelocInfo* rinfo = NULL; | |
1413 for (RelocIterator it(target, RelocInfo::kCodeTargetMask); | |
1414 !it.done(); it.next()) { | |
1415 rinfo = it.rinfo(); | |
1416 } | |
1417 | |
1418 ASSERT(rinfo != NULL); | |
1419 Code* uninit_stub = Code::GetCodeFromTargetAddress(rinfo->target_address()); | |
1420 ASSERT(uninit_stub->ic_state() == UNINITIALIZED && | |
1421 uninit_stub->kind() == Code::BINARY_OP_IC); | |
1422 SetTargetAtAddress(address, uninit_stub); | |
1423 } | |
1424 | |
1425 | |
1426 const char* BinaryOpIC::GetName(TypeInfo type_info) { | 1408 const char* BinaryOpIC::GetName(TypeInfo type_info) { |
1427 switch (type_info) { | 1409 switch (type_info) { |
1428 case DEFAULT: return "Default"; | 1410 case DEFAULT: return "Default"; |
1429 case GENERIC: return "Generic"; | 1411 case GENERIC: return "Generic"; |
1430 case HEAP_NUMBERS: return "HeapNumbers"; | 1412 case HEAP_NUMBERS: return "HeapNumbers"; |
1431 case STRINGS: return "Strings"; | 1413 case STRINGS: return "Strings"; |
1432 default: return "Invalid"; | 1414 default: return "Invalid"; |
1433 } | 1415 } |
1434 } | 1416 } |
1435 | 1417 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 #undef ADDR | 1494 #undef ADDR |
1513 }; | 1495 }; |
1514 | 1496 |
1515 | 1497 |
1516 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1498 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
1517 return IC_utilities[id]; | 1499 return IC_utilities[id]; |
1518 } | 1500 } |
1519 | 1501 |
1520 | 1502 |
1521 } } // namespace v8::internal | 1503 } } // namespace v8::internal |
OLD | NEW |