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

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 151019: Changed the global object representation (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 5 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
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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 641
642 default: 642 default:
643 UNREACHABLE(); 643 UNREACHABLE();
644 } 644 }
645 645
646 // Get the function and setup the context. 646 // Get the function and setup the context.
647 __ mov(r1, Operand(Handle<JSFunction>(function))); 647 __ mov(r1, Operand(Handle<JSFunction>(function)));
648 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); 648 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
649 649
650 // Jump to the cached code (tail call). 650 // Jump to the cached code (tail call).
651 ASSERT(function->is_compiled());
651 Handle<Code> code(function->code()); 652 Handle<Code> code(function->code());
652 ParameterCount expected(function->shared()->formal_parameter_count()); 653 ParameterCount expected(function->shared()->formal_parameter_count());
653 __ InvokeCode(code, expected, arguments(), 654 __ InvokeCode(code, expected, arguments(),
654 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 655 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
655 656
656 // Handle call cache miss. 657 // Handle call cache miss.
657 __ bind(&miss); 658 __ bind(&miss);
658 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 659 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
659 __ Jump(ic, RelocInfo::CODE_TARGET); 660 __ Jump(ic, RelocInfo::CODE_TARGET);
660 661
(...skipping 19 matching lines...) Expand all
680 // Handle call cache miss. 681 // Handle call cache miss.
681 __ bind(&miss); 682 __ bind(&miss);
682 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 683 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
683 __ Jump(ic, RelocInfo::CODE_TARGET); 684 __ Jump(ic, RelocInfo::CODE_TARGET);
684 685
685 // Return the generated code. 686 // Return the generated code.
686 return GetCode(INTERCEPTOR, name); 687 return GetCode(INTERCEPTOR, name);
687 } 688 }
688 689
689 690
691 Object* CallStubCompiler::CompileCallGlobal(JSGlobalObject* object,
692 JSGlobalPropertyCell* cell,
693 JSFunction* function,
694 String* name) {
695 // ----------- S t a t e -------------
696 // -- lr: return address
697 // -----------------------------------
698 Label miss;
699
700 __ IncrementCounter(&Counters::call_global_inline, 1, r1, r3);
701
702 // Get the number of arguments.
703 const int argc = arguments().immediate();
704
705 // Check that the map of the global has not changed.
706 __ ldr(r2, MemOperand(sp, argc * kPointerSize));
707 __ ldr(r3, FieldMemOperand(r2, HeapObject::kMapOffset));
708 __ cmp(r3, Operand(Handle<Map>(object->map())));
709 __ b(ne, &miss);
710
711 // Get the value from the cell.
712 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell)));
713 __ ldr(r1, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset));
714
715 // Check that the cell contains the same function.
716 __ cmp(r1, Operand(Handle<JSFunction>(function)));
717 __ b(ne, &miss);
718
719 // Patch the receiver on the stack with the global proxy if
720 // necessary.
721 __ ldr(r3, FieldMemOperand(r2, GlobalObject::kGlobalReceiverOffset));
722 __ str(r3, MemOperand(sp, argc * kPointerSize));
723
724 // Setup the context (function already in r1).
725 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
726
727 // Jump to the cached code (tail call).
728 ASSERT(function->is_compiled());
729 Handle<Code> code(function->code());
730 ParameterCount expected(function->shared()->formal_parameter_count());
731 __ InvokeCode(code, expected, arguments(),
732 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
733
734 // Handle call cache miss.
735 __ bind(&miss);
736 __ DecrementCounter(&Counters::call_global_inline, 1, r1, r3);
737 __ IncrementCounter(&Counters::call_global_inline_miss, 1, r1, r3);
738 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
739 __ Jump(ic, RelocInfo::CODE_TARGET);
740
741 // Return the generated code.
742 return GetCode(NORMAL, name);
743 }
744
745
690 Object* StoreStubCompiler::CompileStoreField(JSObject* object, 746 Object* StoreStubCompiler::CompileStoreField(JSObject* object,
691 int index, 747 int index,
692 Map* transition, 748 Map* transition,
693 String* name) { 749 String* name) {
694 // ----------- S t a t e ------------- 750 // ----------- S t a t e -------------
695 // -- r0 : value 751 // -- r0 : value
696 // -- r2 : name 752 // -- r2 : name
697 // -- lr : return address 753 // -- lr : return address
698 // -- [sp] : receiver 754 // -- [sp] : receiver
699 // ----------------------------------- 755 // -----------------------------------
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 __ bind(&miss); 876 __ bind(&miss);
821 __ mov(r2, Operand(Handle<String>(name))); // restore name 877 __ mov(r2, Operand(Handle<String>(name))); // restore name
822 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 878 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
823 __ Jump(ic, RelocInfo::CODE_TARGET); 879 __ Jump(ic, RelocInfo::CODE_TARGET);
824 880
825 // Return the generated code. 881 // Return the generated code.
826 return GetCode(INTERCEPTOR, name); 882 return GetCode(INTERCEPTOR, name);
827 } 883 }
828 884
829 885
886 Object* StoreStubCompiler::CompileStoreGlobal(JSGlobalObject* object,
887 JSGlobalPropertyCell* cell,
888 String* name) {
889 // ----------- S t a t e -------------
890 // -- r0 : value
891 // -- r2 : name
892 // -- lr : return address
893 // -- [sp] : receiver
894 // -----------------------------------
895 Label miss;
896
897 __ IncrementCounter(&Counters::named_store_global_inline, 1, r1, r3);
898
899 // Check that the map of the global has not changed.
900 __ ldr(r1, MemOperand(sp, 0 * kPointerSize));
901 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
902 __ cmp(r3, Operand(Handle<Map>(object->map())));
903 __ b(ne, &miss);
904
905 // Store the value in the cell.
906 __ mov(r2, Operand(Handle<JSGlobalPropertyCell>(cell)));
907 __ str(r0, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset));
908 __ mov(r1, Operand(JSGlobalPropertyCell::kValueOffset));
909 __ RecordWrite(r2, r1, r3);
910
911 __ Ret();
912
913 // Handle store cache miss.
914 __ bind(&miss);
915 __ DecrementCounter(&Counters::named_store_global_inline, 1, r1, r3);
916 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1, r1, r3);
917 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
918 __ Jump(ic, RelocInfo::CODE_TARGET);
919
920 // Return the generated code.
921 return GetCode(NORMAL, name);
922 }
923
924
830 Object* LoadStubCompiler::CompileLoadField(JSObject* object, 925 Object* LoadStubCompiler::CompileLoadField(JSObject* object,
831 JSObject* holder, 926 JSObject* holder,
832 int index, 927 int index,
833 String* name) { 928 String* name) {
834 // ----------- S t a t e ------------- 929 // ----------- S t a t e -------------
835 // -- r2 : name 930 // -- r2 : name
836 // -- lr : return address 931 // -- lr : return address
837 // -- [sp] : receiver 932 // -- [sp] : receiver
838 // ----------------------------------- 933 // -----------------------------------
839 Label miss; 934 Label miss;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 r1, 1009 r1,
915 &miss); 1010 &miss);
916 __ bind(&miss); 1011 __ bind(&miss);
917 GenerateLoadMiss(masm(), Code::LOAD_IC); 1012 GenerateLoadMiss(masm(), Code::LOAD_IC);
918 1013
919 // Return the generated code. 1014 // Return the generated code.
920 return GetCode(INTERCEPTOR, name); 1015 return GetCode(INTERCEPTOR, name);
921 } 1016 }
922 1017
923 1018
1019 Object* LoadStubCompiler::CompileLoadGlobal(JSGlobalObject* object,
1020 JSGlobalPropertyCell* cell,
1021 String* name) {
1022 // ----------- S t a t e -------------
1023 // -- r2 : name
1024 // -- lr : return address
1025 // -- [sp] : receiver
1026 // -----------------------------------
1027 Label miss;
1028
1029 __ IncrementCounter(&Counters::named_load_global_inline, 1, r1, r3);
1030
1031 // Check that the map of the global has not changed.
1032 __ ldr(r1, MemOperand(sp, 0 * kPointerSize));
1033 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
1034 __ cmp(r3, Operand(Handle<Map>(object->map())));
1035 __ b(ne, &miss);
1036
1037 // Get the value from the cell.
1038 __ mov(r3, Operand(Handle<JSGlobalPropertyCell>(cell)));
1039 __ ldr(r0, FieldMemOperand(r3, JSGlobalPropertyCell::kValueOffset));
1040
1041 // Check for deleted property.
1042 __ cmp(r0, Operand(Factory::the_hole_value()));
1043 __ b(eq, &miss);
1044
1045 __ Ret();
1046
1047 __ bind(&miss);
1048 __ DecrementCounter(&Counters::named_load_global_inline, 1, r1, r3);
1049 __ IncrementCounter(&Counters::named_load_global_inline_miss, 1, r1, r3);
1050 GenerateLoadMiss(masm(), Code::LOAD_IC);
1051
1052 // Return the generated code.
1053 return GetCode(NORMAL, name);
1054 }
1055
1056
924 // TODO(1224671): IC stubs for keyed loads have not been implemented 1057 // TODO(1224671): IC stubs for keyed loads have not been implemented
925 // for ARM. 1058 // for ARM.
926 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, 1059 Object* KeyedLoadStubCompiler::CompileLoadField(String* name,
927 JSObject* receiver, 1060 JSObject* receiver,
928 JSObject* holder, 1061 JSObject* holder,
929 int index) { 1062 int index) {
930 // ----------- S t a t e ------------- 1063 // ----------- S t a t e -------------
931 // -- lr : return address 1064 // -- lr : return address
932 // -- sp[0] : key 1065 // -- sp[0] : key
933 // -- sp[4] : receiver 1066 // -- sp[4] : receiver
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 __ Jump(ic, RelocInfo::CODE_TARGET); 1264 __ Jump(ic, RelocInfo::CODE_TARGET);
1132 1265
1133 // Return the generated code. 1266 // Return the generated code.
1134 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); 1267 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
1135 } 1268 }
1136 1269
1137 1270
1138 #undef __ 1271 #undef __
1139 1272
1140 } } // namespace v8::internal 1273 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/ic-arm.cc ('k') | src/bootstrapper.cc » ('j') | test/cctest/test-api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698