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

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

Issue 119353: Add instanceof stub for ARM. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 6 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/arm/macro-assembler-arm.h ('k') | src/arm/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-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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 736
737 ldr(scratch, FieldMemOperand(scratch, token_offset)); 737 ldr(scratch, FieldMemOperand(scratch, token_offset));
738 ldr(ip, FieldMemOperand(ip, token_offset)); 738 ldr(ip, FieldMemOperand(ip, token_offset));
739 cmp(scratch, Operand(ip)); 739 cmp(scratch, Operand(ip));
740 b(ne, miss); 740 b(ne, miss);
741 741
742 bind(&same_contexts); 742 bind(&same_contexts);
743 } 743 }
744 744
745 745
746 void MacroAssembler::CompareObjectType(Register function,
747 Register map,
748 Register type_reg,
749 InstanceType type) {
750 ldr(map, FieldMemOperand(function, HeapObject::kMapOffset));
751 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset));
752 cmp(type_reg, Operand(type));
753 }
754
755
756 void MacroAssembler::TryGetFunctionPrototype(Register function,
757 Register result,
758 Register scratch,
759 Label* miss) {
760 // Check that the receiver isn't a smi.
761 BranchOnSmi(function, miss);
762
763 // Check that the function really is a function. Load map into result reg.
764 CompareObjectType(function, result, scratch, JS_FUNCTION_TYPE);
765 b(ne, miss);
766
767 // Make sure that the function has an instance prototype.
768 Label non_instance;
769 ldrb(scratch, FieldMemOperand(result, Map::kBitFieldOffset));
770 tst(scratch, Operand(1 << Map::kHasNonInstancePrototype));
771 b(ne, &non_instance);
772
773 // Get the prototype or initial map from the function.
774 ldr(result,
775 FieldMemOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
776
777 // If the prototype or initial map is the hole, don't return it and
778 // simply miss the cache instead. This will allow us to allocate a
779 // prototype object on-demand in the runtime system.
780 cmp(result, Operand(Factory::the_hole_value()));
781 b(eq, miss);
782
783 // If the function does not have an initial map, we're done.
784 Label done;
785 CompareObjectType(result, scratch, scratch, MAP_TYPE);
786 b(ne, &done);
787
788 // Get the prototype from the initial map.
789 ldr(result, FieldMemOperand(result, Map::kPrototypeOffset));
790 jmp(&done);
791
792 // Non-instance prototype: Fetch prototype from constructor field
793 // in initial map.
794 bind(&non_instance);
795 ldr(result, FieldMemOperand(result, Map::kConstructorOffset));
796
797 // All done.
798 bind(&done);
799 }
800
801
746 void MacroAssembler::CallStub(CodeStub* stub) { 802 void MacroAssembler::CallStub(CodeStub* stub) {
747 ASSERT(allow_stub_calls()); // stub calls are not allowed in some stubs 803 ASSERT(allow_stub_calls()); // stub calls are not allowed in some stubs
748 Call(stub->GetCode(), RelocInfo::CODE_TARGET); 804 Call(stub->GetCode(), RelocInfo::CODE_TARGET);
749 } 805 }
750 806
751 807
752 void MacroAssembler::StubReturn(int argc) { 808 void MacroAssembler::StubReturn(int argc) {
753 ASSERT(argc >= 1 && generating_stub()); 809 ASSERT(argc >= 1 && generating_stub());
754 if (argc > 1) 810 if (argc > 1)
755 add(sp, sp, Operand((argc - 1) * kPointerSize)); 811 add(sp, sp, Operand((argc - 1) * kPointerSize));
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 #endif 990 #endif
935 mov(r0, Operand(p0)); 991 mov(r0, Operand(p0));
936 push(r0); 992 push(r0);
937 mov(r0, Operand(Smi::FromInt(p1 - p0))); 993 mov(r0, Operand(Smi::FromInt(p1 - p0)));
938 push(r0); 994 push(r0);
939 CallRuntime(Runtime::kAbort, 2); 995 CallRuntime(Runtime::kAbort, 2);
940 // will not return here 996 // will not return here
941 } 997 }
942 998
943 } } // namespace v8::internal 999 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698