OLD | NEW |
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 "src/hydrogen.h" | 5 #include "src/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 8387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8398 // inlined version can't be used. | 8398 // inlined version can't be used. |
8399 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false; | 8399 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false; |
8400 // If there currently can be no elements accessors on the prototype chain, | 8400 // If there currently can be no elements accessors on the prototype chain, |
8401 // it doesn't mean that there won't be any later. Install a full prototype | 8401 // it doesn't mean that there won't be any later. Install a full prototype |
8402 // chain check to trap element accessors being installed on the prototype | 8402 // chain check to trap element accessors being installed on the prototype |
8403 // chain, which would cause elements to go to dictionary mode and result | 8403 // chain, which would cause elements to go to dictionary mode and result |
8404 // in a map change. | 8404 // in a map change. |
8405 Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype())); | 8405 Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype())); |
8406 BuildCheckPrototypeMaps(prototype, Handle<JSObject>()); | 8406 BuildCheckPrototypeMaps(prototype, Handle<JSObject>()); |
8407 | 8407 |
| 8408 // Protect against adding elements to the Array prototype, which needs to |
| 8409 // route through appropriate bottlenecks. |
| 8410 if (isolate()->IsFastArrayConstructorPrototypeChainIntact() && |
| 8411 !prototype->IsJSArray()) { |
| 8412 return false; |
| 8413 } |
| 8414 |
8408 const int argc = args_count_no_receiver; | 8415 const int argc = args_count_no_receiver; |
8409 if (argc != 1) return false; | 8416 if (argc != 1) return false; |
8410 | 8417 |
8411 HValue* value_to_push = Pop(); | 8418 HValue* value_to_push = Pop(); |
8412 HValue* array = Pop(); | 8419 HValue* array = Pop(); |
8413 Drop(1); // Drop function. | 8420 Drop(1); // Drop function. |
8414 | 8421 |
8415 HInstruction* new_size = NULL; | 8422 HInstruction* new_size = NULL; |
8416 HValue* length = NULL; | 8423 HValue* length = NULL; |
8417 | 8424 |
(...skipping 4501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12919 if (ShouldProduceTraceOutput()) { | 12926 if (ShouldProduceTraceOutput()) { |
12920 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12927 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12921 } | 12928 } |
12922 | 12929 |
12923 #ifdef DEBUG | 12930 #ifdef DEBUG |
12924 graph_->Verify(false); // No full verify. | 12931 graph_->Verify(false); // No full verify. |
12925 #endif | 12932 #endif |
12926 } | 12933 } |
12927 | 12934 |
12928 } } // namespace v8::internal | 12935 } } // namespace v8::internal |
OLD | NEW |