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

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

Issue 10823326: MIPS: Fix improved LoadICs for dictionaries with callbacks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | « no previous file | no next file » | 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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1235
1236 1236
1237 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, 1237 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver,
1238 Register name_reg, 1238 Register name_reg,
1239 Register scratch1, 1239 Register scratch1,
1240 Register scratch2, 1240 Register scratch2,
1241 Register scratch3, 1241 Register scratch3,
1242 Handle<AccessorInfo> callback, 1242 Handle<AccessorInfo> callback,
1243 Handle<String> name, 1243 Handle<String> name,
1244 Label* miss) { 1244 Label* miss) {
1245 ASSERT(!receiver.is(scratch1));
1246 ASSERT(!receiver.is(scratch2));
1247 ASSERT(!receiver.is(scratch3));
1248
1249 // Load the properties dictionary.
1245 Register dictionary = scratch1; 1250 Register dictionary = scratch1;
1246 Register index = scratch2;
1247 __ lw(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 1251 __ lw(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
1248 1252
1249 // Probe the dictionary. 1253 // Probe the dictionary.
1250 Label probe_done; 1254 Label probe_done;
1251 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), 1255 StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
1252 miss, 1256 miss,
1253 &probe_done, 1257 &probe_done,
1254 dictionary, 1258 dictionary,
1255 name_reg, 1259 name_reg,
1256 index, // Set if we hit. 1260 scratch2,
1257 scratch3); 1261 scratch3);
1258 __ bind(&probe_done); 1262 __ bind(&probe_done);
1259 1263
1260 // If probing finds an entry in the dictionary, check that the value is the 1264 // If probing finds an entry in the dictionary, scratch3 contains the
1261 // callback. 1265 // pointer into the dictionary. Check that the value is the callback.
1262 const int kElementsStartOffset = 1266 Register pointer = scratch3;
1263 StringDictionary::kHeaderSize + 1267 const int kElementsStartOffset = StringDictionary::kHeaderSize +
1264 StringDictionary::kElementsStartIndex * kPointerSize; 1268 StringDictionary::kElementsStartIndex * kPointerSize;
1265 const int kValueOffset = kElementsStartOffset + kPointerSize; 1269 const int kValueOffset = kElementsStartOffset + kPointerSize;
1266 __ Addu(scratch1, dictionary, Operand(kValueOffset - kHeapObjectTag)); 1270 __ lw(scratch2, FieldMemOperand(pointer, kValueOffset));
1267 __ sll(scratch3, index, kPointerSizeLog2); 1271 __ Branch(miss, ne, scratch2, Operand(callback));
1268 __ addu(scratch1, scratch1, scratch3);
1269 __ lw(scratch3, MemOperand(scratch1));
1270 __ Branch(miss, ne, scratch3, Operand(callback));
1271 } 1272 }
1272 1273
1273 1274
1274 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, 1275 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
1275 Handle<JSObject> holder, 1276 Handle<JSObject> holder,
1276 Register receiver, 1277 Register receiver,
1277 Register name_reg, 1278 Register name_reg,
1278 Register scratch1, 1279 Register scratch1,
1279 Register scratch2, 1280 Register scratch2,
1280 Register scratch3, 1281 Register scratch3,
1282 Register scratch4,
1281 Handle<AccessorInfo> callback, 1283 Handle<AccessorInfo> callback,
1282 Handle<String> name, 1284 Handle<String> name,
1283 Label* miss) { 1285 Label* miss) {
1284 // Check that the receiver isn't a smi. 1286 // Check that the receiver isn't a smi.
1285 __ JumpIfSmi(receiver, miss, scratch1); 1287 __ JumpIfSmi(receiver, miss, scratch1);
1286 1288
1287 // Check that the maps haven't changed. 1289 // Check that the maps haven't changed.
1288 Register reg = CheckPrototypes(object, receiver, holder, scratch1, 1290 Register reg = CheckPrototypes(object, receiver, holder, scratch1,
1289 scratch2, scratch3, name, miss); 1291 scratch2, scratch3, name, miss);
1290 1292
1291 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { 1293 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1292 GenerateDictionaryLoadCallback( 1294 GenerateDictionaryLoadCallback(
1293 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss); 1295 reg, name_reg, scratch2, scratch3, scratch4, callback, name, miss);
1294 } 1296 }
1295 1297
1296 // Build AccessorInfo::args_ list on the stack and push property name below 1298 // Build AccessorInfo::args_ list on the stack and push property name below
1297 // the exit frame to make GC aware of them and store pointers to them. 1299 // the exit frame to make GC aware of them and store pointers to them.
1298 __ push(receiver); 1300 __ push(receiver);
1299 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ 1301 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_
1300 if (heap()->InNewSpace(callback->data())) { 1302 if (heap()->InNewSpace(callback->data())) {
1301 __ li(scratch3, callback); 1303 __ li(scratch3, callback);
1302 __ lw(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); 1304 __ lw(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset));
1303 } else { 1305 } else {
(...skipping 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2913 Handle<String> name, 2915 Handle<String> name,
2914 Handle<JSObject> object, 2916 Handle<JSObject> object,
2915 Handle<JSObject> holder, 2917 Handle<JSObject> holder,
2916 Handle<AccessorInfo> callback) { 2918 Handle<AccessorInfo> callback) {
2917 // ----------- S t a t e ------------- 2919 // ----------- S t a t e -------------
2918 // -- a0 : receiver 2920 // -- a0 : receiver
2919 // -- a2 : name 2921 // -- a2 : name
2920 // -- ra : return address 2922 // -- ra : return address
2921 // ----------------------------------- 2923 // -----------------------------------
2922 Label miss; 2924 Label miss;
2923 GenerateLoadCallback(object, holder, a0, a2, a3, a1, t0, callback, name, 2925 GenerateLoadCallback(object, holder, a0, a2, a3, a1, t0, t1, callback, name,
2924 &miss); 2926 &miss);
2925 __ bind(&miss); 2927 __ bind(&miss);
2926 GenerateLoadMiss(masm(), Code::LOAD_IC); 2928 GenerateLoadMiss(masm(), Code::LOAD_IC);
2927 2929
2928 // Return the generated code. 2930 // Return the generated code.
2929 return GetCode(Code::CALLBACKS, name); 2931 return GetCode(Code::CALLBACKS, name);
2930 } 2932 }
2931 2933
2932 2934
2933 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( 2935 Handle<Code> LoadStubCompiler::CompileLoadViaGetter(
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 // ----------- S t a t e ------------- 3084 // ----------- S t a t e -------------
3083 // -- ra : return address 3085 // -- ra : return address
3084 // -- a0 : key 3086 // -- a0 : key
3085 // -- a1 : receiver 3087 // -- a1 : receiver
3086 // ----------------------------------- 3088 // -----------------------------------
3087 Label miss; 3089 Label miss;
3088 3090
3089 // Check the key is the cached one. 3091 // Check the key is the cached one.
3090 __ Branch(&miss, ne, a0, Operand(name)); 3092 __ Branch(&miss, ne, a0, Operand(name));
3091 3093
3092 GenerateLoadCallback(receiver, holder, a1, a0, a2, a3, t0, callback, name, 3094 GenerateLoadCallback(receiver, holder, a1, a0, a2, a3, t0, t1, callback,
3093 &miss); 3095 name, &miss);
3094 __ bind(&miss); 3096 __ bind(&miss);
3095 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 3097 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3096 3098
3097 return GetCode(Code::CALLBACKS, name); 3099 return GetCode(Code::CALLBACKS, name);
3098 } 3100 }
3099 3101
3100 3102
3101 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant( 3103 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant(
3102 Handle<String> name, 3104 Handle<String> name,
3103 Handle<JSObject> receiver, 3105 Handle<JSObject> receiver,
(...skipping 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
4784 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4786 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4785 } 4787 }
4786 } 4788 }
4787 4789
4788 4790
4789 #undef __ 4791 #undef __
4790 4792
4791 } } // namespace v8::internal 4793 } } // namespace v8::internal
4792 4794
4793 #endif // V8_TARGET_ARCH_MIPS 4795 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698