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

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

Issue 10828303: Fix improved LoadICs for dictionaries with callbacks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported to all architectures and addressed comments. Created 8 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/ic.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 1053
1054 1054
1055 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, 1055 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver,
1056 Register name_reg, 1056 Register name_reg,
1057 Register scratch1, 1057 Register scratch1,
1058 Register scratch2, 1058 Register scratch2,
1059 Register scratch3, 1059 Register scratch3,
1060 Handle<AccessorInfo> callback, 1060 Handle<AccessorInfo> callback,
1061 Handle<String> name, 1061 Handle<String> name,
1062 Label* miss) { 1062 Label* miss) {
1063 ASSERT(!receiver.is(scratch2));
1064 ASSERT(!receiver.is(scratch3));
1063 Register dictionary = scratch1; 1065 Register dictionary = scratch1;
1066 bool must_preserve_dictionary_reg = receiver.is(dictionary);
1067
1068 // Load the properties dictionary.
1069 if (must_preserve_dictionary_reg) {
1070 __ push(dictionary);
1071 }
1064 __ mov(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); 1072 __ mov(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset));
1065 1073
1066 // Probe the dictionary. 1074 // Probe the dictionary.
1067 Label probe_done; 1075 Label probe_done, pop_and_miss;
1068 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), 1076 StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
1069 miss, 1077 &pop_and_miss,
1070 &probe_done, 1078 &probe_done,
1071 dictionary, 1079 dictionary,
1072 name_reg, 1080 name_reg,
1073 scratch2, 1081 scratch2,
1074 scratch3); 1082 scratch3);
1083 __ bind(&pop_and_miss);
1084 if (must_preserve_dictionary_reg) {
1085 __ pop(dictionary);
1086 }
1087 __ jmp(miss);
1075 __ bind(&probe_done); 1088 __ bind(&probe_done);
1076 1089
1077 // If probing finds an entry in the dictionary, scratch2 contains the 1090 // If probing finds an entry in the dictionary, scratch2 contains the
1078 // index into the dictionary. Check that the value is the callback. 1091 // index into the dictionary. Check that the value is the callback.
1079 Register index = scratch2; 1092 Register index = scratch2;
1080 const int kElementsStartOffset = 1093 const int kElementsStartOffset =
1081 StringDictionary::kHeaderSize + 1094 StringDictionary::kHeaderSize +
1082 StringDictionary::kElementsStartIndex * kPointerSize; 1095 StringDictionary::kElementsStartIndex * kPointerSize;
1083 const int kValueOffset = kElementsStartOffset + kPointerSize; 1096 const int kValueOffset = kElementsStartOffset + kPointerSize;
1084 __ mov(scratch3, 1097 __ mov(scratch3,
1085 Operand(dictionary, index, times_4, kValueOffset - kHeapObjectTag)); 1098 Operand(dictionary, index, times_4, kValueOffset - kHeapObjectTag));
1099 if (must_preserve_dictionary_reg) {
1100 __ pop(dictionary);
1101 }
1086 __ cmp(scratch3, callback); 1102 __ cmp(scratch3, callback);
1087 __ j(not_equal, miss); 1103 __ j(not_equal, miss);
1088 } 1104 }
1089 1105
1090 1106
1091 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, 1107 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
1092 Handle<JSObject> holder, 1108 Handle<JSObject> holder,
1093 Register receiver, 1109 Register receiver,
1094 Register name_reg, 1110 Register name_reg,
1095 Register scratch1, 1111 Register scratch1,
1096 Register scratch2, 1112 Register scratch2,
1097 Register scratch3, 1113 Register scratch3,
1114 Register scratch4,
1098 Handle<AccessorInfo> callback, 1115 Handle<AccessorInfo> callback,
1099 Handle<String> name, 1116 Handle<String> name,
1100 Label* miss) { 1117 Label* miss) {
1101 // Check that the receiver isn't a smi. 1118 // Check that the receiver isn't a smi.
1102 __ JumpIfSmi(receiver, miss); 1119 __ JumpIfSmi(receiver, miss);
1103 1120
1104 // Check that the maps haven't changed. 1121 // Check that the maps haven't changed.
1105 Register reg = CheckPrototypes(object, receiver, holder, scratch1, 1122 Register reg = CheckPrototypes(object, receiver, holder, scratch1,
1106 scratch2, scratch3, name, miss); 1123 scratch2, scratch3, name, miss);
1107 1124
1108 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { 1125 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1109 GenerateDictionaryLoadCallback( 1126 GenerateDictionaryLoadCallback(
1110 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss); 1127 reg, name_reg, scratch1, scratch2, scratch3, callback, name, miss);
1111 } 1128 }
1112 1129
1113 // Insert additional parameters into the stack frame above return address. 1130 // Insert additional parameters into the stack frame above return address.
1114 ASSERT(!scratch3.is(reg)); 1131 ASSERT(!scratch3.is(reg));
1115 __ pop(scratch3); // Get return address to place it below. 1132 __ pop(scratch3); // Get return address to place it below.
1116 1133
1117 __ push(receiver); // receiver 1134 __ push(receiver); // receiver
1118 __ mov(scratch2, esp); 1135 __ mov(scratch2, esp);
1119 ASSERT(!scratch2.is(reg)); 1136 ASSERT(!scratch2.is(reg));
1120 __ push(reg); // holder 1137 __ push(reg); // holder
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 Handle<JSObject> object, 2955 Handle<JSObject> object,
2939 Handle<JSObject> holder, 2956 Handle<JSObject> holder,
2940 Handle<AccessorInfo> callback) { 2957 Handle<AccessorInfo> callback) {
2941 // ----------- S t a t e ------------- 2958 // ----------- S t a t e -------------
2942 // -- ecx : name 2959 // -- ecx : name
2943 // -- edx : receiver 2960 // -- edx : receiver
2944 // -- esp[0] : return address 2961 // -- esp[0] : return address
2945 // ----------------------------------- 2962 // -----------------------------------
2946 Label miss; 2963 Label miss;
2947 2964
2948 GenerateLoadCallback(object, holder, edx, ecx, ebx, eax, edi, callback, 2965 GenerateLoadCallback(object, holder, edx, ecx, ebx, eax, edi, no_reg,
2949 name, &miss); 2966 callback, name, &miss);
2950 __ bind(&miss); 2967 __ bind(&miss);
2951 GenerateLoadMiss(masm(), Code::LOAD_IC); 2968 GenerateLoadMiss(masm(), Code::LOAD_IC);
2952 2969
2953 // Return the generated code. 2970 // Return the generated code.
2954 return GetCode(Code::CALLBACKS, name); 2971 return GetCode(Code::CALLBACKS, name);
2955 } 2972 }
2956 2973
2957 2974
2958 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( 2975 Handle<Code> LoadStubCompiler::CompileLoadViaGetter(
2959 Handle<String> name, 2976 Handle<String> name,
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
3128 // ----------------------------------- 3145 // -----------------------------------
3129 Label miss; 3146 Label miss;
3130 3147
3131 Counters* counters = isolate()->counters(); 3148 Counters* counters = isolate()->counters();
3132 __ IncrementCounter(counters->keyed_load_callback(), 1); 3149 __ IncrementCounter(counters->keyed_load_callback(), 1);
3133 3150
3134 // Check that the name has not changed. 3151 // Check that the name has not changed.
3135 __ cmp(ecx, Immediate(name)); 3152 __ cmp(ecx, Immediate(name));
3136 __ j(not_equal, &miss); 3153 __ j(not_equal, &miss);
3137 3154
3138 GenerateLoadCallback(receiver, holder, edx, ecx, ebx, eax, edi, callback, 3155 GenerateLoadCallback(receiver, holder, edx, ecx, ebx, eax, edi, no_reg,
3139 name, &miss); 3156 callback, name, &miss);
3140 3157
3141 __ bind(&miss); 3158 __ bind(&miss);
3142 __ DecrementCounter(counters->keyed_load_callback(), 1); 3159 __ DecrementCounter(counters->keyed_load_callback(), 1);
3143 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 3160 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3144 3161
3145 // Return the generated code. 3162 // Return the generated code.
3146 return GetCode(Code::CALLBACKS, name); 3163 return GetCode(Code::CALLBACKS, name);
3147 } 3164 }
3148 3165
3149 3166
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
4287 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4304 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4288 } 4305 }
4289 } 4306 }
4290 4307
4291 4308
4292 #undef __ 4309 #undef __
4293 4310
4294 } } // namespace v8::internal 4311 } } // namespace v8::internal
4295 4312
4296 #endif // V8_TARGET_ARCH_IA32 4313 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698