OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 4972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4983 BailoutId assignment_id, | 4983 BailoutId assignment_id, |
4984 Property* prop, | 4984 Property* prop, |
4985 HValue* object, | 4985 HValue* object, |
4986 HValue* value) { | 4986 HValue* value) { |
4987 Literal* key = prop->key()->AsLiteral(); | 4987 Literal* key = prop->key()->AsLiteral(); |
4988 Handle<String> name = Handle<String>::cast(key->value()); | 4988 Handle<String> name = Handle<String>::cast(key->value()); |
4989 ASSERT(!name.is_null()); | 4989 ASSERT(!name.is_null()); |
4990 | 4990 |
4991 HInstruction* instr = NULL; | 4991 HInstruction* instr = NULL; |
4992 SmallMapList* types = expr->GetReceiverTypes(); | 4992 SmallMapList* types = expr->GetReceiverTypes(); |
4993 | |
4993 bool monomorphic = expr->IsMonomorphic(); | 4994 bool monomorphic = expr->IsMonomorphic(); |
4995 if (types != NULL && object->HasMonomorphicJSObjectType()) { | |
4996 types->FilterForPossibleTransitions( | |
4997 object->GetMonomorphicJSObjectMap()->FindRootMap(), zone()); | |
4998 monomorphic = types->length() == 1; | |
4999 } | |
5000 | |
4994 Handle<Map> map; | 5001 Handle<Map> map; |
4995 if (monomorphic) { | 5002 if (monomorphic) { |
4996 map = types->first(); | 5003 map = types->first(); |
4997 monomorphic = CanInlinePropertyAccess(*map); | 5004 monomorphic = CanInlinePropertyAccess(*map); |
4998 } | 5005 } |
5006 | |
4999 if (monomorphic) { | 5007 if (monomorphic) { |
5000 Handle<JSFunction> setter; | 5008 Handle<JSFunction> setter; |
5001 Handle<JSObject> holder; | 5009 Handle<JSObject> holder; |
5002 if (LookupSetter(map, name, &setter, &holder)) { | 5010 if (LookupSetter(map, name, &setter, &holder)) { |
5003 AddCheckConstantFunction(holder, object, map); | 5011 AddCheckConstantFunction(holder, object, map); |
5004 if (FLAG_inline_accessors && | 5012 if (FLAG_inline_accessors && |
5005 TryInlineSetter(setter, id, assignment_id, value)) { | 5013 TryInlineSetter(setter, id, assignment_id, value)) { |
5006 return; | 5014 return; |
5007 } | 5015 } |
5008 Drop(2); | 5016 Drop(2); |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5685 HValue* obj, | 5693 HValue* obj, |
5686 HValue* key, | 5694 HValue* key, |
5687 HValue* val, | 5695 HValue* val, |
5688 Expression* expr, | 5696 Expression* expr, |
5689 BailoutId ast_id, | 5697 BailoutId ast_id, |
5690 int position, | 5698 int position, |
5691 bool is_store, | 5699 bool is_store, |
5692 bool* has_side_effects) { | 5700 bool* has_side_effects) { |
5693 ASSERT(!expr->IsPropertyName()); | 5701 ASSERT(!expr->IsPropertyName()); |
5694 HInstruction* instr = NULL; | 5702 HInstruction* instr = NULL; |
5695 if (expr->IsMonomorphic()) { | 5703 bool monomorphic = expr->IsMonomorphic(); |
5704 SmallMapList* types = expr->GetReceiverTypes(); | |
5705 | |
5706 if (types != NULL && obj->HasMonomorphicJSObjectType()) { | |
Michael Starzinger
2013/09/05 20:07:23
suggestion: Does it make sense to factor this out
Toon Verwaest
2013/09/06 09:23:12
Done.
| |
5707 types->FilterForPossibleTransitions( | |
5708 obj->GetMonomorphicJSObjectMap()->FindRootMap(), zone()); | |
5709 monomorphic = types->length() == 1; | |
5710 } | |
5711 | |
5712 if (monomorphic) { | |
5696 Handle<Map> map = expr->GetMonomorphicReceiverType(); | 5713 Handle<Map> map = expr->GetMonomorphicReceiverType(); |
5697 if (map->has_slow_elements_kind()) { | 5714 if (map->has_slow_elements_kind()) { |
5698 instr = is_store ? BuildStoreKeyedGeneric(obj, key, val) | 5715 instr = is_store ? BuildStoreKeyedGeneric(obj, key, val) |
5699 : BuildLoadKeyedGeneric(obj, key); | 5716 : BuildLoadKeyedGeneric(obj, key); |
5700 AddInstruction(instr); | 5717 AddInstruction(instr); |
5701 } else { | 5718 } else { |
5702 BuildCheckHeapObject(obj); | 5719 BuildCheckHeapObject(obj); |
5703 instr = BuildMonomorphicElementAccess( | 5720 instr = BuildMonomorphicElementAccess( |
5704 obj, key, val, NULL, map, is_store, expr->GetStoreMode()); | 5721 obj, key, val, NULL, map, is_store, expr->GetStoreMode()); |
5705 } | 5722 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5854 } else if (expr->IsFunctionPrototype()) { | 5871 } else if (expr->IsFunctionPrototype()) { |
5855 HValue* function = Pop(); | 5872 HValue* function = Pop(); |
5856 BuildCheckHeapObject(function); | 5873 BuildCheckHeapObject(function); |
5857 instr = new(zone()) HLoadFunctionPrototype(function); | 5874 instr = new(zone()) HLoadFunctionPrototype(function); |
5858 | 5875 |
5859 } else if (expr->key()->IsPropertyName()) { | 5876 } else if (expr->key()->IsPropertyName()) { |
5860 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); | 5877 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); |
5861 SmallMapList* types = expr->GetReceiverTypes(); | 5878 SmallMapList* types = expr->GetReceiverTypes(); |
5862 HValue* object = Top(); | 5879 HValue* object = Top(); |
5863 | 5880 |
5881 bool monomorphic = expr->IsMonomorphic(); | |
5882 if (types != NULL && object->HasMonomorphicJSObjectType()) { | |
5883 types->FilterForPossibleTransitions( | |
5884 object->GetMonomorphicJSObjectMap()->FindRootMap(), zone()); | |
5885 monomorphic = types->length() == 1; | |
5886 } | |
5887 | |
5864 Handle<Map> map; | 5888 Handle<Map> map; |
5865 bool monomorphic = false; | 5889 if (monomorphic) { |
5866 if (expr->IsMonomorphic()) { | |
5867 map = types->first(); | 5890 map = types->first(); |
5868 monomorphic = CanInlinePropertyAccess(*map); | 5891 monomorphic = CanInlinePropertyAccess(*map); |
5869 } else if (object->HasMonomorphicJSObjectType()) { | |
5870 map = object->GetMonomorphicJSObjectMap(); | |
5871 monomorphic = CanInlinePropertyAccess(*map); | |
5872 } | 5892 } |
5893 | |
5873 if (monomorphic) { | 5894 if (monomorphic) { |
5874 Handle<JSFunction> getter; | 5895 Handle<JSFunction> getter; |
5875 Handle<JSObject> holder; | 5896 Handle<JSObject> holder; |
5876 if (LookupGetter(map, name, &getter, &holder)) { | 5897 if (LookupGetter(map, name, &getter, &holder)) { |
5877 AddCheckConstantFunction(holder, Top(), map); | 5898 AddCheckConstantFunction(holder, Top(), map); |
5878 if (FLAG_inline_accessors && | 5899 if (FLAG_inline_accessors && |
5879 TryInlineGetter(getter, ast_id, expr->LoadId())) { | 5900 TryInlineGetter(getter, ast_id, expr->LoadId())) { |
5880 return; | 5901 return; |
5881 } | 5902 } |
5882 Add<HPushArgument>(Pop()); | 5903 Add<HPushArgument>(Pop()); |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6960 | 6981 |
6961 // Named function call. | 6982 // Named function call. |
6962 if (TryCallApply(expr)) return; | 6983 if (TryCallApply(expr)) return; |
6963 | 6984 |
6964 CHECK_ALIVE(VisitForValue(prop->obj())); | 6985 CHECK_ALIVE(VisitForValue(prop->obj())); |
6965 CHECK_ALIVE(VisitExpressions(expr->arguments())); | 6986 CHECK_ALIVE(VisitExpressions(expr->arguments())); |
6966 | 6987 |
6967 Handle<String> name = prop->key()->AsLiteral()->AsPropertyName(); | 6988 Handle<String> name = prop->key()->AsLiteral()->AsPropertyName(); |
6968 SmallMapList* types = expr->GetReceiverTypes(); | 6989 SmallMapList* types = expr->GetReceiverTypes(); |
6969 | 6990 |
6991 | |
Michael Starzinger
2013/09/05 20:07:23
nit: Drop one of the two empty newlines.
| |
6992 HValue* receiver = | |
6993 environment()->ExpressionStackAt(expr->arguments()->length()); | |
6994 | |
6970 bool monomorphic = expr->IsMonomorphic(); | 6995 bool monomorphic = expr->IsMonomorphic(); |
6996 if (types != NULL && receiver->HasMonomorphicJSObjectType()) { | |
6997 types->FilterForPossibleTransitions( | |
6998 receiver->GetMonomorphicJSObjectMap()->FindRootMap(), zone()); | |
6999 monomorphic = types->length() == 1 && | |
7000 expr->ComputeTarget(types->at(0), name); | |
7001 } | |
7002 | |
6971 Handle<Map> receiver_map; | 7003 Handle<Map> receiver_map; |
6972 if (monomorphic) { | 7004 if (monomorphic) { |
6973 receiver_map = (types == NULL || types->is_empty()) | 7005 receiver_map = (types == NULL || types->is_empty()) |
Michael Starzinger
2013/09/05 20:07:23
I know it's not part of this change, but can "type
| |
6974 ? Handle<Map>::null() | 7006 ? Handle<Map>::null() |
6975 : types->first(); | 7007 : types->first(); |
6976 } | 7008 } |
6977 | 7009 |
6978 HValue* receiver = | |
6979 environment()->ExpressionStackAt(expr->arguments()->length()); | |
6980 if (monomorphic) { | 7010 if (monomorphic) { |
6981 if (TryInlineBuiltinMethodCall(expr, | 7011 if (TryInlineBuiltinMethodCall(expr, |
6982 receiver, | 7012 receiver, |
6983 receiver_map, | 7013 receiver_map, |
6984 expr->check_type())) { | 7014 expr->check_type())) { |
6985 if (FLAG_trace_inlining) { | 7015 if (FLAG_trace_inlining) { |
6986 PrintF("Inlining builtin "); | 7016 PrintF("Inlining builtin "); |
6987 expr->target()->ShortPrint(); | 7017 expr->target()->ShortPrint(); |
6988 PrintF("\n"); | 7018 PrintF("\n"); |
6989 } | 7019 } |
(...skipping 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9722 if (ShouldProduceTraceOutput()) { | 9752 if (ShouldProduceTraceOutput()) { |
9723 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9753 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9724 } | 9754 } |
9725 | 9755 |
9726 #ifdef DEBUG | 9756 #ifdef DEBUG |
9727 graph_->Verify(false); // No full verify. | 9757 graph_->Verify(false); // No full verify. |
9728 #endif | 9758 #endif |
9729 } | 9759 } |
9730 | 9760 |
9731 } } // namespace v8::internal | 9761 } } // namespace v8::internal |
OLD | NEW |