OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 Label miss; | 863 Label miss; |
864 NonexistentFrontendHeader(name, &miss, scratch2(), scratch3()); | 864 NonexistentFrontendHeader(name, &miss, scratch2(), scratch3()); |
865 GenerateLoadConstant(isolate()->factory()->undefined_value()); | 865 GenerateLoadConstant(isolate()->factory()->undefined_value()); |
866 FrontendFooter(name, &miss); | 866 FrontendFooter(name, &miss); |
867 return GetCode(kind(), Code::FAST, name); | 867 return GetCode(kind(), Code::FAST, name); |
868 } | 868 } |
869 | 869 |
870 | 870 |
871 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( | 871 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( |
872 Handle<Name> name, Handle<ExecutableAccessorInfo> callback) { | 872 Handle<Name> name, Handle<ExecutableAccessorInfo> callback) { |
873 Register reg = CallbackFrontend(receiver(), name, callback); | 873 Register reg = Frontend(receiver(), name); |
874 GenerateLoadCallback(reg, callback); | 874 GenerateLoadCallback(reg, callback); |
875 return GetCode(kind(), Code::FAST, name); | 875 return GetCode(kind(), Code::FAST, name); |
876 } | 876 } |
877 | 877 |
878 | 878 |
879 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( | 879 Handle<Code> NamedLoadHandlerCompiler::CompileLoadCallback( |
880 Handle<Name> name, const CallOptimization& call_optimization) { | 880 Handle<Name> name, const CallOptimization& call_optimization) { |
881 DCHECK(call_optimization.is_simple_api_call()); | 881 DCHECK(call_optimization.is_simple_api_call()); |
882 Handle<JSFunction> callback = call_optimization.constant_function(); | 882 Frontend(receiver(), name); |
883 CallbackFrontend(receiver(), name, callback); | |
884 Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate()); | 883 Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate()); |
885 GenerateFastApiCall( | 884 GenerateFastApiCall( |
886 masm(), call_optimization, receiver_map, | 885 masm(), call_optimization, receiver_map, |
887 receiver(), scratch1(), false, 0, NULL); | 886 receiver(), scratch1(), false, 0, NULL); |
888 return GetCode(kind(), Code::FAST, name); | 887 return GetCode(kind(), Code::FAST, name); |
889 } | 888 } |
890 | 889 |
891 | 890 |
892 Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor( | 891 Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor( |
893 Handle<Name> name) { | 892 Handle<Name> name) { |
(...skipping 11 matching lines...) Expand all Loading... |
905 // TODO(368): Compile in the whole chain: all the interceptors in | 904 // TODO(368): Compile in the whole chain: all the interceptors in |
906 // prototypes and ultimate answer. | 905 // prototypes and ultimate answer. |
907 GenerateLoadInterceptor(reg, &lookup, name); | 906 GenerateLoadInterceptor(reg, &lookup, name); |
908 return GetCode(kind(), Code::FAST, name); | 907 return GetCode(kind(), Code::FAST, name); |
909 } | 908 } |
910 | 909 |
911 | 910 |
912 void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( | 911 void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( |
913 Register interceptor_reg, Handle<Name> name, LookupResult* lookup) { | 912 Register interceptor_reg, Handle<Name> name, LookupResult* lookup) { |
914 Handle<JSObject> real_named_property_holder(lookup->holder()); | 913 Handle<JSObject> real_named_property_holder(lookup->holder()); |
| 914 |
| 915 set_type_for_object(holder()); |
| 916 set_holder(real_named_property_holder); |
| 917 Register reg = Frontend(interceptor_reg, name); |
| 918 |
915 if (lookup->IsField()) { | 919 if (lookup->IsField()) { |
916 FieldIndex field = lookup->GetFieldIndex(); | 920 GenerateLoadField(reg, lookup->GetFieldIndex(), lookup->representation()); |
917 if (holder().is_identical_to(real_named_property_holder)) { | |
918 GenerateLoadField(interceptor_reg, field, lookup->representation()); | |
919 } else { | |
920 set_type_for_object(holder()); | |
921 set_holder(real_named_property_holder); | |
922 Register reg = Frontend(interceptor_reg, name); | |
923 GenerateLoadField(reg, field, lookup->representation()); | |
924 } | |
925 } else { | 921 } else { |
926 // We found CALLBACKS property in prototype chain of interceptor's holder. | |
927 DCHECK(lookup->type() == CALLBACKS); | 922 DCHECK(lookup->type() == CALLBACKS); |
928 Handle<ExecutableAccessorInfo> callback( | 923 Handle<ExecutableAccessorInfo> callback( |
929 ExecutableAccessorInfo::cast(lookup->GetCallbackObject())); | 924 ExecutableAccessorInfo::cast(lookup->GetCallbackObject())); |
930 DCHECK(callback->getter() != NULL); | 925 DCHECK(callback->getter() != NULL); |
931 | |
932 set_type_for_object(holder()); | |
933 set_holder(real_named_property_holder); | |
934 Register reg = CallbackFrontend(interceptor_reg, name, callback); | |
935 GenerateLoadCallback(reg, callback); | 926 GenerateLoadCallback(reg, callback); |
936 } | 927 } |
937 } | 928 } |
938 | 929 |
939 | 930 |
940 Handle<Code> PropertyICCompiler::CompileMonomorphic(Handle<HeapType> type, | 931 Handle<Code> PropertyICCompiler::CompileMonomorphic(Handle<HeapType> type, |
941 Handle<Code> handler, | 932 Handle<Code> handler, |
942 Handle<Name> name, | 933 Handle<Name> name, |
943 IcCheckType check) { | 934 IcCheckType check) { |
944 TypeHandleList types(1); | 935 TypeHandleList types(1); |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 Handle<FunctionTemplateInfo>( | 1285 Handle<FunctionTemplateInfo>( |
1295 FunctionTemplateInfo::cast(signature->receiver())); | 1286 FunctionTemplateInfo::cast(signature->receiver())); |
1296 } | 1287 } |
1297 } | 1288 } |
1298 | 1289 |
1299 is_simple_api_call_ = true; | 1290 is_simple_api_call_ = true; |
1300 } | 1291 } |
1301 | 1292 |
1302 | 1293 |
1303 } } // namespace v8::internal | 1294 } } // namespace v8::internal |
OLD | NEW |