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 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1702 ? global_proxy_stub_strict() | 1702 ? global_proxy_stub_strict() |
1703 : global_proxy_stub(); | 1703 : global_proxy_stub(); |
1704 set_target(*stub); | 1704 set_target(*stub); |
1705 TRACE_IC("StoreIC", name, state, *stub); | 1705 TRACE_IC("StoreIC", name, state, *stub); |
1706 } | 1706 } |
1707 return JSReceiver::SetPropertyOrFail( | 1707 return JSReceiver::SetPropertyOrFail( |
1708 receiver, name, value, NONE, strict_mode, store_mode); | 1708 receiver, name, value, NONE, strict_mode, store_mode); |
1709 } | 1709 } |
1710 | 1710 |
1711 LookupResult lookup(isolate()); | 1711 LookupResult lookup(isolate()); |
1712 if (LookupForWrite(receiver, name, value, &lookup, &state)) { | 1712 bool can_store = LookupForWrite(receiver, name, value, &lookup, &state); |
1713 if (FLAG_use_ic) { | 1713 if (!can_store && |
Jakob Kummerow
2013/09/03 09:58:59
nit: I'm finding this heterogeneous if/else cascad
| |
1714 UpdateCaches(&lookup, state, strict_mode, receiver, name, value); | 1714 strict_mode == kStrictMode && |
1715 } | 1715 !(lookup.IsProperty() && lookup.IsReadOnly()) && |
1716 } else if (strict_mode == kStrictMode && | 1716 IsUndeclaredGlobal(object)) { |
1717 !(lookup.IsProperty() && lookup.IsReadOnly()) && | |
1718 IsUndeclaredGlobal(object)) { | |
1719 // Strict mode doesn't allow setting non-existent global property. | 1717 // Strict mode doesn't allow setting non-existent global property. |
1720 return ReferenceError("not_defined", name); | 1718 return ReferenceError("not_defined", name); |
1719 } else if (FLAG_use_ic && state == UNINITIALIZED) { | |
1720 Handle<Code> stub = (strict_mode == kStrictMode) | |
1721 ? pre_monomorphic_stub_strict() | |
1722 : pre_monomorphic_stub(); | |
1723 set_target(*stub); | |
1724 TRACE_IC("StoreIC", name, state, *stub); | |
1725 } else if (FLAG_use_ic && can_store) { | |
1726 UpdateCaches(&lookup, state, strict_mode, receiver, name, value); | |
1721 } else if (FLAG_use_ic && | 1727 } else if (FLAG_use_ic && |
1722 (!name->IsCacheable(isolate()) || | 1728 (!name->IsCacheable(isolate()) || |
1723 lookup.IsNormal() || | 1729 lookup.IsNormal() || |
1724 (lookup.IsField() && lookup.CanHoldValue(value)))) { | 1730 (lookup.IsField() && lookup.CanHoldValue(value)))) { |
1725 Handle<Code> stub = strict_mode == kStrictMode | 1731 Handle<Code> stub = strict_mode == kStrictMode |
1726 ? generic_stub_strict() : generic_stub(); | 1732 ? generic_stub_strict() : generic_stub(); |
1727 set_target(*stub); | 1733 set_target(*stub); |
1728 } | 1734 } |
1729 | 1735 |
1730 // Set the property. | 1736 // Set the property. |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3095 #undef ADDR | 3101 #undef ADDR |
3096 }; | 3102 }; |
3097 | 3103 |
3098 | 3104 |
3099 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3105 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
3100 return IC_utilities[id]; | 3106 return IC_utilities[id]; |
3101 } | 3107 } |
3102 | 3108 |
3103 | 3109 |
3104 } } // namespace v8::internal | 3110 } } // namespace v8::internal |
OLD | NEW |