| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 ASSERT(object == holder); | 641 ASSERT(object == holder); |
| 642 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 642 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
| 643 if (object->IsJSGlobalProxy()) { | 643 if (object->IsJSGlobalProxy()) { |
| 644 CheckAccessGlobalProxy(reg, scratch, miss); | 644 CheckAccessGlobalProxy(reg, scratch, miss); |
| 645 } | 645 } |
| 646 return reg; | 646 return reg; |
| 647 } | 647 } |
| 648 | 648 |
| 649 | 649 |
| 650 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, | 650 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, |
| 651 Register scratch, | 651 Register scratch, |
| 652 Label* miss) { | 652 Label* miss) { |
| 653 Label same_contexts; | 653 Label same_contexts; |
| 654 | 654 |
| 655 ASSERT(!holder_reg.is(scratch)); | 655 ASSERT(!holder_reg.is(scratch)); |
| 656 ASSERT(!holder_reg.is(ip)); | 656 ASSERT(!holder_reg.is(ip)); |
| 657 ASSERT(!scratch.is(ip)); | 657 ASSERT(!scratch.is(ip)); |
| 658 | 658 |
| 659 // Load current lexical context from the stack frame. | 659 // Load current lexical context from the stack frame. |
| 660 ldr(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 660 ldr(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 661 // In debug mode, make sure the lexical context is set. | 661 // In debug mode, make sure the lexical context is set. |
| 662 if (kDebug) { | 662 if (kDebug) { |
| 663 cmp(scratch, Operand(0)); | 663 cmp(scratch, Operand(0)); |
| 664 Check(ne, "we should not have an empty lexical context"); | 664 Check(ne, "we should not have an empty lexical context"); |
| 665 } | 665 } |
| 666 | 666 |
| 667 // Load the global context of the current context. | 667 // Load the global context of the current context. |
| 668 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 668 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
| 669 ldr(scratch, FieldMemOperand(scratch, offset)); | 669 ldr(scratch, FieldMemOperand(scratch, offset)); |
| 670 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); | 670 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset)); |
| 671 | 671 |
| 672 // Check the context is a global context. | 672 // Check the context is a global context. |
| 673 if (FLAG_debug_code) { | 673 if (FLAG_debug_code) { |
| 674 // TODO(119): avoid push(holder_reg)/pop(holder_reg) |
| 675 // Cannot use ip as a temporary in this verification code. Due to the fact |
| 676 // that ip is clobbered as part of cmp with an object Operand. |
| 677 push(holder_reg); // Temporarily save holder on the stack. |
| 674 // Read the first word and compare to the global_context_map. | 678 // Read the first word and compare to the global_context_map. |
| 675 ldr(ip, FieldMemOperand(scratch, HeapObject::kMapOffset)); | 679 ldr(holder_reg, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
| 676 cmp(ip, Operand(Factory::global_context_map())); | 680 cmp(holder_reg, Operand(Factory::global_context_map())); |
| 677 Check(eq, "JSGlobalObject::global_context should be a global context."); | 681 Check(eq, "JSGlobalObject::global_context should be a global context."); |
| 682 pop(holder_reg); // Restore holder. |
| 678 } | 683 } |
| 679 | 684 |
| 680 // Check if both contexts are the same. | 685 // Check if both contexts are the same. |
| 681 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 686 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 682 cmp(scratch, Operand(ip)); | 687 cmp(scratch, Operand(ip)); |
| 683 b(eq, &same_contexts); | 688 b(eq, &same_contexts); |
| 684 | 689 |
| 685 // Check the context is a global context. | 690 // Check the context is a global context. |
| 686 if (FLAG_debug_code) { | 691 if (FLAG_debug_code) { |
| 687 cmp(ip, Operand(Factory::null_value())); | 692 // TODO(119): avoid push(holder_reg)/pop(holder_reg) |
| 693 // Cannot use ip as a temporary in this verification code. Due to the fact |
| 694 // that ip is clobbered as part of cmp with an object Operand. |
| 695 push(holder_reg); // Temporarily save holder on the stack. |
| 696 mov(holder_reg, ip); // Move ip to its holding place. |
| 697 cmp(holder_reg, Operand(Factory::null_value())); |
| 688 Check(ne, "JSGlobalProxy::context() should not be null."); | 698 Check(ne, "JSGlobalProxy::context() should not be null."); |
| 689 | 699 |
| 690 ldr(ip, FieldMemOperand(ip, HeapObject::kMapOffset)); | 700 ldr(holder_reg, FieldMemOperand(holder_reg, HeapObject::kMapOffset)); |
| 691 cmp(ip, Operand(Factory::global_context_map())); | 701 cmp(holder_reg, Operand(Factory::global_context_map())); |
| 692 Check(eq, "JSGlobalObject::global_context should be a global context."); | 702 Check(eq, "JSGlobalObject::global_context should be a global context."); |
| 703 // Restore ip is not needed. ip is reloaded below. |
| 704 pop(holder_reg); // Restore holder. |
| 693 // Restore ip to holder's context. | 705 // Restore ip to holder's context. |
| 694 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); | 706 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset)); |
| 695 } | 707 } |
| 696 | 708 |
| 697 // Check that the security token in the calling global object is | 709 // Check that the security token in the calling global object is |
| 698 // compatible with the security token in the receiving global | 710 // compatible with the security token in the receiving global |
| 699 // object. | 711 // object. |
| 700 int token_offset = Context::kHeaderSize + | 712 int token_offset = Context::kHeaderSize + |
| 701 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 713 Context::SECURITY_TOKEN_INDEX * kPointerSize; |
| 702 | 714 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 #endif | 874 #endif |
| 863 mov(r0, Operand(p0)); | 875 mov(r0, Operand(p0)); |
| 864 push(r0); | 876 push(r0); |
| 865 mov(r0, Operand(Smi::FromInt(p1 - p0))); | 877 mov(r0, Operand(Smi::FromInt(p1 - p0))); |
| 866 push(r0); | 878 push(r0); |
| 867 CallRuntime(Runtime::kAbort, 2); | 879 CallRuntime(Runtime::kAbort, 2); |
| 868 // will not return here | 880 // will not return here |
| 869 } | 881 } |
| 870 | 882 |
| 871 } } // namespace v8::internal | 883 } } // namespace v8::internal |
| OLD | NEW |