| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 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 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 } | 949 } |
| 950 | 950 |
| 951 // Check that the maps haven't changed. | 951 // Check that the maps haven't changed. |
| 952 CheckPrototypes(object, rdx, holder, rbx, rcx, name, &miss); | 952 CheckPrototypes(object, rdx, holder, rbx, rcx, name, &miss); |
| 953 | 953 |
| 954 // Get the value from the cell. | 954 // Get the value from the cell. |
| 955 __ Move(rdi, Handle<JSGlobalPropertyCell>(cell)); | 955 __ Move(rdi, Handle<JSGlobalPropertyCell>(cell)); |
| 956 __ movq(rdi, FieldOperand(rdi, JSGlobalPropertyCell::kValueOffset)); | 956 __ movq(rdi, FieldOperand(rdi, JSGlobalPropertyCell::kValueOffset)); |
| 957 | 957 |
| 958 // Check that the cell contains the same function. | 958 // Check that the cell contains the same function. |
| 959 __ Cmp(rdi, Handle<JSFunction>(function)); | 959 if (Heap::InNewSpace(function)) { |
| 960 __ j(not_equal, &miss); | 960 // We can't embed a pointer to a function in new space so we have |
| 961 // to verify that the shared function info is unchanged. This has |
| 962 // the nice side effect that multiple closures based on the same |
| 963 // function can all use this call IC. Before we load through the |
| 964 // function, we have to verify that it still is a function. |
| 965 __ JumpIfSmi(rdi, &miss); |
| 966 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
| 967 __ j(not_equal, &miss); |
| 968 |
| 969 // Check the shared function info. Make sure it hasn't changed. |
| 970 __ Move(rcx, Handle<SharedFunctionInfo>(function->shared())); |
| 971 __ cmpq(FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset), rcx); |
| 972 __ j(not_equal, &miss); |
| 973 } else { |
| 974 __ Cmp(rdi, Handle<JSFunction>(function)); |
| 975 __ j(not_equal, &miss); |
| 976 } |
| 961 | 977 |
| 962 // Patch the receiver on the stack with the global proxy. | 978 // Patch the receiver on the stack with the global proxy. |
| 963 if (object->IsGlobalObject()) { | 979 if (object->IsGlobalObject()) { |
| 964 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); | 980 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); |
| 965 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); | 981 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); |
| 966 } | 982 } |
| 967 | 983 |
| 968 // Setup the context (function already in edi). | 984 // Setup the context (function already in edi). |
| 969 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); | 985 __ movq(rsi, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 970 | 986 |
| (...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1861 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1877 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
| 1862 | 1878 |
| 1863 // Return the generated code. | 1879 // Return the generated code. |
| 1864 return GetCode(); | 1880 return GetCode(); |
| 1865 } | 1881 } |
| 1866 | 1882 |
| 1867 | 1883 |
| 1868 #undef __ | 1884 #undef __ |
| 1869 | 1885 |
| 1870 } } // namespace v8::internal | 1886 } } // namespace v8::internal |
| OLD | NEW |