| 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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 | 957 |
| 958 // Return the generated code. | 958 // Return the generated code. |
| 959 String* function_name = NULL; | 959 String* function_name = NULL; |
| 960 if (function->shared()->name()->IsString()) { | 960 if (function->shared()->name()->IsString()) { |
| 961 function_name = String::cast(function->shared()->name()); | 961 function_name = String::cast(function->shared()->name()); |
| 962 } | 962 } |
| 963 return GetCode(CONSTANT_FUNCTION, function_name); | 963 return GetCode(CONSTANT_FUNCTION, function_name); |
| 964 } | 964 } |
| 965 | 965 |
| 966 | 966 |
| 967 Object* CallStubCompiler::CompileCallInterceptor(Object* object, | 967 Object* CallStubCompiler::CompileCallInterceptor(JSObject* object, |
| 968 JSObject* holder, | 968 JSObject* holder, |
| 969 String* name) { | 969 String* name) { |
| 970 // ----------- S t a t e ------------- | 970 // ----------- S t a t e ------------- |
| 971 // -- lr: return address | 971 // -- lr: return address |
| 972 // ----------------------------------- | 972 // ----------------------------------- |
| 973 ASSERT(holder->HasNamedInterceptor()); | 973 ASSERT(holder->HasNamedInterceptor()); |
| 974 ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined()); | 974 ASSERT(!holder->GetNamedInterceptor()->getter()->IsUndefined()); |
| 975 Label miss; | 975 Label miss; |
| 976 | 976 |
| 977 const Register receiver = r0; | 977 const Register receiver = r0; |
| 978 const Register name_reg = r1; | 978 const Register name_reg = r1; |
| 979 const Register holder_reg = r2; | 979 const Register holder_reg = r2; |
| 980 const Register scratch = r3; | 980 const Register scratch = r3; |
| 981 | 981 |
| 982 // Get the number of arguments. | 982 // Get the number of arguments. |
| 983 const int argc = arguments().immediate(); | 983 const int argc = arguments().immediate(); |
| 984 | 984 |
| 985 LookupResult lookup; | 985 LookupResult lookup; |
| 986 LookupPostInterceptor(holder, name, &lookup); | 986 LookupPostInterceptor(holder, name, &lookup); |
| 987 | 987 |
| 988 // Load the receiver from the stack. | 988 // Load the receiver from the stack. |
| 989 __ ldr(receiver, MemOperand(sp, argc * kPointerSize)); | 989 __ ldr(receiver, MemOperand(sp, argc * kPointerSize)); |
| 990 // Load the name from the stack. | 990 // Load the name from the stack. |
| 991 __ ldr(name_reg, MemOperand(sp, (argc + 1) * kPointerSize)); | 991 __ ldr(name_reg, MemOperand(sp, (argc + 1) * kPointerSize)); |
| 992 | 992 |
| 993 // Check that the receiver isn't a smi. | 993 // Check that the receiver isn't a smi. |
| 994 __ BranchOnSmi(receiver, &miss); | 994 __ BranchOnSmi(receiver, &miss); |
| 995 | 995 |
| 996 // Check that the maps haven't changed. | 996 // Check that the maps haven't changed. |
| 997 Register reg = | 997 Register reg = CheckPrototypes(object, receiver, holder, holder_reg, |
| 998 CheckPrototypes(JSObject::cast(object), receiver, holder, | 998 scratch, name, &miss); |
| 999 holder_reg, scratch, name, &miss); | |
| 1000 if (!reg.is(holder_reg)) { | 999 if (!reg.is(holder_reg)) { |
| 1001 __ mov(holder_reg, reg); | 1000 __ mov(holder_reg, reg); |
| 1002 } | 1001 } |
| 1003 | 1002 |
| 1004 // If we call a constant function when the interceptor returns | 1003 // If we call a constant function when the interceptor returns |
| 1005 // the no-result sentinel, generate code that optimizes this case. | 1004 // the no-result sentinel, generate code that optimizes this case. |
| 1006 if (lookup.IsValid() && | 1005 if (lookup.IsValid() && |
| 1007 lookup.IsCacheable() && | 1006 lookup.IsCacheable() && |
| 1008 lookup.type() == CONSTANT_FUNCTION && | 1007 lookup.type() == CONSTANT_FUNCTION && |
| 1009 lookup.GetConstantFunction()->is_compiled() && | 1008 lookup.GetConstantFunction()->is_compiled() && |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1821 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1823 | 1822 |
| 1824 // Return the generated code. | 1823 // Return the generated code. |
| 1825 return GetCode(); | 1824 return GetCode(); |
| 1826 } | 1825 } |
| 1827 | 1826 |
| 1828 | 1827 |
| 1829 #undef __ | 1828 #undef __ |
| 1830 | 1829 |
| 1831 } } // namespace v8::internal | 1830 } } // namespace v8::internal |
| OLD | NEW |