| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // Set the target to the pre monomorphic stub to delay | 498 // Set the target to the pre monomorphic stub to delay |
| 499 // setting the monomorphic state. | 499 // setting the monomorphic state. |
| 500 code = StubCache::ComputeCallPreMonomorphic(argc, in_loop); | 500 code = StubCache::ComputeCallPreMonomorphic(argc, in_loop); |
| 501 } else if (state == MONOMORPHIC) { | 501 } else if (state == MONOMORPHIC) { |
| 502 code = StubCache::ComputeCallMegamorphic(argc, in_loop); | 502 code = StubCache::ComputeCallMegamorphic(argc, in_loop); |
| 503 } else { | 503 } else { |
| 504 // Compute monomorphic stub. | 504 // Compute monomorphic stub. |
| 505 switch (lookup->type()) { | 505 switch (lookup->type()) { |
| 506 case FIELD: { | 506 case FIELD: { |
| 507 int index = lookup->GetFieldIndex(); | 507 int index = lookup->GetFieldIndex(); |
| 508 code = StubCache::ComputeCallField(argc, in_loop, *name, *object, | 508 code = Isolate::Current()->stub_cache()->ComputeCallField( |
| 509 lookup->holder(), index); | 509 argc, |
| 510 in_loop, |
| 511 *name, |
| 512 *object, |
| 513 lookup->holder(), |
| 514 index); |
| 510 break; | 515 break; |
| 511 } | 516 } |
| 512 case CONSTANT_FUNCTION: { | 517 case CONSTANT_FUNCTION: { |
| 513 // Get the constant function and compute the code stub for this | 518 // Get the constant function and compute the code stub for this |
| 514 // call; used for rewriting to monomorphic state and making sure | 519 // call; used for rewriting to monomorphic state and making sure |
| 515 // that the code stub is in the stub cache. | 520 // that the code stub is in the stub cache. |
| 516 JSFunction* function = lookup->GetConstantFunction(); | 521 JSFunction* function = lookup->GetConstantFunction(); |
| 517 code = StubCache::ComputeCallConstant(argc, in_loop, *name, *object, | 522 code = Isolate::Current()->stub_cache()->ComputeCallConstant( |
| 518 lookup->holder(), function); | 523 argc, |
| 524 in_loop, |
| 525 *name, |
| 526 *object, |
| 527 lookup->holder(), |
| 528 function); |
| 519 break; | 529 break; |
| 520 } | 530 } |
| 521 case NORMAL: { | 531 case NORMAL: { |
| 522 if (!object->IsJSObject()) return; | 532 if (!object->IsJSObject()) return; |
| 523 Handle<JSObject> receiver = Handle<JSObject>::cast(object); | 533 Handle<JSObject> receiver = Handle<JSObject>::cast(object); |
| 524 | 534 |
| 525 if (lookup->holder()->IsGlobalObject()) { | 535 if (lookup->holder()->IsGlobalObject()) { |
| 526 GlobalObject* global = GlobalObject::cast(lookup->holder()); | 536 GlobalObject* global = GlobalObject::cast(lookup->holder()); |
| 527 JSGlobalPropertyCell* cell = | 537 JSGlobalPropertyCell* cell = |
| 528 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); | 538 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); |
| 529 if (!cell->value()->IsJSFunction()) return; | 539 if (!cell->value()->IsJSFunction()) return; |
| 530 JSFunction* function = JSFunction::cast(cell->value()); | 540 JSFunction* function = JSFunction::cast(cell->value()); |
| 531 code = StubCache::ComputeCallGlobal(argc, | 541 code = Isolate::Current()->stub_cache()->ComputeCallGlobal(argc, |
| 532 in_loop, | 542 in_loop, |
| 533 *name, | 543 *name, |
| 534 *receiver, | 544 *receiver, |
| 535 global, | 545 global, |
| 536 cell, | 546 cell, |
| 537 function); | 547 function); |
| 538 } else { | 548 } else { |
| 539 // There is only one shared stub for calling normalized | 549 // There is only one shared stub for calling normalized |
| 540 // properties. It does not traverse the prototype chain, so the | 550 // properties. It does not traverse the prototype chain, so the |
| 541 // property must be found in the receiver for the stub to be | 551 // property must be found in the receiver for the stub to be |
| 542 // applicable. | 552 // applicable. |
| 543 if (lookup->holder() != *receiver) return; | 553 if (lookup->holder() != *receiver) return; |
| 544 code = StubCache::ComputeCallNormal(argc, in_loop, *name, *receiver); | 554 code = Isolate::Current()->stub_cache()->ComputeCallNormal(argc, |
| 555 in_loop, |
| 556 *name, |
| 557 *receiver); |
| 545 } | 558 } |
| 546 break; | 559 break; |
| 547 } | 560 } |
| 548 case INTERCEPTOR: { | 561 case INTERCEPTOR: { |
| 549 ASSERT(HasInterceptorGetter(lookup->holder())); | 562 ASSERT(HasInterceptorGetter(lookup->holder())); |
| 550 code = StubCache::ComputeCallInterceptor(argc, *name, *object, | 563 code = Isolate::Current()->stub_cache()->ComputeCallInterceptor( |
| 551 lookup->holder()); | 564 argc, |
| 565 *name, |
| 566 *object, |
| 567 lookup->holder()); |
| 552 break; | 568 break; |
| 553 } | 569 } |
| 554 default: | 570 default: |
| 555 return; | 571 return; |
| 556 } | 572 } |
| 557 } | 573 } |
| 558 | 574 |
| 559 // If we're unable to compute the stub (not enough memory left), we | 575 // If we're unable to compute the stub (not enough memory left), we |
| 560 // simply avoid updating the caches. | 576 // simply avoid updating the caches. |
| 561 if (code == NULL || code->IsFailure()) return; | 577 if (code == NULL || code->IsFailure()) return; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 | 731 |
| 716 // Compute the code stub for this load. | 732 // Compute the code stub for this load. |
| 717 Object* code = NULL; | 733 Object* code = NULL; |
| 718 if (state == UNINITIALIZED) { | 734 if (state == UNINITIALIZED) { |
| 719 // This is the first time we execute this inline cache. | 735 // This is the first time we execute this inline cache. |
| 720 // Set the target to the pre monomorphic stub to delay | 736 // Set the target to the pre monomorphic stub to delay |
| 721 // setting the monomorphic state. | 737 // setting the monomorphic state. |
| 722 code = pre_monomorphic_stub(); | 738 code = pre_monomorphic_stub(); |
| 723 } else if (!lookup->IsProperty()) { | 739 } else if (!lookup->IsProperty()) { |
| 724 // Nonexistent property. The result is undefined. | 740 // Nonexistent property. The result is undefined. |
| 725 code = StubCache::ComputeLoadNonexistent(*name, *receiver); | 741 code = Isolate::Current()->stub_cache()->ComputeLoadNonexistent(*name, |
| 742 *receiver); |
| 726 } else { | 743 } else { |
| 727 // Compute monomorphic stub. | 744 // Compute monomorphic stub. |
| 728 switch (lookup->type()) { | 745 switch (lookup->type()) { |
| 729 case FIELD: { | 746 case FIELD: { |
| 730 code = StubCache::ComputeLoadField(*name, *receiver, | 747 code = Isolate::Current()->stub_cache()->ComputeLoadField( |
| 731 lookup->holder(), | 748 *name, |
| 732 lookup->GetFieldIndex()); | 749 *receiver, |
| 750 lookup->holder(), |
| 751 lookup->GetFieldIndex()); |
| 733 break; | 752 break; |
| 734 } | 753 } |
| 735 case CONSTANT_FUNCTION: { | 754 case CONSTANT_FUNCTION: { |
| 736 Object* constant = lookup->GetConstantFunction(); | 755 Object* constant = lookup->GetConstantFunction(); |
| 737 code = StubCache::ComputeLoadConstant(*name, *receiver, | 756 code = Isolate::Current()->stub_cache()->ComputeLoadConstant( |
| 738 lookup->holder(), constant); | 757 *name, |
| 758 *receiver, |
| 759 lookup->holder(), |
| 760 constant); |
| 739 break; | 761 break; |
| 740 } | 762 } |
| 741 case NORMAL: { | 763 case NORMAL: { |
| 742 if (lookup->holder()->IsGlobalObject()) { | 764 if (lookup->holder()->IsGlobalObject()) { |
| 743 GlobalObject* global = GlobalObject::cast(lookup->holder()); | 765 GlobalObject* global = GlobalObject::cast(lookup->holder()); |
| 744 JSGlobalPropertyCell* cell = | 766 JSGlobalPropertyCell* cell = |
| 745 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); | 767 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); |
| 746 code = StubCache::ComputeLoadGlobal(*name, | 768 code = Isolate::Current()->stub_cache()->ComputeLoadGlobal( |
| 747 *receiver, | 769 *name, |
| 748 global, | 770 *receiver, |
| 749 cell, | 771 global, |
| 750 lookup->IsDontDelete()); | 772 cell, |
| 773 lookup->IsDontDelete()); |
| 751 } else { | 774 } else { |
| 752 // There is only one shared stub for loading normalized | 775 // There is only one shared stub for loading normalized |
| 753 // properties. It does not traverse the prototype chain, so the | 776 // properties. It does not traverse the prototype chain, so the |
| 754 // property must be found in the receiver for the stub to be | 777 // property must be found in the receiver for the stub to be |
| 755 // applicable. | 778 // applicable. |
| 756 if (lookup->holder() != *receiver) return; | 779 if (lookup->holder() != *receiver) return; |
| 757 code = StubCache::ComputeLoadNormal(*name, *receiver); | 780 code = Isolate::Current()->stub_cache()->ComputeLoadNormal(*name, |
| 781 *receiver); |
| 758 } | 782 } |
| 759 break; | 783 break; |
| 760 } | 784 } |
| 761 case CALLBACKS: { | 785 case CALLBACKS: { |
| 762 if (!lookup->GetCallbackObject()->IsAccessorInfo()) return; | 786 if (!lookup->GetCallbackObject()->IsAccessorInfo()) return; |
| 763 AccessorInfo* callback = | 787 AccessorInfo* callback = |
| 764 AccessorInfo::cast(lookup->GetCallbackObject()); | 788 AccessorInfo::cast(lookup->GetCallbackObject()); |
| 765 if (v8::ToCData<Address>(callback->getter()) == 0) return; | 789 if (v8::ToCData<Address>(callback->getter()) == 0) return; |
| 766 code = StubCache::ComputeLoadCallback(*name, *receiver, | 790 code = Isolate::Current()->stub_cache()->ComputeLoadCallback( |
| 767 lookup->holder(), callback); | 791 *name, |
| 792 *receiver, |
| 793 lookup->holder(), |
| 794 callback); |
| 768 break; | 795 break; |
| 769 } | 796 } |
| 770 case INTERCEPTOR: { | 797 case INTERCEPTOR: { |
| 771 ASSERT(HasInterceptorGetter(lookup->holder())); | 798 ASSERT(HasInterceptorGetter(lookup->holder())); |
| 772 code = StubCache::ComputeLoadInterceptor(*name, *receiver, | 799 code = Isolate::Current()->stub_cache()->ComputeLoadInterceptor( |
| 773 lookup->holder()); | 800 *name, |
| 801 *receiver, |
| 802 lookup->holder()); |
| 774 break; | 803 break; |
| 775 } | 804 } |
| 776 default: | 805 default: |
| 777 return; | 806 return; |
| 778 } | 807 } |
| 779 } | 808 } |
| 780 | 809 |
| 781 // If we're unable to compute the stub (not enough memory left), we | 810 // If we're unable to compute the stub (not enough memory left), we |
| 782 // simply avoid updating the caches. | 811 // simply avoid updating the caches. |
| 783 if (code == NULL || code->IsFailure()) return; | 812 if (code == NULL || code->IsFailure()) return; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 806 // of its properties; throw a TypeError in that case. | 835 // of its properties; throw a TypeError in that case. |
| 807 if (object->IsUndefined() || object->IsNull()) { | 836 if (object->IsUndefined() || object->IsNull()) { |
| 808 return TypeError("non_object_property_load", object, name); | 837 return TypeError("non_object_property_load", object, name); |
| 809 } | 838 } |
| 810 | 839 |
| 811 if (FLAG_use_ic) { | 840 if (FLAG_use_ic) { |
| 812 // Use specialized code for getting the length of strings. | 841 // Use specialized code for getting the length of strings. |
| 813 if (object->IsString() && name->Equals(HEAP->length_symbol())) { | 842 if (object->IsString() && name->Equals(HEAP->length_symbol())) { |
| 814 Handle<String> string = Handle<String>::cast(object); | 843 Handle<String> string = Handle<String>::cast(object); |
| 815 Object* code = NULL; | 844 Object* code = NULL; |
| 816 code = StubCache::ComputeKeyedLoadStringLength(*name, *string); | 845 code = Isolate::Current()->stub_cache()->ComputeKeyedLoadStringLength( |
| 846 *name, |
| 847 *string); |
| 817 if (code->IsFailure()) return code; | 848 if (code->IsFailure()) return code; |
| 818 set_target(Code::cast(code)); | 849 set_target(Code::cast(code)); |
| 819 #ifdef DEBUG | 850 #ifdef DEBUG |
| 820 TraceIC("KeyedLoadIC", name, state, target()); | 851 TraceIC("KeyedLoadIC", name, state, target()); |
| 821 #endif // DEBUG | 852 #endif // DEBUG |
| 822 return Smi::FromInt(string->length()); | 853 return Smi::FromInt(string->length()); |
| 823 } | 854 } |
| 824 | 855 |
| 825 // Use specialized code for getting the length of arrays. | 856 // Use specialized code for getting the length of arrays. |
| 826 if (object->IsJSArray() && name->Equals(HEAP->length_symbol())) { | 857 if (object->IsJSArray() && name->Equals(HEAP->length_symbol())) { |
| 827 Handle<JSArray> array = Handle<JSArray>::cast(object); | 858 Handle<JSArray> array = Handle<JSArray>::cast(object); |
| 828 Object* code = StubCache::ComputeKeyedLoadArrayLength(*name, *array); | 859 Object* code = |
| 860 Isolate::Current()->stub_cache()->ComputeKeyedLoadArrayLength( |
| 861 *name, |
| 862 *array); |
| 829 if (code->IsFailure()) return code; | 863 if (code->IsFailure()) return code; |
| 830 set_target(Code::cast(code)); | 864 set_target(Code::cast(code)); |
| 831 #ifdef DEBUG | 865 #ifdef DEBUG |
| 832 TraceIC("KeyedLoadIC", name, state, target()); | 866 TraceIC("KeyedLoadIC", name, state, target()); |
| 833 #endif // DEBUG | 867 #endif // DEBUG |
| 834 return JSArray::cast(*object)->length(); | 868 return JSArray::cast(*object)->length(); |
| 835 } | 869 } |
| 836 | 870 |
| 837 // Use specialized code for getting prototype of functions. | 871 // Use specialized code for getting prototype of functions. |
| 838 if (object->IsJSFunction() && name->Equals(HEAP->prototype_symbol()) && | 872 if (object->IsJSFunction() && name->Equals(HEAP->prototype_symbol()) && |
| 839 JSFunction::cast(*object)->should_have_prototype()) { | 873 JSFunction::cast(*object)->should_have_prototype()) { |
| 840 Handle<JSFunction> function = Handle<JSFunction>::cast(object); | 874 Handle<JSFunction> function = Handle<JSFunction>::cast(object); |
| 841 Object* code = | 875 Object* code = |
| 842 StubCache::ComputeKeyedLoadFunctionPrototype(*name, *function); | 876 Isolate::Current()->stub_cache()->ComputeKeyedLoadFunctionPrototype( |
| 877 *name, |
| 878 *function); |
| 843 if (code->IsFailure()) return code; | 879 if (code->IsFailure()) return code; |
| 844 set_target(Code::cast(code)); | 880 set_target(Code::cast(code)); |
| 845 #ifdef DEBUG | 881 #ifdef DEBUG |
| 846 TraceIC("KeyedLoadIC", name, state, target()); | 882 TraceIC("KeyedLoadIC", name, state, target()); |
| 847 #endif // DEBUG | 883 #endif // DEBUG |
| 848 return Accessors::FunctionGetPrototype(*object, 0); | 884 return Accessors::FunctionGetPrototype(*object, 0); |
| 849 } | 885 } |
| 850 } | 886 } |
| 851 | 887 |
| 852 // Check if the name is trivially convertible to an index and get | 888 // Check if the name is trivially convertible to an index and get |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 | 972 |
| 937 if (state == UNINITIALIZED) { | 973 if (state == UNINITIALIZED) { |
| 938 // This is the first time we execute this inline cache. | 974 // This is the first time we execute this inline cache. |
| 939 // Set the target to the pre monomorphic stub to delay | 975 // Set the target to the pre monomorphic stub to delay |
| 940 // setting the monomorphic state. | 976 // setting the monomorphic state. |
| 941 code = pre_monomorphic_stub(); | 977 code = pre_monomorphic_stub(); |
| 942 } else { | 978 } else { |
| 943 // Compute a monomorphic stub. | 979 // Compute a monomorphic stub. |
| 944 switch (lookup->type()) { | 980 switch (lookup->type()) { |
| 945 case FIELD: { | 981 case FIELD: { |
| 946 code = StubCache::ComputeKeyedLoadField(*name, *receiver, | 982 code = Isolate::Current()->stub_cache()->ComputeKeyedLoadField( |
| 947 lookup->holder(), | 983 *name, |
| 948 lookup->GetFieldIndex()); | 984 *receiver, |
| 985 lookup->holder(), |
| 986 lookup->GetFieldIndex()); |
| 949 break; | 987 break; |
| 950 } | 988 } |
| 951 case CONSTANT_FUNCTION: { | 989 case CONSTANT_FUNCTION: { |
| 952 Object* constant = lookup->GetConstantFunction(); | 990 Object* constant = lookup->GetConstantFunction(); |
| 953 code = StubCache::ComputeKeyedLoadConstant(*name, *receiver, | 991 code = Isolate::Current()->stub_cache()->ComputeKeyedLoadConstant( |
| 954 lookup->holder(), constant); | 992 *name, |
| 993 *receiver, |
| 994 lookup->holder(), |
| 995 constant); |
| 955 break; | 996 break; |
| 956 } | 997 } |
| 957 case CALLBACKS: { | 998 case CALLBACKS: { |
| 958 if (!lookup->GetCallbackObject()->IsAccessorInfo()) return; | 999 if (!lookup->GetCallbackObject()->IsAccessorInfo()) return; |
| 959 AccessorInfo* callback = | 1000 AccessorInfo* callback = |
| 960 AccessorInfo::cast(lookup->GetCallbackObject()); | 1001 AccessorInfo::cast(lookup->GetCallbackObject()); |
| 961 if (v8::ToCData<Address>(callback->getter()) == 0) return; | 1002 if (v8::ToCData<Address>(callback->getter()) == 0) return; |
| 962 code = StubCache::ComputeKeyedLoadCallback(*name, *receiver, | 1003 code = Isolate::Current()->stub_cache()->ComputeKeyedLoadCallback( |
| 963 lookup->holder(), callback); | 1004 *name, |
| 1005 *receiver, |
| 1006 lookup->holder(), |
| 1007 callback); |
| 964 break; | 1008 break; |
| 965 } | 1009 } |
| 966 case INTERCEPTOR: { | 1010 case INTERCEPTOR: { |
| 967 ASSERT(HasInterceptorGetter(lookup->holder())); | 1011 ASSERT(HasInterceptorGetter(lookup->holder())); |
| 968 code = StubCache::ComputeKeyedLoadInterceptor(*name, *receiver, | 1012 code = Isolate::Current()->stub_cache()->ComputeKeyedLoadInterceptor( |
| 969 lookup->holder()); | 1013 *name, |
| 1014 *receiver, |
| 1015 lookup->holder()); |
| 970 break; | 1016 break; |
| 971 } | 1017 } |
| 972 default: { | 1018 default: { |
| 973 // Always rewrite to the generic case so that we do not | 1019 // Always rewrite to the generic case so that we do not |
| 974 // repeatedly try to rewrite. | 1020 // repeatedly try to rewrite. |
| 975 code = generic_stub(); | 1021 code = generic_stub(); |
| 976 break; | 1022 break; |
| 977 } | 1023 } |
| 978 } | 1024 } |
| 979 } | 1025 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 // where there is extra room in the object, we leave the IC in its | 1138 // where there is extra room in the object, we leave the IC in its |
| 1093 // current state. | 1139 // current state. |
| 1094 PropertyType type = lookup->type(); | 1140 PropertyType type = lookup->type(); |
| 1095 | 1141 |
| 1096 // Compute the code stub for this store; used for rewriting to | 1142 // Compute the code stub for this store; used for rewriting to |
| 1097 // monomorphic state and making sure that the code stub is in the | 1143 // monomorphic state and making sure that the code stub is in the |
| 1098 // stub cache. | 1144 // stub cache. |
| 1099 Object* code = NULL; | 1145 Object* code = NULL; |
| 1100 switch (type) { | 1146 switch (type) { |
| 1101 case FIELD: { | 1147 case FIELD: { |
| 1102 code = StubCache::ComputeStoreField(*name, *receiver, | 1148 code = Isolate::Current()->stub_cache()->ComputeStoreField( |
| 1103 lookup->GetFieldIndex()); | 1149 *name, |
| 1150 *receiver, |
| 1151 lookup->GetFieldIndex()); |
| 1104 break; | 1152 break; |
| 1105 } | 1153 } |
| 1106 case MAP_TRANSITION: { | 1154 case MAP_TRANSITION: { |
| 1107 if (lookup->GetAttributes() != NONE) return; | 1155 if (lookup->GetAttributes() != NONE) return; |
| 1108 HandleScope scope; | 1156 HandleScope scope; |
| 1109 ASSERT(type == MAP_TRANSITION); | 1157 ASSERT(type == MAP_TRANSITION); |
| 1110 Handle<Map> transition(lookup->GetTransitionMap()); | 1158 Handle<Map> transition(lookup->GetTransitionMap()); |
| 1111 int index = transition->PropertyIndexFor(*name); | 1159 int index = transition->PropertyIndexFor(*name); |
| 1112 code = StubCache::ComputeStoreField(*name, *receiver, index, *transition); | 1160 code = Isolate::Current()->stub_cache()->ComputeStoreField(*name, |
| 1161 *receiver, |
| 1162 index, |
| 1163 *transition); |
| 1113 break; | 1164 break; |
| 1114 } | 1165 } |
| 1115 case NORMAL: { | 1166 case NORMAL: { |
| 1116 if (!receiver->IsGlobalObject()) { | 1167 if (!receiver->IsGlobalObject()) { |
| 1117 return; | 1168 return; |
| 1118 } | 1169 } |
| 1119 // The stub generated for the global object picks the value directly | 1170 // The stub generated for the global object picks the value directly |
| 1120 // from the property cell. So the property must be directly on the | 1171 // from the property cell. So the property must be directly on the |
| 1121 // global object. | 1172 // global object. |
| 1122 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); | 1173 Handle<GlobalObject> global = Handle<GlobalObject>::cast(receiver); |
| 1123 JSGlobalPropertyCell* cell = | 1174 JSGlobalPropertyCell* cell = |
| 1124 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); | 1175 JSGlobalPropertyCell::cast(global->GetPropertyCell(lookup)); |
| 1125 code = StubCache::ComputeStoreGlobal(*name, *global, cell); | 1176 code = Isolate::Current()->stub_cache()->ComputeStoreGlobal(*name, |
| 1177 *global, |
| 1178 cell); |
| 1126 break; | 1179 break; |
| 1127 } | 1180 } |
| 1128 case CALLBACKS: { | 1181 case CALLBACKS: { |
| 1129 if (!lookup->GetCallbackObject()->IsAccessorInfo()) return; | 1182 if (!lookup->GetCallbackObject()->IsAccessorInfo()) return; |
| 1130 AccessorInfo* callback = AccessorInfo::cast(lookup->GetCallbackObject()); | 1183 AccessorInfo* callback = AccessorInfo::cast(lookup->GetCallbackObject()); |
| 1131 if (v8::ToCData<Address>(callback->setter()) == 0) return; | 1184 if (v8::ToCData<Address>(callback->setter()) == 0) return; |
| 1132 code = StubCache::ComputeStoreCallback(*name, *receiver, callback); | 1185 code = Isolate::Current()->stub_cache()->ComputeStoreCallback(*name, |
| 1186 *receiver, |
| 1187 callback); |
| 1133 break; | 1188 break; |
| 1134 } | 1189 } |
| 1135 case INTERCEPTOR: { | 1190 case INTERCEPTOR: { |
| 1136 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); | 1191 ASSERT(!receiver->GetNamedInterceptor()->setter()->IsUndefined()); |
| 1137 code = StubCache::ComputeStoreInterceptor(*name, *receiver); | 1192 code = Isolate::Current()->stub_cache()->ComputeStoreInterceptor( |
| 1193 *name, |
| 1194 *receiver); |
| 1138 break; | 1195 break; |
| 1139 } | 1196 } |
| 1140 default: | 1197 default: |
| 1141 return; | 1198 return; |
| 1142 } | 1199 } |
| 1143 | 1200 |
| 1144 // If we're unable to compute the stub (not enough memory left), we | 1201 // If we're unable to compute the stub (not enough memory left), we |
| 1145 // simply avoid updating the caches. | 1202 // simply avoid updating the caches. |
| 1146 if (code == NULL || code->IsFailure()) return; | 1203 if (code == NULL || code->IsFailure()) return; |
| 1147 | 1204 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 // current state. | 1296 // current state. |
| 1240 PropertyType type = lookup->type(); | 1297 PropertyType type = lookup->type(); |
| 1241 | 1298 |
| 1242 // Compute the code stub for this store; used for rewriting to | 1299 // Compute the code stub for this store; used for rewriting to |
| 1243 // monomorphic state and making sure that the code stub is in the | 1300 // monomorphic state and making sure that the code stub is in the |
| 1244 // stub cache. | 1301 // stub cache. |
| 1245 Object* code = NULL; | 1302 Object* code = NULL; |
| 1246 | 1303 |
| 1247 switch (type) { | 1304 switch (type) { |
| 1248 case FIELD: { | 1305 case FIELD: { |
| 1249 code = StubCache::ComputeKeyedStoreField(*name, *receiver, | 1306 code = Isolate::Current()->stub_cache()->ComputeKeyedStoreField( |
| 1250 lookup->GetFieldIndex()); | 1307 *name, |
| 1308 *receiver, |
| 1309 lookup->GetFieldIndex()); |
| 1251 break; | 1310 break; |
| 1252 } | 1311 } |
| 1253 case MAP_TRANSITION: { | 1312 case MAP_TRANSITION: { |
| 1254 if (lookup->GetAttributes() == NONE) { | 1313 if (lookup->GetAttributes() == NONE) { |
| 1255 HandleScope scope; | 1314 HandleScope scope; |
| 1256 ASSERT(type == MAP_TRANSITION); | 1315 ASSERT(type == MAP_TRANSITION); |
| 1257 Handle<Map> transition(lookup->GetTransitionMap()); | 1316 Handle<Map> transition(lookup->GetTransitionMap()); |
| 1258 int index = transition->PropertyIndexFor(*name); | 1317 int index = transition->PropertyIndexFor(*name); |
| 1259 code = StubCache::ComputeKeyedStoreField(*name, *receiver, | 1318 code = Isolate::Current()->stub_cache()->ComputeKeyedStoreField( |
| 1260 index, *transition); | 1319 *name, |
| 1320 *receiver, |
| 1321 index, |
| 1322 *transition); |
| 1261 break; | 1323 break; |
| 1262 } | 1324 } |
| 1263 // fall through. | 1325 // fall through. |
| 1264 } | 1326 } |
| 1265 default: { | 1327 default: { |
| 1266 // Always rewrite to the generic case so that we do not | 1328 // Always rewrite to the generic case so that we do not |
| 1267 // repeatedly try to rewrite. | 1329 // repeatedly try to rewrite. |
| 1268 code = generic_stub(); | 1330 code = generic_stub(); |
| 1269 break; | 1331 break; |
| 1270 } | 1332 } |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 #undef ADDR | 1572 #undef ADDR |
| 1511 }; | 1573 }; |
| 1512 | 1574 |
| 1513 | 1575 |
| 1514 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 1576 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 1515 return IC_utilities[id]; | 1577 return IC_utilities[id]; |
| 1516 } | 1578 } |
| 1517 | 1579 |
| 1518 | 1580 |
| 1519 } } // namespace v8::internal | 1581 } } // namespace v8::internal |
| OLD | NEW |