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

Side by Side Diff: src/hydrogen.cc

Issue 279773002: Fix Array.prototype.push and Array.prototype.unshift for read-only length. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address comments Created 6 years, 7 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "hydrogen.h" 5 #include "hydrogen.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "v8.h" 9 #include "v8.h"
10 #include "allocation-site-scopes.h" 10 #include "allocation-site-scopes.h"
(...skipping 7771 matching lines...) Expand 10 before | Expand all | Expand 10 after
7782 7782
7783 ast_context()->ReturnValue(result); 7783 ast_context()->ReturnValue(result);
7784 return true; 7784 return true;
7785 } 7785 }
7786 case kArrayPush: { 7786 case kArrayPush: {
7787 if (receiver_map.is_null()) return false; 7787 if (receiver_map.is_null()) return false;
7788 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false; 7788 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false;
7789 ElementsKind elements_kind = receiver_map->elements_kind(); 7789 ElementsKind elements_kind = receiver_map->elements_kind();
7790 if (!IsFastElementsKind(elements_kind)) return false; 7790 if (!IsFastElementsKind(elements_kind)) return false;
7791 if (receiver_map->is_observed()) return false; 7791 if (receiver_map->is_observed()) return false;
7792 if (JSArray::IsReadOnlyLengthDescriptor(receiver_map)) return false;
7792 ASSERT(receiver_map->is_extensible()); 7793 ASSERT(receiver_map->is_extensible());
7793 7794
7794 // If there may be elements accessors in the prototype chain, the fast 7795 // If there may be elements accessors in the prototype chain, the fast
7795 // inlined version can't be used. 7796 // inlined version can't be used.
7796 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false; 7797 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false;
7797 // If there currently can be no elements accessors on the prototype chain, 7798 // If there currently can be no elements accessors on the prototype chain,
7798 // it doesn't mean that there won't be any later. Install a full prototype 7799 // it doesn't mean that there won't be any later. Install a full prototype
7799 // chain check to trap element accessors being installed on the prototype 7800 // chain check to trap element accessors being installed on the prototype
7800 // chain, which would cause elements to go to dictionary mode and result 7801 // chain, which would cause elements to go to dictionary mode and result
7801 // in a map change. 7802 // in a map change.
(...skipping 3871 matching lines...) Expand 10 before | Expand all | Expand 10 after
11673 if (ShouldProduceTraceOutput()) { 11674 if (ShouldProduceTraceOutput()) {
11674 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11675 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11675 } 11676 }
11676 11677
11677 #ifdef DEBUG 11678 #ifdef DEBUG
11678 graph_->Verify(false); // No full verify. 11679 graph_->Verify(false); // No full verify.
11679 #endif 11680 #endif
11680 } 11681 }
11681 11682
11682 } } // namespace v8::internal 11683 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698