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

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

Issue 160265: Change the updating of the counters for global stub use (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/stub-cache-arm.cc ('k') | src/x64/stub-cache-x64.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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 793
794 Object* CallStubCompiler::CompileCallGlobal(JSObject* object, 794 Object* CallStubCompiler::CompileCallGlobal(JSObject* object,
795 GlobalObject* holder, 795 GlobalObject* holder,
796 JSGlobalPropertyCell* cell, 796 JSGlobalPropertyCell* cell,
797 JSFunction* function, 797 JSFunction* function,
798 String* name) { 798 String* name) {
799 // ----------- S t a t e ------------- 799 // ----------- S t a t e -------------
800 // ----------------------------------- 800 // -----------------------------------
801 Label miss; 801 Label miss;
802 802
803 __ IncrementCounter(&Counters::call_global_inline, 1);
804
805 // Get the number of arguments. 803 // Get the number of arguments.
806 const int argc = arguments().immediate(); 804 const int argc = arguments().immediate();
807 805
808 // Get the receiver from the stack. 806 // Get the receiver from the stack.
809 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); 807 __ mov(edx, Operand(esp, (argc + 1) * kPointerSize));
810 808
811 // If the object is the holder then we know that it's a global 809 // If the object is the holder then we know that it's a global
812 // object which can only happen for contextual calls. In this case, 810 // object which can only happen for contextual calls. In this case,
813 // the receiver cannot be a smi. 811 // the receiver cannot be a smi.
814 if (object != holder) { 812 if (object != holder) {
(...skipping 15 matching lines...) Expand all
830 // Patch the receiver on the stack with the global proxy. 828 // Patch the receiver on the stack with the global proxy.
831 if (object->IsGlobalObject()) { 829 if (object->IsGlobalObject()) {
832 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); 830 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset));
833 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx); 831 __ mov(Operand(esp, (argc + 1) * kPointerSize), edx);
834 } 832 }
835 833
836 // Setup the context (function already in edi). 834 // Setup the context (function already in edi).
837 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); 835 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
838 836
839 // Jump to the cached code (tail call). 837 // Jump to the cached code (tail call).
838 __ IncrementCounter(&Counters::call_global_inline, 1);
840 ASSERT(function->is_compiled()); 839 ASSERT(function->is_compiled());
841 Handle<Code> code(function->code()); 840 Handle<Code> code(function->code());
842 ParameterCount expected(function->shared()->formal_parameter_count()); 841 ParameterCount expected(function->shared()->formal_parameter_count());
843 __ InvokeCode(code, expected, arguments(), 842 __ InvokeCode(code, expected, arguments(),
844 RelocInfo::CODE_TARGET, JUMP_FUNCTION); 843 RelocInfo::CODE_TARGET, JUMP_FUNCTION);
845 844
846 // Handle call cache miss. 845 // Handle call cache miss.
847 __ bind(&miss); 846 __ bind(&miss);
848 __ DecrementCounter(&Counters::call_global_inline, 1);
849 __ IncrementCounter(&Counters::call_global_inline_miss, 1); 847 __ IncrementCounter(&Counters::call_global_inline_miss, 1);
850 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); 848 Handle<Code> ic = ComputeCallMiss(arguments().immediate());
851 __ jmp(ic, RelocInfo::CODE_TARGET); 849 __ jmp(ic, RelocInfo::CODE_TARGET);
852 850
853 // Return the generated code. 851 // Return the generated code.
854 return GetCode(NORMAL, name); 852 return GetCode(NORMAL, name);
855 } 853 }
856 854
857 855
858 Object* StoreStubCompiler::CompileStoreField(JSObject* object, 856 Object* StoreStubCompiler::CompileStoreField(JSObject* object,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 JSGlobalPropertyCell* cell, 1000 JSGlobalPropertyCell* cell,
1003 String* name) { 1001 String* name) {
1004 // ----------- S t a t e ------------- 1002 // ----------- S t a t e -------------
1005 // -- eax : value 1003 // -- eax : value
1006 // -- ecx : name 1004 // -- ecx : name
1007 // -- esp[0] : return address 1005 // -- esp[0] : return address
1008 // -- esp[4] : receiver 1006 // -- esp[4] : receiver
1009 // ----------------------------------- 1007 // -----------------------------------
1010 Label miss; 1008 Label miss;
1011 1009
1012 __ IncrementCounter(&Counters::named_store_global_inline, 1);
1013
1014 // Check that the map of the global has not changed. 1010 // Check that the map of the global has not changed.
1015 __ mov(ebx, Operand(esp, kPointerSize)); 1011 __ mov(ebx, Operand(esp, kPointerSize));
1016 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), 1012 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset),
1017 Immediate(Handle<Map>(object->map()))); 1013 Immediate(Handle<Map>(object->map())));
1018 __ j(not_equal, &miss, not_taken); 1014 __ j(not_equal, &miss, not_taken);
1019 1015
1020 // Store the value in the cell. 1016 // Store the value in the cell.
1021 __ mov(ecx, Immediate(Handle<JSGlobalPropertyCell>(cell))); 1017 __ mov(ecx, Immediate(Handle<JSGlobalPropertyCell>(cell)));
1022 __ mov(FieldOperand(ecx, JSGlobalPropertyCell::kValueOffset), eax); 1018 __ mov(FieldOperand(ecx, JSGlobalPropertyCell::kValueOffset), eax);
1023 1019
1024 // Return the value (register eax). 1020 // Return the value (register eax).
1021 __ IncrementCounter(&Counters::named_store_global_inline, 1);
1025 __ ret(0); 1022 __ ret(0);
1026 1023
1027 // Handle store cache miss. 1024 // Handle store cache miss.
1028 __ bind(&miss); 1025 __ bind(&miss);
1029 __ DecrementCounter(&Counters::named_store_global_inline, 1);
1030 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1); 1026 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1);
1031 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 1027 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1032 __ jmp(ic, RelocInfo::CODE_TARGET); 1028 __ jmp(ic, RelocInfo::CODE_TARGET);
1033 1029
1034 // Return the generated code. 1030 // Return the generated code.
1035 return GetCode(NORMAL, name); 1031 return GetCode(NORMAL, name);
1036 } 1032 }
1037 1033
1038 1034
1039 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, 1035 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1180 JSGlobalPropertyCell* cell, 1176 JSGlobalPropertyCell* cell,
1181 String* name, 1177 String* name,
1182 bool is_dont_delete) { 1178 bool is_dont_delete) {
1183 // ----------- S t a t e ------------- 1179 // ----------- S t a t e -------------
1184 // -- ecx : name 1180 // -- ecx : name
1185 // -- esp[0] : return address 1181 // -- esp[0] : return address
1186 // -- esp[4] : receiver 1182 // -- esp[4] : receiver
1187 // ----------------------------------- 1183 // -----------------------------------
1188 Label miss; 1184 Label miss;
1189 1185
1190 __ IncrementCounter(&Counters::named_load_global_inline, 1);
1191
1192 // Get the receiver from the stack. 1186 // Get the receiver from the stack.
1193 __ mov(eax, Operand(esp, kPointerSize)); 1187 __ mov(eax, Operand(esp, kPointerSize));
1194 1188
1195 // If the object is the holder then we know that it's a global 1189 // If the object is the holder then we know that it's a global
1196 // object which can only happen for contextual loads. In this case, 1190 // object which can only happen for contextual loads. In this case,
1197 // the receiver cannot be a smi. 1191 // the receiver cannot be a smi.
1198 if (object != holder) { 1192 if (object != holder) {
1199 __ test(eax, Immediate(kSmiTagMask)); 1193 __ test(eax, Immediate(kSmiTagMask));
1200 __ j(zero, &miss, not_taken); 1194 __ j(zero, &miss, not_taken);
1201 } 1195 }
1202 1196
1203 // Check that the maps haven't changed. 1197 // Check that the maps haven't changed.
1204 CheckPrototypes(object, eax, holder, ebx, edx, name, &miss); 1198 CheckPrototypes(object, eax, holder, ebx, edx, name, &miss);
1205 1199
1206 // Get the value from the cell. 1200 // Get the value from the cell.
1207 __ mov(eax, Immediate(Handle<JSGlobalPropertyCell>(cell))); 1201 __ mov(eax, Immediate(Handle<JSGlobalPropertyCell>(cell)));
1208 __ mov(eax, FieldOperand(eax, JSGlobalPropertyCell::kValueOffset)); 1202 __ mov(eax, FieldOperand(eax, JSGlobalPropertyCell::kValueOffset));
1209 1203
1210 // Check for deleted property if property can actually be deleted. 1204 // Check for deleted property if property can actually be deleted.
1211 if (!is_dont_delete) { 1205 if (!is_dont_delete) {
1212 __ cmp(eax, Factory::the_hole_value()); 1206 __ cmp(eax, Factory::the_hole_value());
1213 __ j(equal, &miss, not_taken); 1207 __ j(equal, &miss, not_taken);
1214 } else if (FLAG_debug_code) { 1208 } else if (FLAG_debug_code) {
1215 __ cmp(eax, Factory::the_hole_value()); 1209 __ cmp(eax, Factory::the_hole_value());
1216 __ Check(not_equal, "DontDelete cells can't contain the hole"); 1210 __ Check(not_equal, "DontDelete cells can't contain the hole");
1217 } 1211 }
1218 1212
1213 __ IncrementCounter(&Counters::named_load_global_inline, 1);
1219 __ ret(0); 1214 __ ret(0);
1220 1215
1221 __ bind(&miss); 1216 __ bind(&miss);
1222 __ DecrementCounter(&Counters::named_load_global_inline, 1);
1223 __ IncrementCounter(&Counters::named_load_global_inline_miss, 1); 1217 __ IncrementCounter(&Counters::named_load_global_inline_miss, 1);
1224 GenerateLoadMiss(masm(), Code::LOAD_IC); 1218 GenerateLoadMiss(masm(), Code::LOAD_IC);
1225 1219
1226 // Return the generated code. 1220 // Return the generated code.
1227 return GetCode(NORMAL, name); 1221 return GetCode(NORMAL, name);
1228 } 1222 }
1229 1223
1230 1224
1231 Object* KeyedLoadStubCompiler::CompileLoadField(String* name, 1225 Object* KeyedLoadStubCompiler::CompileLoadField(String* name,
1232 JSObject* receiver, 1226 JSObject* receiver,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 1424 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
1431 1425
1432 // Return the generated code. 1426 // Return the generated code.
1433 return GetCode(CALLBACKS, name); 1427 return GetCode(CALLBACKS, name);
1434 } 1428 }
1435 1429
1436 1430
1437 #undef __ 1431 #undef __
1438 1432
1439 } } // namespace v8::internal 1433 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698