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

Side by Side Diff: src/arm/stub-cache-arm.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 | « no previous file | src/ia32/stub-cache-ia32.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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1231
1232 1232
1233 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, 1233 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver,
1234 Register name_reg, 1234 Register name_reg,
1235 Register scratch1, 1235 Register scratch1,
1236 Register scratch2, 1236 Register scratch2,
1237 Register scratch3, 1237 Register scratch3,
1238 Handle<AccessorInfo> callback, 1238 Handle<AccessorInfo> callback,
1239 Handle<String> name, 1239 Handle<String> name,
1240 Label* miss) { 1240 Label* miss) {
1241 ASSERT(!receiver.is(scratch1));
1242 ASSERT(!receiver.is(scratch2));
1243 ASSERT(!receiver.is(scratch3));
1244
1245 // Load the properties dictionary.
1241 Register dictionary = scratch1; 1246 Register dictionary = scratch1;
1242 Register index = scratch2;
1243 __ ldr(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 1247 __ ldr(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
1244 1248
1245 // Probe the dictionary. 1249 // Probe the dictionary.
1246 Label probe_done; 1250 Label probe_done;
1247 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), 1251 StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
1248 miss, 1252 miss,
1249 &probe_done, 1253 &probe_done,
1250 dictionary, 1254 dictionary,
1251 name_reg, 1255 name_reg,
1252 index, // Set if we hit. 1256 scratch2,
1253 scratch3); 1257 scratch3);
1254 __ bind(&probe_done); 1258 __ bind(&probe_done);
1255 1259
1256 // If probing finds an entry in the dictionary, check that the value is the 1260 // If probing finds an entry in the dictionary, scratch3 contains the
1257 // callback. 1261 // pointer into the dictionary. Check that the value is the callback.
1258 const int kElementsStartOffset = 1262 Register pointer = scratch3;
1259 StringDictionary::kHeaderSize + 1263 const int kElementsStartOffset = StringDictionary::kHeaderSize +
1260 StringDictionary::kElementsStartIndex * kPointerSize; 1264 StringDictionary::kElementsStartIndex * kPointerSize;
1261 const int kValueOffset = kElementsStartOffset + kPointerSize; 1265 const int kValueOffset = kElementsStartOffset + kPointerSize;
1262 __ add(scratch1, dictionary, Operand(kValueOffset - kHeapObjectTag)); 1266 __ ldr(scratch2, FieldMemOperand(pointer, kValueOffset));
1263 __ ldr(scratch3, MemOperand(scratch1, index, LSL, kPointerSizeLog2)); 1267 __ cmp(scratch2, Operand(callback));
1264 __ cmp(scratch3, Operand(callback));
1265 __ b(ne, miss); 1268 __ b(ne, miss);
1266 } 1269 }
1267 1270
1268 1271
1269 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, 1272 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
1270 Handle<JSObject> holder, 1273 Handle<JSObject> holder,
1271 Register receiver, 1274 Register receiver,
1272 Register name_reg, 1275 Register name_reg,
1273 Register scratch1, 1276 Register scratch1,
1274 Register scratch2, 1277 Register scratch2,
1275 Register scratch3, 1278 Register scratch3,
1279 Register scratch4,
1276 Handle<AccessorInfo> callback, 1280 Handle<AccessorInfo> callback,
1277 Handle<String> name, 1281 Handle<String> name,
1278 Label* miss) { 1282 Label* miss) {
1279 // Check that the receiver isn't a smi. 1283 // Check that the receiver isn't a smi.
1280 __ JumpIfSmi(receiver, miss); 1284 __ JumpIfSmi(receiver, miss);
1281 1285
1282 // Check that the maps haven't changed. 1286 // Check that the maps haven't changed.
1283 Register reg = CheckPrototypes(object, receiver, holder, scratch1, 1287 Register reg = CheckPrototypes(object, receiver, holder, scratch1,
1284 scratch2, scratch3, name, miss); 1288 scratch2, scratch3, name, miss);
1285 1289
1286 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { 1290 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1287 GenerateDictionaryLoadCallback( 1291 GenerateDictionaryLoadCallback(
1288 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss); 1292 reg, name_reg, scratch2, scratch3, scratch4, callback, name, miss);
1289 } 1293 }
1290 1294
1291 // Build AccessorInfo::args_ list on the stack and push property name below 1295 // Build AccessorInfo::args_ list on the stack and push property name below
1292 // the exit frame to make GC aware of them and store pointers to them. 1296 // the exit frame to make GC aware of them and store pointers to them.
1293 __ push(receiver); 1297 __ push(receiver);
1294 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ 1298 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_
1295 if (heap()->InNewSpace(callback->data())) { 1299 if (heap()->InNewSpace(callback->data())) {
1296 __ Move(scratch3, callback); 1300 __ Move(scratch3, callback);
1297 __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); 1301 __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset));
1298 } else { 1302 } else {
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 Handle<String> name, 2911 Handle<String> name,
2908 Handle<JSObject> object, 2912 Handle<JSObject> object,
2909 Handle<JSObject> holder, 2913 Handle<JSObject> holder,
2910 Handle<AccessorInfo> callback) { 2914 Handle<AccessorInfo> callback) {
2911 // ----------- S t a t e ------------- 2915 // ----------- S t a t e -------------
2912 // -- r0 : receiver 2916 // -- r0 : receiver
2913 // -- r2 : name 2917 // -- r2 : name
2914 // -- lr : return address 2918 // -- lr : return address
2915 // ----------------------------------- 2919 // -----------------------------------
2916 Label miss; 2920 Label miss;
2917 GenerateLoadCallback(object, holder, r0, r2, r3, r1, r4, callback, name, 2921 GenerateLoadCallback(object, holder, r0, r2, r3, r1, r4, r5, callback, name,
2918 &miss); 2922 &miss);
2919 __ bind(&miss); 2923 __ bind(&miss);
2920 GenerateLoadMiss(masm(), Code::LOAD_IC); 2924 GenerateLoadMiss(masm(), Code::LOAD_IC);
2921 2925
2922 // Return the generated code. 2926 // Return the generated code.
2923 return GetCode(Code::CALLBACKS, name); 2927 return GetCode(Code::CALLBACKS, name);
2924 } 2928 }
2925 2929
2926 2930
2927 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( 2931 Handle<Code> LoadStubCompiler::CompileLoadViaGetter(
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 // -- lr : return address 3082 // -- lr : return address
3079 // -- r0 : key 3083 // -- r0 : key
3080 // -- r1 : receiver 3084 // -- r1 : receiver
3081 // ----------------------------------- 3085 // -----------------------------------
3082 Label miss; 3086 Label miss;
3083 3087
3084 // Check the key is the cached one. 3088 // Check the key is the cached one.
3085 __ cmp(r0, Operand(name)); 3089 __ cmp(r0, Operand(name));
3086 __ b(ne, &miss); 3090 __ b(ne, &miss);
3087 3091
3088 GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, r4, callback, name, 3092 GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, r4, r5, callback, name,
3089 &miss); 3093 &miss);
3090 __ bind(&miss); 3094 __ bind(&miss);
3091 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 3095 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
3092 3096
3093 return GetCode(Code::CALLBACKS, name); 3097 return GetCode(Code::CALLBACKS, name);
3094 } 3098 }
3095 3099
3096 3100
3097 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant( 3101 Handle<Code> KeyedLoadStubCompiler::CompileLoadConstant(
3098 Handle<String> name, 3102 Handle<String> name,
(...skipping 1622 matching lines...) Expand 10 before | Expand all | Expand 10 after
4721 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4725 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4722 } 4726 }
4723 } 4727 }
4724 4728
4725 4729
4726 #undef __ 4730 #undef __
4727 4731
4728 } } // namespace v8::internal 4732 } } // namespace v8::internal
4729 4733
4730 #endif // V8_TARGET_ARCH_ARM 4734 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698