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

Side by Side Diff: src/ic.cc

Issue 19115002: Don't use StoreIC_ArrayLength on frozen arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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
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 1644 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 } 1655 }
1656 1656
1657 // Observed objects are always modified through the runtime. 1657 // Observed objects are always modified through the runtime.
1658 if (FLAG_harmony_observation && receiver->map()->is_observed()) { 1658 if (FLAG_harmony_observation && receiver->map()->is_observed()) {
1659 return JSReceiver::SetPropertyOrFail( 1659 return JSReceiver::SetPropertyOrFail(
1660 receiver, name, value, NONE, strict_mode, store_mode); 1660 receiver, name, value, NONE, strict_mode, store_mode);
1661 } 1661 }
1662 1662
1663 // Use specialized code for setting the length of arrays with fast 1663 // Use specialized code for setting the length of arrays with fast
1664 // properties. Slow properties might indicate redefinition of the length 1664 // properties. Slow properties might indicate redefinition of the length
1665 // property. 1665 // property. Note that when redefined using Object.freeze, it's possible
1666 // to have fast properties but a read-only length.
1666 if (FLAG_use_ic && 1667 if (FLAG_use_ic &&
1667 receiver->IsJSArray() && 1668 receiver->IsJSArray() &&
1668 name->Equals(isolate()->heap()->length_string()) && 1669 name->Equals(isolate()->heap()->length_string()) &&
1669 Handle<JSArray>::cast(receiver)->AllowsSetElementsLength() && 1670 Handle<JSArray>::cast(receiver)->AllowsSetElementsLength() &&
1670 receiver->HasFastProperties()) { 1671 receiver->HasFastProperties() &&
1672 !receiver->map()->is_frozen()) {
Mark Miller 2013/07/12 20:56:57 The issue also arises if the .length property is n
adamk 2013/07/12 21:00:09 See the comment above, and my note in the CL descr
Mark Miller 2013/07/12 21:08:02 Gotcha. Thanks for the clarification. Does that m
Mark Miller 2013/07/12 21:09:39 I meant "...may *now* go to beta with..."
adamk 2013/07/12 21:14:28 Replacing .push won't even help you; the underlyin
1671 Handle<Code> stub = 1673 Handle<Code> stub =
1672 StoreArrayLengthStub(kind(), strict_mode).GetCode(isolate()); 1674 StoreArrayLengthStub(kind(), strict_mode).GetCode(isolate());
1673 set_target(*stub); 1675 set_target(*stub);
1674 TRACE_IC("StoreIC", name, state, *stub); 1676 TRACE_IC("StoreIC", name, state, *stub);
1675 return JSReceiver::SetPropertyOrFail( 1677 return JSReceiver::SetPropertyOrFail(
1676 receiver, name, value, NONE, strict_mode, store_mode); 1678 receiver, name, value, NONE, strict_mode, store_mode);
1677 } 1679 }
1678 1680
1679 if (receiver->IsJSGlobalProxy()) { 1681 if (receiver->IsJSGlobalProxy()) {
1680 if (FLAG_use_ic && kind() != Code::KEYED_STORE_IC) { 1682 if (FLAG_use_ic && kind() != Code::KEYED_STORE_IC) {
(...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after
3110 #undef ADDR 3112 #undef ADDR
3111 }; 3113 };
3112 3114
3113 3115
3114 Address IC::AddressFromUtilityId(IC::UtilityId id) { 3116 Address IC::AddressFromUtilityId(IC::UtilityId id) {
3115 return IC_utilities[id]; 3117 return IC_utilities[id];
3116 } 3118 }
3117 3119
3118 3120
3119 } } // namespace v8::internal 3121 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2711.js » ('j') | test/mjsunit/regress/regress-2711.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698