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

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

Issue 554152: Change StoreIC interface on ARM platform (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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/ic-arm.cc ('k') | 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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 Register scratch1, 251 Register scratch1,
252 Register scratch2, 252 Register scratch2,
253 Label* miss_label) { 253 Label* miss_label) {
254 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 254 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
255 __ mov(r0, scratch1); 255 __ mov(r0, scratch1);
256 __ Ret(); 256 __ Ret();
257 } 257 }
258 258
259 259
260 // Generate StoreField code, value is passed in r0 register. 260 // Generate StoreField code, value is passed in r0 register.
261 // After executing generated code, the receiver_reg and name_reg 261 // When leaving generated code after success, the receiver_reg and name_reg
262 // may be clobbered. 262 // may be clobbered. Upon branch to miss_label, the receiver and name
263 // registers have their original values.
263 void StubCompiler::GenerateStoreField(MacroAssembler* masm, 264 void StubCompiler::GenerateStoreField(MacroAssembler* masm,
264 JSObject* object, 265 JSObject* object,
265 int index, 266 int index,
266 Map* transition, 267 Map* transition,
267 Register receiver_reg, 268 Register receiver_reg,
268 Register name_reg, 269 Register name_reg,
269 Register scratch, 270 Register scratch,
270 Label* miss_label) { 271 Label* miss_label) {
271 // r0 : value 272 // r0 : value
272 Label exit; 273 Label exit;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 } 519 }
519 520
520 if (!optimize) { 521 if (!optimize) {
521 CompileRegular(masm, receiver, holder, scratch2, holder_obj, miss_label); 522 CompileRegular(masm, receiver, holder, scratch2, holder_obj, miss_label);
522 return; 523 return;
523 } 524 }
524 525
525 // Note: starting a frame here makes GC aware of pointers pushed below. 526 // Note: starting a frame here makes GC aware of pointers pushed below.
526 __ EnterInternalFrame(); 527 __ EnterInternalFrame();
527 528
528 if (lookup->type() == CALLBACKS) { 529 __ push(receiver);
529 __ push(receiver);
530 }
531 __ push(holder); 530 __ push(holder);
532 __ push(name_); 531 __ push(name_);
533 532
534 CompileCallLoadPropertyWithInterceptor(masm, 533 CompileCallLoadPropertyWithInterceptor(masm,
535 receiver, 534 receiver,
536 holder, 535 holder,
537 name_, 536 name_,
538 holder_obj); 537 holder_obj);
539 538
540 Label interceptor_failed; 539 Label interceptor_failed;
541 // Compare with no_interceptor_result_sentinel. 540 // Compare with no_interceptor_result_sentinel.
542 __ LoadRoot(scratch1, Heap::kNoInterceptorResultSentinelRootIndex); 541 __ LoadRoot(scratch1, Heap::kNoInterceptorResultSentinelRootIndex);
543 __ cmp(r0, scratch1); 542 __ cmp(r0, scratch1);
544 __ b(eq, &interceptor_failed); 543 __ b(eq, &interceptor_failed);
545 __ LeaveInternalFrame(); 544 __ LeaveInternalFrame();
546 __ Ret(); 545 __ Ret();
547 546
548 __ bind(&interceptor_failed); 547 __ bind(&interceptor_failed);
549 __ pop(name_); 548 __ pop(name_);
550 __ pop(holder); 549 __ pop(holder);
551 550 __ pop(receiver);
552 if (lookup->type() == CALLBACKS) {
553 __ pop(receiver);
554 }
555 551
556 __ LeaveInternalFrame(); 552 __ LeaveInternalFrame();
557 553
558 if (lookup->type() == FIELD) { 554 if (lookup->type() == FIELD) {
559 holder = stub_compiler->CheckPrototypes(holder_obj, 555 holder = stub_compiler->CheckPrototypes(holder_obj,
560 holder, 556 holder,
561 lookup->holder(), 557 lookup->holder(),
562 scratch1, 558 scratch1,
563 scratch2, 559 scratch2,
564 name, 560 name,
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 return GetCode(NORMAL, name); 1197 return GetCode(NORMAL, name);
1202 } 1198 }
1203 1199
1204 1200
1205 Object* StoreStubCompiler::CompileStoreField(JSObject* object, 1201 Object* StoreStubCompiler::CompileStoreField(JSObject* object,
1206 int index, 1202 int index,
1207 Map* transition, 1203 Map* transition,
1208 String* name) { 1204 String* name) {
1209 // ----------- S t a t e ------------- 1205 // ----------- S t a t e -------------
1210 // -- r0 : value 1206 // -- r0 : value
1207 // -- r1 : receiver
1211 // -- r2 : name 1208 // -- r2 : name
1212 // -- lr : return address 1209 // -- lr : return address
1213 // -- [sp] : receiver
1214 // ----------------------------------- 1210 // -----------------------------------
1215 Label miss; 1211 Label miss;
1216 1212
1217 // Get the receiver from the stack.
1218 __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
1219
1220 // name register might be clobbered.
1221 GenerateStoreField(masm(), 1213 GenerateStoreField(masm(),
1222 object, 1214 object,
1223 index, 1215 index,
1224 transition, 1216 transition,
1225 r3, r2, r1, 1217 r1, r2, r3,
1226 &miss); 1218 &miss);
1227 __ bind(&miss); 1219 __ bind(&miss);
1228 __ mov(r2, Operand(Handle<String>(name))); // restore name
1229 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 1220 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1230 __ Jump(ic, RelocInfo::CODE_TARGET); 1221 __ Jump(ic, RelocInfo::CODE_TARGET);
1231 1222
1232 // Return the generated code. 1223 // Return the generated code.
1233 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name); 1224 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION, name);
1234 } 1225 }
1235 1226
1236 1227
1237 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, 1228 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object,
1238 AccessorInfo* callback, 1229 AccessorInfo* callback,
1239 String* name) { 1230 String* name) {
1240 // ----------- S t a t e ------------- 1231 // ----------- S t a t e -------------
1241 // -- r0 : value 1232 // -- r0 : value
1233 // -- r1 : receiver
1242 // -- r2 : name 1234 // -- r2 : name
1243 // -- lr : return address 1235 // -- lr : return address
1244 // -- [sp] : receiver
1245 // ----------------------------------- 1236 // -----------------------------------
1246 Label miss; 1237 Label miss;
1247 1238
1248 // Get the object from the stack.
1249 __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
1250
1251 // Check that the object isn't a smi. 1239 // Check that the object isn't a smi.
1252 __ tst(r3, Operand(kSmiTagMask)); 1240 __ tst(r1, Operand(kSmiTagMask));
1253 __ b(eq, &miss); 1241 __ b(eq, &miss);
1254 1242
1255 // Check that the map of the object hasn't changed. 1243 // Check that the map of the object hasn't changed.
1256 __ ldr(r1, FieldMemOperand(r3, HeapObject::kMapOffset)); 1244 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
1257 __ cmp(r1, Operand(Handle<Map>(object->map()))); 1245 __ cmp(r3, Operand(Handle<Map>(object->map())));
1258 __ b(ne, &miss); 1246 __ b(ne, &miss);
1259 1247
1260 // Perform global security token check if needed. 1248 // Perform global security token check if needed.
1261 if (object->IsJSGlobalProxy()) { 1249 if (object->IsJSGlobalProxy()) {
1262 __ CheckAccessGlobalProxy(r3, r1, &miss); 1250 __ CheckAccessGlobalProxy(r1, r3, &miss);
1263 } 1251 }
1264 1252
1265 // Stub never generated for non-global objects that require access 1253 // Stub never generated for non-global objects that require access
1266 // checks. 1254 // checks.
1267 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); 1255 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
1268 1256
1269 __ ldr(ip, MemOperand(sp)); // receiver 1257 __ push(r1); // receiver
1270 __ push(ip);
1271 __ mov(ip, Operand(Handle<AccessorInfo>(callback))); // callback info 1258 __ mov(ip, Operand(Handle<AccessorInfo>(callback))); // callback info
1272 __ push(ip); 1259 __ stm(db_w, sp, ip.bit() | r2.bit() | r0.bit());
1273 __ push(r2); // name
1274 __ push(r0); // value
1275 1260
1276 // Do tail-call to the runtime system. 1261 // Do tail-call to the runtime system.
1277 ExternalReference store_callback_property = 1262 ExternalReference store_callback_property =
1278 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); 1263 ExternalReference(IC_Utility(IC::kStoreCallbackProperty));
1279 __ TailCallRuntime(store_callback_property, 4, 1); 1264 __ TailCallRuntime(store_callback_property, 4, 1);
1280 1265
1281 // Handle store cache miss. 1266 // Handle store cache miss.
1282 __ bind(&miss); 1267 __ bind(&miss);
1283 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 1268 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1284 __ Jump(ic, RelocInfo::CODE_TARGET); 1269 __ Jump(ic, RelocInfo::CODE_TARGET);
1285 1270
1286 // Return the generated code. 1271 // Return the generated code.
1287 return GetCode(CALLBACKS, name); 1272 return GetCode(CALLBACKS, name);
1288 } 1273 }
1289 1274
1290 1275
1291 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, 1276 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver,
1292 String* name) { 1277 String* name) {
1293 // ----------- S t a t e ------------- 1278 // ----------- S t a t e -------------
1294 // -- r0 : value 1279 // -- r0 : value
1280 // -- r1 : receiver
1295 // -- r2 : name 1281 // -- r2 : name
1296 // -- lr : return address 1282 // -- lr : return address
1297 // -- [sp] : receiver
1298 // ----------------------------------- 1283 // -----------------------------------
1299 Label miss; 1284 Label miss;
1300 1285
1301 // Get the object from the stack.
1302 __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
1303
1304 // Check that the object isn't a smi. 1286 // Check that the object isn't a smi.
1305 __ tst(r3, Operand(kSmiTagMask)); 1287 __ tst(r1, Operand(kSmiTagMask));
1306 __ b(eq, &miss); 1288 __ b(eq, &miss);
1307 1289
1308 // Check that the map of the object hasn't changed. 1290 // Check that the map of the object hasn't changed.
1309 __ ldr(r1, FieldMemOperand(r3, HeapObject::kMapOffset)); 1291 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
1310 __ cmp(r1, Operand(Handle<Map>(receiver->map()))); 1292 __ cmp(r3, Operand(Handle<Map>(receiver->map())));
1311 __ b(ne, &miss); 1293 __ b(ne, &miss);
1312 1294
1313 // Perform global security token check if needed. 1295 // Perform global security token check if needed.
1314 if (receiver->IsJSGlobalProxy()) { 1296 if (receiver->IsJSGlobalProxy()) {
1315 __ CheckAccessGlobalProxy(r3, r1, &miss); 1297 __ CheckAccessGlobalProxy(r1, r3, &miss);
1316 } 1298 }
1317 1299
1318 // Stub never generated for non-global objects that require access 1300 // Stub is never generated for non-global objects that require access
1319 // checks. 1301 // checks.
1320 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded()); 1302 ASSERT(receiver->IsJSGlobalProxy() || !receiver->IsAccessCheckNeeded());
1321 1303
1322 __ ldr(ip, MemOperand(sp)); // receiver 1304 __ push(r1); // receiver.
1323 __ push(ip); 1305 __ push(r2); // name.
1324 __ push(r2); // name 1306 __ push(r0); // value.
1325 __ push(r0); // value
1326 1307
1327 // Do tail-call to the runtime system. 1308 // Do tail-call to the runtime system.
1328 ExternalReference store_ic_property = 1309 ExternalReference store_ic_property =
1329 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); 1310 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty));
1330 __ TailCallRuntime(store_ic_property, 3, 1); 1311 __ TailCallRuntime(store_ic_property, 3, 1);
1331 1312
1332 // Handle store cache miss. 1313 // Handle store cache miss.
1333 __ bind(&miss); 1314 __ bind(&miss);
1334 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 1315 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1335 __ Jump(ic, RelocInfo::CODE_TARGET); 1316 __ Jump(ic, RelocInfo::CODE_TARGET);
1336 1317
1337 // Return the generated code. 1318 // Return the generated code.
1338 return GetCode(INTERCEPTOR, name); 1319 return GetCode(INTERCEPTOR, name);
1339 } 1320 }
1340 1321
1341 1322
1342 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object, 1323 Object* StoreStubCompiler::CompileStoreGlobal(GlobalObject* object,
1343 JSGlobalPropertyCell* cell, 1324 JSGlobalPropertyCell* cell,
1344 String* name) { 1325 String* name) {
1345 // ----------- S t a t e ------------- 1326 // ----------- S t a t e -------------
1346 // -- r0 : value 1327 // -- r0 : value
1328 // -- r1 : receiver
1347 // -- r2 : name 1329 // -- r2 : name
1348 // -- lr : return address 1330 // -- lr : return address
1349 // -- [sp] : receiver
1350 // ----------------------------------- 1331 // -----------------------------------
1351 Label miss; 1332 Label miss;
1352 1333
1353 // Check that the map of the global has not changed. 1334 // Check that the map of the global has not changed.
1354 __ ldr(r1, MemOperand(sp, 0 * kPointerSize));
1355 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset)); 1335 __ ldr(r3, FieldMemOperand(r1, HeapObject::kMapOffset));
1356 __ cmp(r3, Operand(Handle<Map>(object->map()))); 1336 __ cmp(r3, Operand(Handle<Map>(object->map())));
1357 __ b(ne, &miss); 1337 __ b(ne, &miss);
1358 1338
1359 // Store the value in the cell. 1339 // Store the value in the cell.
1360 __ mov(r2, Operand(Handle<JSGlobalPropertyCell>(cell))); 1340 __ mov(r2, Operand(Handle<JSGlobalPropertyCell>(cell)));
1361 __ str(r0, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); 1341 __ str(r0, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset));
1362 1342
1363 __ IncrementCounter(&Counters::named_store_global_inline, 1, r1, r3); 1343 __ IncrementCounter(&Counters::named_store_global_inline, 1, r4, r3);
1364 __ Ret(); 1344 __ Ret();
1365 1345
1366 // Handle store cache miss. 1346 // Handle store cache miss.
1367 __ bind(&miss); 1347 __ bind(&miss);
1368 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1, r1, r3); 1348 __ IncrementCounter(&Counters::named_store_global_inline_miss, 1, r4, r3);
1369 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); 1349 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss));
1370 __ Jump(ic, RelocInfo::CODE_TARGET); 1350 __ Jump(ic, RelocInfo::CODE_TARGET);
1371 1351
1372 // Return the generated code. 1352 // Return the generated code.
1373 return GetCode(NORMAL, name); 1353 return GetCode(NORMAL, name);
1374 } 1354 }
1375 1355
1376 1356
1377 Object* LoadStubCompiler::CompileLoadField(JSObject* object, 1357 Object* LoadStubCompiler::CompileLoadField(JSObject* object,
1378 JSObject* holder, 1358 JSObject* holder,
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); 1858 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET);
1879 1859
1880 // Return the generated code. 1860 // Return the generated code.
1881 return GetCode(); 1861 return GetCode();
1882 } 1862 }
1883 1863
1884 1864
1885 #undef __ 1865 #undef __
1886 1866
1887 } } // namespace v8::internal 1867 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/ic-arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698