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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 } | 770 } |
771 | 771 |
772 // Check that the maps haven't changed. | 772 // Check that the maps haven't changed. |
773 CheckPrototypes(object, r0, holder, r3, r2, name, &miss); | 773 CheckPrototypes(object, r0, holder, r3, r2, name, &miss); |
774 | 774 |
775 // Get the value from the cell. | 775 // Get the value from the cell. |
776 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell))); | 776 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell))); |
777 __ ldr(r1, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset)); | 777 __ ldr(r1, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset)); |
778 | 778 |
779 // Check that the cell contains the same function. | 779 // Check that the cell contains the same function. |
780 __ cmp(r1, Operand(Handle<JSFunction>(function))); | 780 if (Heap::InNewSpace(function)) { |
781 __ b(ne, &miss); | 781 // We can't embed a pointer to a function in new space so we have |
| 782 // to verify that the shared function info is unchanged. This has |
| 783 // the nice side effect that multiple closures based on the same |
| 784 // function can all use this call IC. Before we load through the |
| 785 // function, we have to verify that it still is a function. |
| 786 __ tst(r1, Operand(kSmiTagMask)); |
| 787 __ b(eq, &miss); |
| 788 __ CompareObjectType(r1, r3, r3, JS_FUNCTION_TYPE); |
| 789 __ b(ne, &miss); |
| 790 |
| 791 // Check the shared function info. Make sure it hasn't changed. |
| 792 __ mov(r3, Operand(Handle<SharedFunctionInfo>(function->shared()))); |
| 793 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 794 __ cmp(r2, r3); |
| 795 __ b(ne, &miss); |
| 796 } else { |
| 797 __ cmp(r1, Operand(Handle<JSFunction>(function))); |
| 798 __ b(ne, &miss); |
| 799 } |
782 | 800 |
783 // Patch the receiver on the stack with the global proxy if | 801 // Patch the receiver on the stack with the global proxy if |
784 // necessary. | 802 // necessary. |
785 if (object->IsGlobalObject()) { | 803 if (object->IsGlobalObject()) { |
786 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); | 804 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
787 __ str(r3, MemOperand(sp, argc * kPointerSize)); | 805 __ str(r3, MemOperand(sp, argc * kPointerSize)); |
788 } | 806 } |
789 | 807 |
790 // Setup the context (function already in r1). | 808 // Setup the context (function already in r1). |
791 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 809 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1489 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1507 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
1490 | 1508 |
1491 // Return the generated code. | 1509 // Return the generated code. |
1492 return GetCode(); | 1510 return GetCode(); |
1493 } | 1511 } |
1494 | 1512 |
1495 | 1513 |
1496 #undef __ | 1514 #undef __ |
1497 | 1515 |
1498 } } // namespace v8::internal | 1516 } } // namespace v8::internal |
OLD | NEW |