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

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

Issue 10831153: Improve load IC so it can call a native accessor even if the holder is (Closed) Base URL: http://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
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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 // Check that the maps haven't changed. 1223 // Check that the maps haven't changed.
1224 CheckPrototypes( 1224 CheckPrototypes(
1225 object, receiver, holder, scratch1, scratch2, scratch3, name, miss); 1225 object, receiver, holder, scratch1, scratch2, scratch3, name, miss);
1226 1226
1227 // Return the constant value. 1227 // Return the constant value.
1228 __ LoadHeapObject(r0, value); 1228 __ LoadHeapObject(r0, value);
1229 __ Ret(); 1229 __ Ret();
1230 } 1230 }
1231 1231
1232 1232
1233 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver,
1234 Register name_reg,
1235 Register scratch1,
1236 Register scratch2,
1237 Register scratch3,
1238 Handle<AccessorInfo> callback,
1239 Handle<String> name,
1240 Label* miss) {
1241 Register dictionary = scratch1;
1242 __ ldr(dictionary, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
1243
1244 // Probe the dictionary.
1245 Label probe_done;
1246 StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
1247 miss,
1248 &probe_done,
1249 dictionary,
1250 name_reg,
1251 scratch2,
1252 scratch3);
1253 __ bind(&probe_done);
1254
1255 // If probing finds an entry in the dictionary, scratch2 contains the
1256 // index into the dictionary. Check that the value is the callback.
1257 Register index = scratch2;
Toon Verwaest 2012/08/06 13:49:24 If you do this assignment before passing scratch2
Erik Corry 2012/08/06 14:26:46 Done.
1258 const int kElementsStartOffset =
1259 StringDictionary::kHeaderSize +
1260 StringDictionary::kElementsStartIndex * kPointerSize;
1261 const int kValueOffset = kElementsStartOffset + kPointerSize;
1262 __ add(scratch1, dictionary, Operand(kValueOffset - kHeapObjectTag));
1263 __ ldr(scratch3, MemOperand(scratch1, index, LSL, kPointerSizeLog2));
1264 __ cmp(scratch3, Operand(callback));
1265 __ b(ne, miss);
1266 }
1267
1268
1233 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, 1269 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
1234 Handle<JSObject> holder, 1270 Handle<JSObject> holder,
1235 Register receiver, 1271 Register receiver,
1236 Register name_reg, 1272 Register name_reg,
1237 Register scratch1, 1273 Register scratch1,
1238 Register scratch2, 1274 Register scratch2,
1239 Register scratch3, 1275 Register scratch3,
1240 Handle<AccessorInfo> callback, 1276 Handle<AccessorInfo> callback,
1241 Handle<String> name, 1277 Handle<String> name,
1242 Label* miss) { 1278 Label* miss) {
1243 // Check that the receiver isn't a smi. 1279 // Check that the receiver isn't a smi.
1244 __ JumpIfSmi(receiver, miss); 1280 __ JumpIfSmi(receiver, miss);
1245 1281
1246 // Check that the maps haven't changed. 1282 // Check that the maps haven't changed.
1247 Register reg = CheckPrototypes(object, receiver, holder, scratch1, 1283 Register reg = CheckPrototypes(object, receiver, holder, scratch1,
1248 scratch2, scratch3, name, miss); 1284 scratch2, scratch3, name, miss);
1249 1285
1286 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1287 GenerateDictionaryLoadCallback(
1288 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss);
1289 }
1290
1250 // Build AccessorInfo::args_ list on the stack and push property name below 1291 // Build AccessorInfo::args_ list on the stack and push property name below
1251 // the exit frame to make GC aware of them and store pointers to them. 1292 // the exit frame to make GC aware of them and store pointers to them.
1252 __ push(receiver); 1293 __ push(receiver);
1253 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_ 1294 __ mov(scratch2, sp); // scratch2 = AccessorInfo::args_
1254 if (heap()->InNewSpace(callback->data())) { 1295 if (heap()->InNewSpace(callback->data())) {
1255 __ Move(scratch3, callback); 1296 __ Move(scratch3, callback);
1256 __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); 1297 __ ldr(scratch3, FieldMemOperand(scratch3, AccessorInfo::kDataOffset));
1257 } else { 1298 } else {
1258 __ Move(scratch3, Handle<Object>(callback->data())); 1299 __ Move(scratch3, Handle<Object>(callback->data()));
1259 } 1300 }
(...skipping 3420 matching lines...) Expand 10 before | Expand all | Expand 10 after
4680 __ Jump(ic_slow, RelocInfo::CODE_TARGET); 4721 __ Jump(ic_slow, RelocInfo::CODE_TARGET);
4681 } 4722 }
4682 } 4723 }
4683 4724
4684 4725
4685 #undef __ 4726 #undef __
4686 4727
4687 } } // namespace v8::internal 4728 } } // namespace v8::internal
4688 4729
4689 #endif // V8_TARGET_ARCH_ARM 4730 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698