| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 ASSERT(!receiver.is(scratch)); | 892 ASSERT(!receiver.is(scratch)); |
| 893 | 893 |
| 894 typedef FunctionCallbackArguments FCA; | 894 typedef FunctionCallbackArguments FCA; |
| 895 const int stack_space = kFastApiCallArguments + argc + 1; | 895 const int stack_space = kFastApiCallArguments + argc + 1; |
| 896 // Assign stack space for the call arguments. | 896 // Assign stack space for the call arguments. |
| 897 __ Subu(sp, sp, Operand(stack_space * kPointerSize)); | 897 __ Subu(sp, sp, Operand(stack_space * kPointerSize)); |
| 898 // Write holder to stack frame. | 898 // Write holder to stack frame. |
| 899 __ sw(receiver, MemOperand(sp, FCA::kHolderIndex * kPointerSize)); | 899 __ sw(receiver, MemOperand(sp, FCA::kHolderIndex * kPointerSize)); |
| 900 // Write receiver to stack frame. | 900 // Write receiver to stack frame. |
| 901 int index = stack_space - 1; | 901 int index = stack_space - 1; |
| 902 __ sw(receiver, MemOperand(sp, index * kPointerSize)); | 902 __ sw(receiver, MemOperand(sp, index-- * kPointerSize)); |
| 903 // Write the arguments to stack frame. | 903 // Write the arguments to stack frame. |
| 904 for (int i = 0; i < argc; i++) { | 904 for (int i = 0; i < argc; i++) { |
| 905 ASSERT(!receiver.is(values[i])); | 905 ASSERT(!receiver.is(values[i])); |
| 906 ASSERT(!scratch.is(values[i])); | 906 ASSERT(!scratch.is(values[i])); |
| 907 __ sw(receiver, MemOperand(sp, index-- * kPointerSize)); | 907 __ sw(values[i], MemOperand(sp, index-- * kPointerSize)); |
| 908 } | 908 } |
| 909 | 909 |
| 910 GenerateFastApiDirectCall(masm, optimization, argc, true); | 910 GenerateFastApiDirectCall(masm, optimization, argc, true); |
| 911 } | 911 } |
| 912 | 912 |
| 913 | 913 |
| 914 class CallInterceptorCompiler BASE_EMBEDDED { | 914 class CallInterceptorCompiler BASE_EMBEDDED { |
| 915 public: | 915 public: |
| 916 CallInterceptorCompiler(CallStubCompiler* stub_compiler, | 916 CallInterceptorCompiler(CallStubCompiler* stub_compiler, |
| 917 const ParameterCount& arguments, | 917 const ParameterCount& arguments, |
| 918 Register name, | 918 Register name) |
| 919 ExtraICState extra_ic_state) | |
| 920 : stub_compiler_(stub_compiler), | 919 : stub_compiler_(stub_compiler), |
| 921 arguments_(arguments), | 920 arguments_(arguments), |
| 922 name_(name), | 921 name_(name) {} |
| 923 extra_ic_state_(extra_ic_state) {} | |
| 924 | 922 |
| 925 void Compile(MacroAssembler* masm, | 923 void Compile(MacroAssembler* masm, |
| 926 Handle<JSObject> object, | 924 Handle<JSObject> object, |
| 927 Handle<JSObject> holder, | 925 Handle<JSObject> holder, |
| 928 Handle<Name> name, | 926 Handle<Name> name, |
| 929 LookupResult* lookup, | 927 LookupResult* lookup, |
| 930 Register receiver, | 928 Register receiver, |
| 931 Register scratch1, | 929 Register scratch1, |
| 932 Register scratch2, | 930 Register scratch2, |
| 933 Register scratch3, | 931 Register scratch3, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 LoadWithInterceptor(masm, receiver, holder, interceptor_holder, scratch2, | 1000 LoadWithInterceptor(masm, receiver, holder, interceptor_holder, scratch2, |
| 1003 ®ular_invoke); | 1001 ®ular_invoke); |
| 1004 | 1002 |
| 1005 // Interceptor returned nothing for this property. Try to use cached | 1003 // Interceptor returned nothing for this property. Try to use cached |
| 1006 // constant function. | 1004 // constant function. |
| 1007 | 1005 |
| 1008 // Check that the maps from interceptor's holder to constant function's | 1006 // Check that the maps from interceptor's holder to constant function's |
| 1009 // holder haven't changed and thus we can use cached constant function. | 1007 // holder haven't changed and thus we can use cached constant function. |
| 1010 if (*interceptor_holder != lookup->holder()) { | 1008 if (*interceptor_holder != lookup->holder()) { |
| 1011 stub_compiler_->CheckPrototypes( | 1009 stub_compiler_->CheckPrototypes( |
| 1012 IC::CurrentTypeOf(interceptor_holder, masm->isolate()), receiver, | 1010 IC::CurrentTypeOf(interceptor_holder, masm->isolate()), holder, |
| 1013 handle(lookup->holder()), scratch1, scratch2, scratch3, | 1011 handle(lookup->holder()), scratch1, scratch2, scratch3, |
| 1014 name, depth2, miss); | 1012 name, depth2, miss); |
| 1015 } else { | 1013 } else { |
| 1016 // CheckPrototypes has a side effect of fetching a 'holder' | 1014 // CheckPrototypes has a side effect of fetching a 'holder' |
| 1017 // for API (object which is instanceof for the signature). It's | 1015 // for API (object which is instanceof for the signature). It's |
| 1018 // safe to omit it here, as if present, it should be fetched | 1016 // safe to omit it here, as if present, it should be fetched |
| 1019 // by the previous CheckPrototypes. | 1017 // by the previous CheckPrototypes. |
| 1020 ASSERT(depth2 == kInvalidProtoDepth); | 1018 ASSERT(depth2 == kInvalidProtoDepth); |
| 1021 } | 1019 } |
| 1022 | 1020 |
| 1023 // Invoke function. | 1021 // Invoke function. |
| 1024 if (can_do_fast_api_call) { | 1022 if (can_do_fast_api_call) { |
| 1025 GenerateFastApiDirectCall( | 1023 GenerateFastApiDirectCall( |
| 1026 masm, optimization, arguments_.immediate(), false); | 1024 masm, optimization, arguments_.immediate(), false); |
| 1027 } else { | 1025 } else { |
| 1028 Handle<JSFunction> function = optimization.constant_function(); | 1026 Handle<JSFunction> function = optimization.constant_function(); |
| 1029 stub_compiler_->GenerateJumpFunctionIgnoreReceiver(function); | 1027 __ Move(a0, receiver); |
| 1028 stub_compiler_->GenerateJumpFunction(object, function); |
| 1030 } | 1029 } |
| 1031 | 1030 |
| 1032 // Deferred code for fast API call case---clean preallocated space. | 1031 // Deferred code for fast API call case---clean preallocated space. |
| 1033 if (can_do_fast_api_call) { | 1032 if (can_do_fast_api_call) { |
| 1034 __ bind(&miss_cleanup); | 1033 __ bind(&miss_cleanup); |
| 1035 FreeSpaceForFastApiCall(masm); | 1034 FreeSpaceForFastApiCall(masm); |
| 1036 __ Branch(miss_label); | 1035 __ Branch(miss_label); |
| 1037 } | 1036 } |
| 1038 | 1037 |
| 1039 // Invoke a regular function. | 1038 // Invoke a regular function. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 | 1072 |
| 1074 void LoadWithInterceptor(MacroAssembler* masm, | 1073 void LoadWithInterceptor(MacroAssembler* masm, |
| 1075 Register receiver, | 1074 Register receiver, |
| 1076 Register holder, | 1075 Register holder, |
| 1077 Handle<JSObject> holder_obj, | 1076 Handle<JSObject> holder_obj, |
| 1078 Register scratch, | 1077 Register scratch, |
| 1079 Label* interceptor_succeeded) { | 1078 Label* interceptor_succeeded) { |
| 1080 { | 1079 { |
| 1081 FrameScope scope(masm, StackFrame::INTERNAL); | 1080 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1082 | 1081 |
| 1083 __ Push(holder, name_); | 1082 __ Push(receiver, holder, name_); |
| 1084 CompileCallLoadPropertyWithInterceptor( | 1083 CompileCallLoadPropertyWithInterceptor( |
| 1085 masm, receiver, holder, name_, holder_obj, | 1084 masm, receiver, holder, name_, holder_obj, |
| 1086 IC::kLoadPropertyWithInterceptorOnly); | 1085 IC::kLoadPropertyWithInterceptorOnly); |
| 1087 __ pop(name_); // Restore the name. | 1086 __ pop(name_); |
| 1088 __ pop(receiver); // Restore the holder. | 1087 __ pop(holder); |
| 1088 __ pop(receiver); |
| 1089 } | 1089 } |
| 1090 // If interceptor returns no-result sentinel, call the constant function. | 1090 // If interceptor returns no-result sentinel, call the constant function. |
| 1091 __ LoadRoot(scratch, Heap::kNoInterceptorResultSentinelRootIndex); | 1091 __ LoadRoot(scratch, Heap::kNoInterceptorResultSentinelRootIndex); |
| 1092 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch)); | 1092 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch)); |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 CallStubCompiler* stub_compiler_; | 1095 CallStubCompiler* stub_compiler_; |
| 1096 const ParameterCount& arguments_; | 1096 const ParameterCount& arguments_; |
| 1097 Register name_; | 1097 Register name_; |
| 1098 ExtraICState extra_ic_state_; | |
| 1099 }; | 1098 }; |
| 1100 | 1099 |
| 1101 | 1100 |
| 1102 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { | 1101 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { |
| 1103 __ Jump(code, RelocInfo::CODE_TARGET); | 1102 __ Jump(code, RelocInfo::CODE_TARGET); |
| 1104 } | 1103 } |
| 1105 | 1104 |
| 1106 | 1105 |
| 1107 #undef __ | 1106 #undef __ |
| 1108 #define __ ACCESS_MASM(masm()) | 1107 #define __ ACCESS_MASM(masm()) |
| (...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 GenerateNameCheck(name, &miss); | 2455 GenerateNameCheck(name, &miss); |
| 2457 | 2456 |
| 2458 // Get the number of arguments. | 2457 // Get the number of arguments. |
| 2459 const int argc = arguments().immediate(); | 2458 const int argc = arguments().immediate(); |
| 2460 LookupResult lookup(isolate()); | 2459 LookupResult lookup(isolate()); |
| 2461 LookupPostInterceptor(holder, name, &lookup); | 2460 LookupPostInterceptor(holder, name, &lookup); |
| 2462 | 2461 |
| 2463 // Get the receiver from the stack. | 2462 // Get the receiver from the stack. |
| 2464 __ lw(a1, MemOperand(sp, argc * kPointerSize)); | 2463 __ lw(a1, MemOperand(sp, argc * kPointerSize)); |
| 2465 | 2464 |
| 2466 CallInterceptorCompiler compiler(this, arguments(), a2, extra_state()); | 2465 CallInterceptorCompiler compiler(this, arguments(), a2); |
| 2467 compiler.Compile(masm(), object, holder, name, &lookup, a1, a3, t0, a0, | 2466 compiler.Compile(masm(), object, holder, name, &lookup, a1, a3, t0, a0, |
| 2468 &miss); | 2467 &miss); |
| 2469 | 2468 |
| 2470 // Move returned value, the function to call, to a1. | 2469 // Move returned value, the function to call, to a1. |
| 2471 __ mov(a1, v0); | 2470 __ mov(a1, v0); |
| 2472 // Restore receiver. | 2471 // Restore receiver. |
| 2473 __ lw(a0, MemOperand(sp, argc * kPointerSize)); | 2472 __ lw(a0, MemOperand(sp, argc * kPointerSize)); |
| 2474 | 2473 |
| 2475 GenerateJumpFunction(object, a1, &miss); | 2474 GenerateJumpFunction(object, a1, &miss); |
| 2476 | 2475 |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2885 // ----------------------------------- | 2884 // ----------------------------------- |
| 2886 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2885 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2887 } | 2886 } |
| 2888 | 2887 |
| 2889 | 2888 |
| 2890 #undef __ | 2889 #undef __ |
| 2891 | 2890 |
| 2892 } } // namespace v8::internal | 2891 } } // namespace v8::internal |
| 2893 | 2892 |
| 2894 #endif // V8_TARGET_ARCH_MIPS | 2893 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |