Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1347 switch (type) { | 1347 switch (type) { |
| 1348 case FIELD: | 1348 case FIELD: |
| 1349 code = isolate()->stub_cache()->ComputeStoreField(name, | 1349 code = isolate()->stub_cache()->ComputeStoreField(name, |
| 1350 receiver, | 1350 receiver, |
| 1351 lookup->GetFieldIndex(), | 1351 lookup->GetFieldIndex(), |
| 1352 Handle<Map>::null(), | 1352 Handle<Map>::null(), |
| 1353 strict_mode); | 1353 strict_mode); |
| 1354 break; | 1354 break; |
| 1355 case MAP_TRANSITION: { | 1355 case MAP_TRANSITION: { |
| 1356 if (lookup->GetAttributes() != NONE) return; | 1356 if (lookup->GetAttributes() != NONE) return; |
| 1357 ASSERT(type == MAP_TRANSITION); | |
| 1358 Handle<Map> transition(lookup->GetTransitionMap()); | 1357 Handle<Map> transition(lookup->GetTransitionMap()); |
| 1359 int index = transition->PropertyIndexFor(*name); | 1358 int index = transition->PropertyIndexFor(*name); |
| 1360 code = isolate()->stub_cache()->ComputeStoreField( | 1359 code = isolate()->stub_cache()->ComputeStoreField( |
| 1361 name, receiver, index, transition, strict_mode); | 1360 name, receiver, index, transition, strict_mode); |
| 1362 break; | 1361 break; |
| 1363 } | 1362 } |
| 1364 case NORMAL: | 1363 case NORMAL: |
| 1365 if (receiver->IsGlobalObject()) { | 1364 if (receiver->IsGlobalObject()) { |
| 1366 // The stub generated for the global object picks the value directly | 1365 // The stub generated for the global object picks the value directly |
| 1367 // from the property cell. So the property must be directly on the | 1366 // from the property cell. So the property must be directly on the |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 1383 if (v8::ToCData<Address>(callback->setter()) == 0) return; | 1382 if (v8::ToCData<Address>(callback->setter()) == 0) return; |
| 1384 code = isolate()->stub_cache()->ComputeStoreCallback( | 1383 code = isolate()->stub_cache()->ComputeStoreCallback( |
| 1385 name, receiver, callback, strict_mode); | 1384 name, receiver, callback, strict_mode); |
| 1386 break; | 1385 break; |
| 1387 } | 1386 } |
| 1388 case INTERCEPTOR: | 1387 case INTERCEPTOR: |
| 1389 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); | 1388 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); |
| 1390 code = isolate()->stub_cache()->ComputeStoreInterceptor( | 1389 code = isolate()->stub_cache()->ComputeStoreInterceptor( |
| 1391 name, receiver, strict_mode); | 1390 name, receiver, strict_mode); |
| 1392 break; | 1391 break; |
| 1393 default: | 1392 case CONSTANT_FUNCTION: |
| 1393 case CONSTANT_TRANSITION: | |
| 1394 case ELEMENTS_TRANSITION: | |
| 1395 return; | |
| 1396 case HANDLER: | |
|
Kevin Millikin (Chromium)
2011/11/07 14:13:39
Is HANDLER unreachable because the caller takes ca
Sven Panne
2011/11/08 07:36:10
Done.
| |
| 1397 case NULL_DESCRIPTOR: | |
| 1398 UNREACHABLE(); | |
| 1394 return; | 1399 return; |
| 1395 } | 1400 } |
| 1396 | 1401 |
| 1397 // Patch the call site depending on the state of the cache. | 1402 // Patch the call site depending on the state of the cache. |
| 1398 if (state == UNINITIALIZED || state == MONOMORPHIC_PROTOTYPE_FAILURE) { | 1403 if (state == UNINITIALIZED || state == MONOMORPHIC_PROTOTYPE_FAILURE) { |
| 1399 set_target(*code); | 1404 set_target(*code); |
| 1400 } else if (state == MONOMORPHIC) { | 1405 } else if (state == MONOMORPHIC) { |
| 1401 // Only move to megamorphic if the target changes. | 1406 // Only move to megamorphic if the target changes. |
| 1402 if (target() != *code) { | 1407 if (target() != *code) { |
| 1403 set_target((strict_mode == kStrictMode) | 1408 set_target((strict_mode == kStrictMode) |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1712 // where there is extra room in the object, we leave the IC in its | 1717 // where there is extra room in the object, we leave the IC in its |
| 1713 // current state. | 1718 // current state. |
| 1714 PropertyType type = lookup->type(); | 1719 PropertyType type = lookup->type(); |
| 1715 | 1720 |
| 1716 // Compute the code stub for this store; used for rewriting to | 1721 // Compute the code stub for this store; used for rewriting to |
| 1717 // monomorphic state and making sure that the code stub is in the | 1722 // monomorphic state and making sure that the code stub is in the |
| 1718 // stub cache. | 1723 // stub cache. |
| 1719 Handle<Code> code; | 1724 Handle<Code> code; |
| 1720 | 1725 |
| 1721 switch (type) { | 1726 switch (type) { |
| 1727 case CONSTANT_FUNCTION: | |
|
Kevin Millikin (Chromium)
2011/11/07 14:13:39
I guess we should not get NULL_DESCRIPTOR here, an
Sven Panne
2011/11/08 07:36:10
Done.
| |
| 1728 case HANDLER: | |
| 1729 case INTERCEPTOR: | |
| 1730 case ELEMENTS_TRANSITION: | |
| 1731 case NULL_DESCRIPTOR: | |
| 1732 UNREACHABLE(); | |
| 1733 return; | |
| 1722 case FIELD: | 1734 case FIELD: |
| 1723 code = isolate()->stub_cache()->ComputeKeyedStoreField( | 1735 code = isolate()->stub_cache()->ComputeKeyedStoreField( |
| 1724 name, receiver, lookup->GetFieldIndex(), | 1736 name, receiver, lookup->GetFieldIndex(), |
| 1725 Handle<Map>::null(), strict_mode); | 1737 Handle<Map>::null(), strict_mode); |
| 1726 break; | 1738 break; |
| 1727 case MAP_TRANSITION: | 1739 case MAP_TRANSITION: |
| 1728 if (lookup->GetAttributes() == NONE) { | 1740 if (lookup->GetAttributes() == NONE) { |
| 1729 ASSERT(type == MAP_TRANSITION); | |
| 1730 Handle<Map> transition(lookup->GetTransitionMap()); | 1741 Handle<Map> transition(lookup->GetTransitionMap()); |
| 1731 int index = transition->PropertyIndexFor(*name); | 1742 int index = transition->PropertyIndexFor(*name); |
| 1732 code = isolate()->stub_cache()->ComputeKeyedStoreField( | 1743 code = isolate()->stub_cache()->ComputeKeyedStoreField( |
| 1733 name, receiver, index, transition, strict_mode); | 1744 name, receiver, index, transition, strict_mode); |
| 1734 break; | 1745 break; |
| 1735 } | 1746 } |
| 1736 // fall through. | 1747 // fall through. |
| 1737 default: | 1748 case NORMAL: |
| 1749 case CALLBACKS: | |
| 1750 case CONSTANT_TRANSITION: | |
| 1738 // Always rewrite to the generic case so that we do not | 1751 // Always rewrite to the generic case so that we do not |
| 1739 // repeatedly try to rewrite. | 1752 // repeatedly try to rewrite. |
| 1740 code = (strict_mode == kStrictMode) | 1753 code = (strict_mode == kStrictMode) |
| 1741 ? generic_stub_strict() | 1754 ? generic_stub_strict() |
| 1742 : generic_stub(); | 1755 : generic_stub(); |
| 1743 break; | 1756 break; |
| 1744 } | 1757 } |
| 1745 | 1758 |
| 1746 ASSERT(!code.is_null()); | 1759 ASSERT(!code.is_null()); |
| 1747 | 1760 |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2377 #undef ADDR | 2390 #undef ADDR |
| 2378 }; | 2391 }; |
| 2379 | 2392 |
| 2380 | 2393 |
| 2381 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2394 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2382 return IC_utilities[id]; | 2395 return IC_utilities[id]; |
| 2383 } | 2396 } |
| 2384 | 2397 |
| 2385 | 2398 |
| 2386 } } // namespace v8::internal | 2399 } } // namespace v8::internal |
| OLD | NEW |