| 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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 pop(r1); | 714 pop(r1); |
| 715 mov(ip, Operand(ExternalReference(Top::k_handler_address))); | 715 mov(ip, Operand(ExternalReference(Top::k_handler_address))); |
| 716 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); | 716 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); |
| 717 str(r1, MemOperand(ip)); | 717 str(r1, MemOperand(ip)); |
| 718 } | 718 } |
| 719 | 719 |
| 720 | 720 |
| 721 Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, | 721 Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, |
| 722 JSObject* holder, Register holder_reg, | 722 JSObject* holder, Register holder_reg, |
| 723 Register scratch, | 723 Register scratch, |
| 724 int save_at_depth, |
| 724 Label* miss) { | 725 Label* miss) { |
| 725 // Make sure there's no overlap between scratch and the other | 726 // Make sure there's no overlap between scratch and the other |
| 726 // registers. | 727 // registers. |
| 727 ASSERT(!scratch.is(object_reg) && !scratch.is(holder_reg)); | 728 ASSERT(!scratch.is(object_reg) && !scratch.is(holder_reg)); |
| 728 | 729 |
| 729 // Keep track of the current object in register reg. | 730 // Keep track of the current object in register reg. |
| 730 Register reg = object_reg; | 731 Register reg = object_reg; |
| 731 int depth = 1; | 732 int depth = 0; |
| 733 |
| 734 if (save_at_depth == depth) { |
| 735 str(reg, MemOperand(sp)); |
| 736 } |
| 732 | 737 |
| 733 // Check the maps in the prototype chain. | 738 // Check the maps in the prototype chain. |
| 734 // Traverse the prototype chain from the object and do map checks. | 739 // Traverse the prototype chain from the object and do map checks. |
| 735 while (object != holder) { | 740 while (object != holder) { |
| 736 depth++; | 741 depth++; |
| 737 | 742 |
| 738 // Only global objects and objects that do not require access | 743 // Only global objects and objects that do not require access |
| 739 // checks are allowed in stubs. | 744 // checks are allowed in stubs. |
| 740 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 745 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 741 | 746 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 761 JSObject* prototype = JSObject::cast(object->GetPrototype()); | 766 JSObject* prototype = JSObject::cast(object->GetPrototype()); |
| 762 if (Heap::InNewSpace(prototype)) { | 767 if (Heap::InNewSpace(prototype)) { |
| 763 // The prototype is in new space; we cannot store a reference | 768 // The prototype is in new space; we cannot store a reference |
| 764 // to it in the code. Load it from the map. | 769 // to it in the code. Load it from the map. |
| 765 ldr(reg, FieldMemOperand(scratch, Map::kPrototypeOffset)); | 770 ldr(reg, FieldMemOperand(scratch, Map::kPrototypeOffset)); |
| 766 } else { | 771 } else { |
| 767 // The prototype is in old space; load it directly. | 772 // The prototype is in old space; load it directly. |
| 768 mov(reg, Operand(Handle<JSObject>(prototype))); | 773 mov(reg, Operand(Handle<JSObject>(prototype))); |
| 769 } | 774 } |
| 770 | 775 |
| 776 if (save_at_depth == depth) { |
| 777 str(reg, MemOperand(sp)); |
| 778 } |
| 779 |
| 771 // Go to the next object in the prototype chain. | 780 // Go to the next object in the prototype chain. |
| 772 object = prototype; | 781 object = prototype; |
| 773 } | 782 } |
| 774 | 783 |
| 775 // Check the holder map. | 784 // Check the holder map. |
| 776 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); | 785 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); |
| 777 cmp(scratch, Operand(Handle<Map>(object->map()))); | 786 cmp(scratch, Operand(Handle<Map>(object->map()))); |
| 778 b(ne, miss); | 787 b(ne, miss); |
| 779 | 788 |
| 780 // Log the check depth. | 789 // Log the check depth. |
| 781 LOG(IntEvent("check-maps-depth", depth)); | 790 LOG(IntEvent("check-maps-depth", depth + 1)); |
| 782 | 791 |
| 783 // Perform security check for access to the global object and return | 792 // Perform security check for access to the global object and return |
| 784 // the holder register. | 793 // the holder register. |
| 785 ASSERT(object == holder); | 794 ASSERT(object == holder); |
| 786 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 795 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 787 if (object->IsJSGlobalProxy()) { | 796 if (object->IsJSGlobalProxy()) { |
| 788 CheckAccessGlobalProxy(reg, scratch, miss); | 797 CheckAccessGlobalProxy(reg, scratch, miss); |
| 789 } | 798 } |
| 790 return reg; | 799 return reg; |
| 791 } | 800 } |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 } | 1669 } |
| 1661 | 1670 |
| 1662 | 1671 |
| 1663 void CodePatcher::Emit(Address addr) { | 1672 void CodePatcher::Emit(Address addr) { |
| 1664 masm()->emit(reinterpret_cast<Instr>(addr)); | 1673 masm()->emit(reinterpret_cast<Instr>(addr)); |
| 1665 } | 1674 } |
| 1666 #endif // ENABLE_DEBUGGER_SUPPORT | 1675 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1667 | 1676 |
| 1668 | 1677 |
| 1669 } } // namespace v8::internal | 1678 } } // namespace v8::internal |
| OLD | NEW |