Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: src/ic.cc

Issue 23442016: Add premonomorphic store ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ic.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 &&
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);
1721 } else if (FLAG_use_ic && 1719 }
1722 (!name->IsCacheable(isolate()) || 1720 if (FLAG_use_ic) {
1723 lookup.IsNormal() || 1721 if (state == UNINITIALIZED) {
1724 (lookup.IsField() && lookup.CanHoldValue(value)))) { 1722 Handle<Code> stub = (strict_mode == kStrictMode)
1725 Handle<Code> stub = strict_mode == kStrictMode 1723 ? pre_monomorphic_stub_strict()
1726 ? generic_stub_strict() : generic_stub(); 1724 : pre_monomorphic_stub();
1727 set_target(*stub); 1725 set_target(*stub);
1726 TRACE_IC("StoreIC", name, state, *stub);
1727 } else if (can_store) {
1728 UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
1729 } else if (!name->IsCacheable(isolate()) ||
1730 lookup.IsNormal() ||
1731 (lookup.IsField() && lookup.CanHoldValue(value))) {
1732 Handle<Code> stub = (strict_mode == kStrictMode) ? generic_stub_strict()
1733 : generic_stub();
1734 set_target(*stub);
1735 }
1728 } 1736 }
1729 1737
1730 // Set the property. 1738 // Set the property.
1731 return JSReceiver::SetPropertyOrFail( 1739 return JSReceiver::SetPropertyOrFail(
1732 receiver, name, value, NONE, strict_mode, store_mode); 1740 receiver, name, value, NONE, strict_mode, store_mode);
1733 } 1741 }
1734 1742
1735 1743
1736 void StoreIC::UpdateCaches(LookupResult* lookup, 1744 void StoreIC::UpdateCaches(LookupResult* lookup,
1737 State state, 1745 State state,
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 #undef ADDR 3103 #undef ADDR
3096 }; 3104 };
3097 3105
3098 3106
3099 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3107 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3100 return IC_utilities[id]; 3108 return IC_utilities[id];
3101 } 3109 }
3102 3110
3103 3111
3104 } } // namespace v8::internal 3112 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ic.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698