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

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

Issue 400523007: Cache IC handlers on the prototype's map if possible (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comment Created 6 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
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/ic.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic-inl.h" 10 #include "src/ic-inl.h"
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 NameDictionary::kNotFound); 816 NameDictionary::kNotFound);
817 817
818 GenerateDictionaryNegativeLookup(masm(), miss, reg, name, 818 GenerateDictionaryNegativeLookup(masm(), miss, reg, name,
819 scratch1, scratch2); 819 scratch1, scratch2);
820 820
821 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); 821 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
822 reg = holder_reg; // From now on the object will be in holder_reg. 822 reg = holder_reg; // From now on the object will be in holder_reg.
823 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); 823 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset));
824 } else { 824 } else {
825 bool in_new_space = heap()->InNewSpace(*prototype); 825 bool in_new_space = heap()->InNewSpace(*prototype);
826 // Two possible reasons for loading the prototype from the map:
827 // (1) Can't store references to new space in code.
828 // (2) Handler is shared for all receivers with the same prototype
829 // map (but not necessarily the same prototype instance).
830 bool load_prototype_from_map = in_new_space || depth == 1;
826 if (depth != 1 || check == CHECK_ALL_MAPS) { 831 if (depth != 1 || check == CHECK_ALL_MAPS) {
827 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK); 832 __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK);
828 } 833 }
829 834
830 // Check access rights to the global object. This has to happen after 835 // Check access rights to the global object. This has to happen after
831 // the map check so that we know that the object is actually a global 836 // the map check so that we know that the object is actually a global
832 // object. 837 // object.
833 if (current_map->IsJSGlobalProxyMap()) { 838 if (current_map->IsJSGlobalProxyMap()) {
834 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss); 839 __ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss);
835 } else if (current_map->IsJSGlobalObjectMap()) { 840 } else if (current_map->IsJSGlobalObjectMap()) {
836 GenerateCheckPropertyCell( 841 GenerateCheckPropertyCell(
837 masm(), Handle<JSGlobalObject>::cast(current), name, 842 masm(), Handle<JSGlobalObject>::cast(current), name,
838 scratch2, miss); 843 scratch2, miss);
839 } 844 }
840 845
841 if (in_new_space) { 846 if (load_prototype_from_map) {
842 // Save the map in scratch1 for later. 847 // Save the map in scratch1 for later.
843 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset)); 848 __ mov(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
844 } 849 }
845 850
846 reg = holder_reg; // From now on the object will be in holder_reg. 851 reg = holder_reg; // From now on the object will be in holder_reg.
847 852
848 if (in_new_space) { 853 if (load_prototype_from_map) {
849 // The prototype is in new space; we cannot store a reference to it
850 // in the code. Load it from the map.
851 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset)); 854 __ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset));
852 } else { 855 } else {
853 // The prototype is in old space; load it directly.
854 __ mov(reg, prototype); 856 __ mov(reg, prototype);
855 } 857 }
856 } 858 }
857 859
858 // Go to the next object in the prototype chain. 860 // Go to the next object in the prototype chain.
859 current = prototype; 861 current = prototype;
860 current_map = handle(current->map()); 862 current_map = handle(current->map());
861 } 863 }
862 864
863 // Log the check depth. 865 // Log the check depth.
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 // ----------------------------------- 1501 // -----------------------------------
1500 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 1502 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
1501 } 1503 }
1502 1504
1503 1505
1504 #undef __ 1506 #undef __
1505 1507
1506 } } // namespace v8::internal 1508 } } // namespace v8::internal
1507 1509
1508 #endif // V8_TARGET_ARCH_IA32 1510 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/ic-ia32.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698