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 "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 7817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7828 STORE_AND_GROW_NO_TRANSITION); | 7828 STORE_AND_GROW_NO_TRANSITION); |
7829 | 7829 |
7830 if (!ast_context()->IsEffect()) Push(new_size); | 7830 if (!ast_context()->IsEffect()) Push(new_size); |
7831 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | 7831 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
7832 if (!ast_context()->IsEffect()) Drop(1); | 7832 if (!ast_context()->IsEffect()) Drop(1); |
7833 } | 7833 } |
7834 | 7834 |
7835 ast_context()->ReturnValue(new_size); | 7835 ast_context()->ReturnValue(new_size); |
7836 return true; | 7836 return true; |
7837 } | 7837 } |
| 7838 case kArrayShift: { |
| 7839 if (receiver_map.is_null()) return false; |
| 7840 if (receiver_map->instance_type() != JS_ARRAY_TYPE) return false; |
| 7841 ElementsKind kind = receiver_map->elements_kind(); |
| 7842 if (!IsFastElementsKind(kind)) return false; |
| 7843 if (receiver_map->is_observed()) return false; |
| 7844 ASSERT(receiver_map->is_extensible()); |
| 7845 |
| 7846 // If there may be elements accessors in the prototype chain, the fast |
| 7847 // inlined version can't be used. |
| 7848 if (receiver_map->DictionaryElementsInPrototypeChainOnly()) return false; |
| 7849 |
| 7850 // If there currently can be no elements accessors on the prototype chain, |
| 7851 // it doesn't mean that there won't be any later. Install a full prototype |
| 7852 // chain check to trap element accessors being installed on the prototype |
| 7853 // chain, which would cause elements to go to dictionary mode and result |
| 7854 // in a map change. |
| 7855 BuildCheckPrototypeMaps( |
| 7856 handle(JSObject::cast(receiver_map->prototype()), isolate()), |
| 7857 Handle<JSObject>::null()); |
| 7858 |
| 7859 Drop(expr->arguments()->length()); |
| 7860 HValue* receiver = Pop(); |
| 7861 Drop(1); // function |
| 7862 |
| 7863 receiver = AddCheckMap(receiver, receiver_map); |
| 7864 HInstruction* result = NewUncasted<HArrayShift>(receiver, kind); |
| 7865 ast_context()->ReturnInstruction(result, expr->id()); |
| 7866 return true; |
| 7867 } |
7838 default: | 7868 default: |
7839 // Not yet supported for inlining. | 7869 // Not yet supported for inlining. |
7840 break; | 7870 break; |
7841 } | 7871 } |
7842 return false; | 7872 return false; |
7843 } | 7873 } |
7844 | 7874 |
7845 | 7875 |
7846 bool HOptimizedGraphBuilder::TryInlineApiFunctionCall(Call* expr, | 7876 bool HOptimizedGraphBuilder::TryInlineApiFunctionCall(Call* expr, |
7847 HValue* receiver) { | 7877 HValue* receiver) { |
(...skipping 3825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11673 if (ShouldProduceTraceOutput()) { | 11703 if (ShouldProduceTraceOutput()) { |
11674 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 11704 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
11675 } | 11705 } |
11676 | 11706 |
11677 #ifdef DEBUG | 11707 #ifdef DEBUG |
11678 graph_->Verify(false); // No full verify. | 11708 graph_->Verify(false); // No full verify. |
11679 #endif | 11709 #endif |
11680 } | 11710 } |
11681 | 11711 |
11682 } } // namespace v8::internal | 11712 } } // namespace v8::internal |
OLD | NEW |