Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(908)

Side by Side Diff: src/macro-assembler-arm.cc

Issue 7420: No more failures than before. It is ready to be reviewed. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/macro-assembler-arm.h ('k') | src/stub-cache-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 Register reg = object_reg; 586 Register reg = object_reg;
587 int depth = 1; 587 int depth = 1;
588 588
589 // Check the maps in the prototype chain. 589 // Check the maps in the prototype chain.
590 // Traverse the prototype chain from the object and do map checks. 590 // Traverse the prototype chain from the object and do map checks.
591 while (object != holder) { 591 while (object != holder) {
592 depth++; 592 depth++;
593 593
594 // Only global objects and objects that do not require access 594 // Only global objects and objects that do not require access
595 // checks are allowed in stubs. 595 // checks are allowed in stubs.
596 ASSERT(object->IsJSGlobalObject() || !object->IsAccessCheckNeeded()); 596 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
597 597
598 // Get the map of the current object. 598 // Get the map of the current object.
599 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); 599 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
600 cmp(scratch, Operand(Handle<Map>(object->map()))); 600 cmp(scratch, Operand(Handle<Map>(object->map())));
601 601
602 // Branch on the result of the map check. 602 // Branch on the result of the map check.
603 b(ne, miss); 603 b(ne, miss);
604 604
605 // Check access rights to the global object. This has to happen 605 // Check access rights to the global object. This has to happen
606 // after the map check so that we know that the object is 606 // after the map check so that we know that the object is
607 // actually a global object. 607 // actually a global object.
608 if (object->IsJSGlobalObject()) { 608 if (object->IsJSGlobalProxy()) {
609 CheckAccessGlobal(reg, scratch, miss); 609 CheckAccessGlobalProxy(reg, scratch, miss);
610 // Restore scratch register to be the map of the object. In the 610 // Restore scratch register to be the map of the object. In the
611 // new space case below, we load the prototype from the map in 611 // new space case below, we load the prototype from the map in
612 // the scratch register. 612 // the scratch register.
613 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); 613 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
614 } 614 }
615 615
616 reg = holder_reg; // from now the object is in holder_reg 616 reg = holder_reg; // from now the object is in holder_reg
617 JSObject* prototype = JSObject::cast(object->GetPrototype()); 617 JSObject* prototype = JSObject::cast(object->GetPrototype());
618 if (Heap::InNewSpace(prototype)) { 618 if (Heap::InNewSpace(prototype)) {
619 // The prototype is in new space; we cannot store a reference 619 // The prototype is in new space; we cannot store a reference
(...skipping 12 matching lines...) Expand all
632 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); 632 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
633 cmp(scratch, Operand(Handle<Map>(object->map()))); 633 cmp(scratch, Operand(Handle<Map>(object->map())));
634 b(ne, miss); 634 b(ne, miss);
635 635
636 // Log the check depth. 636 // Log the check depth.
637 LOG(IntEvent("check-maps-depth", depth)); 637 LOG(IntEvent("check-maps-depth", depth));
638 638
639 // Perform security check for access to the global object and return 639 // Perform security check for access to the global object and return
640 // the holder register. 640 // the holder register.
641 ASSERT(object == holder); 641 ASSERT(object == holder);
642 ASSERT(object->IsJSGlobalObject() || !object->IsAccessCheckNeeded()); 642 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
643 if (object->IsJSGlobalObject()) { 643 if (object->IsJSGlobalProxy()) {
644 CheckAccessGlobal(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::CheckAccessGlobal(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;
654
653 ASSERT(!holder_reg.is(scratch)); 655 ASSERT(!holder_reg.is(scratch));
656 ASSERT(!holder_reg.is(ip));
657 ASSERT(!scratch.is(ip));
654 658
655 // Load the security context. 659 // Load current lexical context from the stack frame.
656 mov(scratch, Operand(Top::security_context_address())); 660 ldr(scratch, MemOperand(fp, StandardFrameConstants::kContextOffset));
657 ldr(scratch, MemOperand(scratch)); 661 // In debug mode, make sure the lexical context is set.
658 // In debug mode, make sure the security context is set.
659 if (kDebug) { 662 if (kDebug) {
660 cmp(scratch, Operand(0)); 663 cmp(scratch, Operand(0));
661 Check(ne, "we should not have an empty security context"); 664 Check(ne, "we should not have an empty lexical context");
662 } 665 }
663 666
664 // Load the global object of the security context. 667 // Load the global context of the current context.
665 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; 668 int offset = Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize;
666 ldr(scratch, FieldMemOperand(scratch, offset)); 669 ldr(scratch, FieldMemOperand(scratch, offset));
670 ldr(scratch, FieldMemOperand(scratch, GlobalObject::kGlobalContextOffset));
671
672 // Check the context is a global context.
673 if (FLAG_debug_code) {
674 // Read the first word and compare to the global_context_map.
675 ldr(ip, FieldMemOperand(scratch, HeapObject::kMapOffset));
676 cmp(ip, Operand(Factory::global_context_map()));
677 Check(eq, "JSGlobalObject::global_context should be a global context.");
678 }
679
680 // Check if both contexts are the same.
681 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset));
682 cmp(scratch, Operand(ip));
683 b(eq, &same_contexts);
684
685 // Check the context is a global context.
686 if (FLAG_debug_code) {
687 cmp(ip, Operand(Factory::null_value()));
688 Check(ne, "JSGlobalProxy::context() should not be null.");
689
690 ldr(ip, FieldMemOperand(ip, HeapObject::kMapOffset));
691 cmp(ip, Operand(Factory::global_context_map()));
692 Check(eq, "JSGlobalObject::global_context should be a global context.");
693 // Restore ip to holder's context.
694 ldr(ip, FieldMemOperand(holder_reg, JSGlobalProxy::kContextOffset));
695 }
696
667 // Check that the security token in the calling global object is 697 // Check that the security token in the calling global object is
668 // compatible with the security token in the receiving global 698 // compatible with the security token in the receiving global
669 // object. 699 // object.
670 ldr(scratch, FieldMemOperand(scratch, JSGlobalObject::kSecurityTokenOffset)); 700 int token_offset = Context::kHeaderSize +
671 ldr(ip, FieldMemOperand(holder_reg, JSGlobalObject::kSecurityTokenOffset)); 701 Context::SECURITY_TOKEN_INDEX * kPointerSize;
702
703 ldr(scratch, FieldMemOperand(scratch, token_offset));
704 ldr(ip, FieldMemOperand(ip, token_offset));
672 cmp(scratch, Operand(ip)); 705 cmp(scratch, Operand(ip));
673 b(ne, miss); 706 b(ne, miss);
707
708 bind(&same_contexts);
674 } 709 }
675 710
676 711
677 void MacroAssembler::CallStub(CodeStub* stub) { 712 void MacroAssembler::CallStub(CodeStub* stub) {
678 ASSERT(allow_stub_calls()); // stub calls are not allowed in some stubs 713 ASSERT(allow_stub_calls()); // stub calls are not allowed in some stubs
679 Call(stub->GetCode(), RelocInfo::CODE_TARGET); 714 Call(stub->GetCode(), RelocInfo::CODE_TARGET);
680 } 715 }
681 716
682 717
683 void MacroAssembler::StubReturn(int argc) { 718 void MacroAssembler::StubReturn(int argc) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 #endif 862 #endif
828 mov(r0, Operand(p0)); 863 mov(r0, Operand(p0));
829 push(r0); 864 push(r0);
830 mov(r0, Operand(Smi::FromInt(p1 - p0))); 865 mov(r0, Operand(Smi::FromInt(p1 - p0)));
831 push(r0); 866 push(r0);
832 CallRuntime(Runtime::kAbort, 2); 867 CallRuntime(Runtime::kAbort, 2);
833 // will not return here 868 // will not return here
834 } 869 }
835 870
836 } } // namespace v8::internal 871 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/macro-assembler-arm.h ('k') | src/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698