| 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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 607 |
| 608 | 608 |
| 609 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { | 609 RUNTIME_FUNCTION(StorePropertyWithInterceptor) { |
| 610 HandleScope scope(isolate); | 610 HandleScope scope(isolate); |
| 611 DCHECK(args.length() == 3); | 611 DCHECK(args.length() == 3); |
| 612 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); | 612 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); |
| 613 Handle<JSObject> receiver = args.at<JSObject>(0); | 613 Handle<JSObject> receiver = args.at<JSObject>(0); |
| 614 Handle<Name> name = args.at<Name>(1); | 614 Handle<Name> name = args.at<Name>(1); |
| 615 Handle<Object> value = args.at<Object>(2); | 615 Handle<Object> value = args.at<Object>(2); |
| 616 #ifdef DEBUG | 616 #ifdef DEBUG |
| 617 if (receiver->IsJSGlobalProxy()) { | 617 PrototypeIterator iter(isolate, receiver, |
| 618 PrototypeIterator iter(isolate, receiver); | 618 PrototypeIterator::START_AT_RECEIVER); |
| 619 DCHECK(iter.IsAtEnd() || | 619 bool found = false; |
| 620 Handle<JSGlobalObject>::cast(PrototypeIterator::GetCurrent(iter)) | 620 while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { |
| 621 ->HasNamedInterceptor()); | 621 Handle<Object> current = PrototypeIterator::GetCurrent(iter); |
| 622 } else { | 622 if (current->IsJSObject() && |
| 623 DCHECK(receiver->HasNamedInterceptor()); | 623 Handle<JSObject>::cast(current)->HasNamedInterceptor()) { |
| 624 found = true; |
| 625 break; |
| 626 } |
| 624 } | 627 } |
| 628 DCHECK(found); |
| 625 #endif | 629 #endif |
| 626 Handle<Object> result; | 630 Handle<Object> result; |
| 627 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 631 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 628 isolate, result, | 632 isolate, result, |
| 629 JSObject::SetProperty(receiver, name, value, ic.strict_mode())); | 633 JSObject::SetProperty(receiver, name, value, ic.strict_mode())); |
| 630 return *result; | 634 return *result; |
| 631 } | 635 } |
| 632 | 636 |
| 633 | 637 |
| 634 RUNTIME_FUNCTION(LoadElementWithInterceptor) { | 638 RUNTIME_FUNCTION(LoadElementWithInterceptor) { |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 Frontend(receiver(), name); | 886 Frontend(receiver(), name); |
| 883 Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate()); | 887 Handle<Map> receiver_map = IC::TypeToMap(*type(), isolate()); |
| 884 GenerateFastApiCall( | 888 GenerateFastApiCall( |
| 885 masm(), call_optimization, receiver_map, | 889 masm(), call_optimization, receiver_map, |
| 886 receiver(), scratch1(), false, 0, NULL); | 890 receiver(), scratch1(), false, 0, NULL); |
| 887 return GetCode(kind(), Code::FAST, name); | 891 return GetCode(kind(), Code::FAST, name); |
| 888 } | 892 } |
| 889 | 893 |
| 890 | 894 |
| 891 Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor( | 895 Handle<Code> NamedLoadHandlerCompiler::CompileLoadInterceptor( |
| 892 LookupIterator* it, Handle<Name> name) { | 896 LookupIterator* it) { |
| 893 // So far the most popular follow ups for interceptor loads are FIELD and | 897 // So far the most popular follow ups for interceptor loads are FIELD and |
| 894 // ExecutableAccessorInfo, so inline only them. Other cases may be added | 898 // ExecutableAccessorInfo, so inline only them. Other cases may be added |
| 895 // later. | 899 // later. |
| 896 bool inline_followup = it->state() == LookupIterator::PROPERTY; | 900 bool inline_followup = it->state() == LookupIterator::PROPERTY; |
| 897 if (inline_followup) { | 901 if (inline_followup) { |
| 898 switch (it->property_kind()) { | 902 switch (it->property_kind()) { |
| 899 case LookupIterator::DATA: | 903 case LookupIterator::DATA: |
| 900 inline_followup = it->property_details().type() == FIELD; | 904 inline_followup = it->property_details().type() == FIELD; |
| 901 break; | 905 break; |
| 902 case LookupIterator::ACCESSOR: { | 906 case LookupIterator::ACCESSOR: { |
| 903 Handle<Object> accessors = it->GetAccessors(); | 907 Handle<Object> accessors = it->GetAccessors(); |
| 904 inline_followup = accessors->IsExecutableAccessorInfo(); | 908 inline_followup = accessors->IsExecutableAccessorInfo(); |
| 905 if (!inline_followup) break; | 909 if (!inline_followup) break; |
| 906 Handle<ExecutableAccessorInfo> info = | 910 Handle<ExecutableAccessorInfo> info = |
| 907 Handle<ExecutableAccessorInfo>::cast(accessors); | 911 Handle<ExecutableAccessorInfo>::cast(accessors); |
| 908 inline_followup = info->getter() != NULL && | 912 inline_followup = info->getter() != NULL && |
| 909 ExecutableAccessorInfo::IsCompatibleReceiverType( | 913 ExecutableAccessorInfo::IsCompatibleReceiverType( |
| 910 isolate(), info, type()); | 914 isolate(), info, type()); |
| 911 } | 915 } |
| 912 } | 916 } |
| 913 } | 917 } |
| 914 | 918 |
| 915 Register reg = Frontend(receiver(), name); | 919 Register reg = Frontend(receiver(), it->name()); |
| 916 if (inline_followup) { | 920 if (inline_followup) { |
| 917 // TODO(368): Compile in the whole chain: all the interceptors in | 921 // TODO(368): Compile in the whole chain: all the interceptors in |
| 918 // prototypes and ultimate answer. | 922 // prototypes and ultimate answer. |
| 919 GenerateLoadInterceptorWithFollowup(it, reg); | 923 GenerateLoadInterceptorWithFollowup(it, reg); |
| 920 } else { | 924 } else { |
| 921 GenerateLoadInterceptor(reg); | 925 GenerateLoadInterceptor(reg); |
| 922 } | 926 } |
| 923 return GetCode(kind(), Code::FAST, name); | 927 return GetCode(kind(), Code::FAST, it->name()); |
| 924 } | 928 } |
| 925 | 929 |
| 926 | 930 |
| 927 void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( | 931 void NamedLoadHandlerCompiler::GenerateLoadPostInterceptor( |
| 928 LookupIterator* it, Register interceptor_reg) { | 932 LookupIterator* it, Register interceptor_reg) { |
| 929 Handle<JSObject> real_named_property_holder(it->GetHolder<JSObject>()); | 933 Handle<JSObject> real_named_property_holder(it->GetHolder<JSObject>()); |
| 930 | 934 |
| 931 set_type_for_object(holder()); | 935 set_type_for_object(holder()); |
| 932 set_holder(real_named_property_holder); | 936 set_holder(real_named_property_holder); |
| 933 Register reg = Frontend(interceptor_reg, it->name()); | 937 Register reg = Frontend(interceptor_reg, it->name()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 | 1004 |
| 1001 GenerateRestoreName(&miss, name); | 1005 GenerateRestoreName(&miss, name); |
| 1002 TailCallBuiltin(masm(), MissBuiltin(kind())); | 1006 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 1003 | 1007 |
| 1004 GenerateRestoreName(&slow, name); | 1008 GenerateRestoreName(&slow, name); |
| 1005 TailCallBuiltin(masm(), SlowBuiltin(kind())); | 1009 TailCallBuiltin(masm(), SlowBuiltin(kind())); |
| 1006 return GetCode(kind(), Code::FAST, name); | 1010 return GetCode(kind(), Code::FAST, name); |
| 1007 } | 1011 } |
| 1008 | 1012 |
| 1009 | 1013 |
| 1010 Handle<Code> NamedStoreHandlerCompiler::CompileStoreField(LookupResult* lookup, | 1014 Handle<Code> NamedStoreHandlerCompiler::CompileStoreField(LookupIterator* it) { |
| 1011 Handle<Name> name) { | |
| 1012 Label miss; | 1015 Label miss; |
| 1013 GenerateStoreField(lookup, value(), &miss); | 1016 GenerateStoreField(it, value(), &miss); |
| 1014 __ bind(&miss); | 1017 __ bind(&miss); |
| 1015 TailCallBuiltin(masm(), MissBuiltin(kind())); | 1018 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 1016 return GetCode(kind(), Code::FAST, name); | 1019 return GetCode(kind(), Code::FAST, it->name()); |
| 1017 } | 1020 } |
| 1018 | 1021 |
| 1019 | 1022 |
| 1020 Handle<Code> NamedStoreHandlerCompiler::CompileStoreViaSetter( | 1023 Handle<Code> NamedStoreHandlerCompiler::CompileStoreViaSetter( |
| 1021 Handle<JSObject> object, Handle<Name> name, Handle<JSFunction> setter) { | 1024 Handle<JSObject> object, Handle<Name> name, Handle<JSFunction> setter) { |
| 1022 Frontend(receiver(), name); | 1025 Frontend(receiver(), name); |
| 1023 GenerateStoreViaSetter(masm(), type(), receiver(), setter); | 1026 GenerateStoreViaSetter(masm(), type(), receiver(), setter); |
| 1024 | 1027 |
| 1025 return GetCode(kind(), Code::FAST, name); | 1028 return GetCode(kind(), Code::FAST, name); |
| 1026 } | 1029 } |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 Handle<FunctionTemplateInfo>( | 1290 Handle<FunctionTemplateInfo>( |
| 1288 FunctionTemplateInfo::cast(signature->receiver())); | 1291 FunctionTemplateInfo::cast(signature->receiver())); |
| 1289 } | 1292 } |
| 1290 } | 1293 } |
| 1291 | 1294 |
| 1292 is_simple_api_call_ = true; | 1295 is_simple_api_call_ = true; |
| 1293 } | 1296 } |
| 1294 | 1297 |
| 1295 | 1298 |
| 1296 } } // namespace v8::internal | 1299 } } // namespace v8::internal |
| OLD | NEW |