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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 } | 1147 } |
1148 | 1148 |
1149 // Check that the maps haven't changed. | 1149 // Check that the maps haven't changed. |
1150 CheckPrototypes(object, edx, holder, ebx, ecx, name, &miss); | 1150 CheckPrototypes(object, edx, holder, ebx, ecx, name, &miss); |
1151 | 1151 |
1152 // Get the value from the cell. | 1152 // Get the value from the cell. |
1153 __ mov(edi, Immediate(Handle<JSGlobalPropertyCell>(cell))); | 1153 __ mov(edi, Immediate(Handle<JSGlobalPropertyCell>(cell))); |
1154 __ mov(edi, FieldOperand(edi, JSGlobalPropertyCell::kValueOffset)); | 1154 __ mov(edi, FieldOperand(edi, JSGlobalPropertyCell::kValueOffset)); |
1155 | 1155 |
1156 // Check that the cell contains the same function. | 1156 // Check that the cell contains the same function. |
1157 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); | 1157 if (Heap::InNewSpace(function)) { |
1158 __ j(not_equal, &miss, not_taken); | 1158 // We can't embed a pointer to a function in new space so we have |
| 1159 // to verify that the shared function info is unchanged. This has |
| 1160 // the nice side effect that multiple closures based on the same |
| 1161 // function can all use this call IC. Before we load through the |
| 1162 // function, we have to verify that it still is a function. |
| 1163 __ test(edi, Immediate(kSmiTagMask)); |
| 1164 __ j(zero, &miss, not_taken); |
| 1165 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ebx); |
| 1166 __ j(not_equal, &miss, not_taken); |
| 1167 |
| 1168 // Check the shared function info. Make sure it hasn't changed. |
| 1169 __ cmp(FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset), |
| 1170 Immediate(Handle<SharedFunctionInfo>(function->shared()))); |
| 1171 __ j(not_equal, &miss, not_taken); |
| 1172 } else { |
| 1173 __ cmp(Operand(edi), Immediate(Handle<JSFunction>(function))); |
| 1174 __ j(not_equal, &miss, not_taken); |
| 1175 } |
1159 | 1176 |
1160 // Patch the receiver on the stack with the global proxy. | 1177 // Patch the receiver on the stack with the global proxy. |
1161 if (object->IsGlobalObject()) { | 1178 if (object->IsGlobalObject()) { |
1162 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 1179 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
1163 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); | 1180 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); |
1164 } | 1181 } |
1165 | 1182 |
1166 // Setup the context (function already in edi). | 1183 // Setup the context (function already in edi). |
1167 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 1184 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
1168 | 1185 |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); | 1915 __ jmp(generic_construct_stub, RelocInfo::CODE_TARGET); |
1899 | 1916 |
1900 // Return the generated code. | 1917 // Return the generated code. |
1901 return GetCode(); | 1918 return GetCode(); |
1902 } | 1919 } |
1903 | 1920 |
1904 | 1921 |
1905 #undef __ | 1922 #undef __ |
1906 | 1923 |
1907 } } // namespace v8::internal | 1924 } } // namespace v8::internal |
OLD | NEW |