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

Side by Side Diff: src/ia32/ic-ia32.cc

Issue 583008: Eliminate *IC::Generate() function on all platforms. (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') | src/ic.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 __ cmp(eax, FieldOperand(ecx, PixelArray::kLengthOffset)); 288 __ cmp(eax, FieldOperand(ecx, PixelArray::kLengthOffset));
289 __ j(above_equal, &slow); 289 __ j(above_equal, &slow);
290 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset)); 290 __ mov(ecx, FieldOperand(ecx, PixelArray::kExternalPointerOffset));
291 __ movzx_b(eax, Operand(ecx, eax, times_1, 0)); 291 __ movzx_b(eax, Operand(ecx, eax, times_1, 0));
292 __ shl(eax, kSmiTagSize); 292 __ shl(eax, kSmiTagSize);
293 __ ret(0); 293 __ ret(0);
294 294
295 // Slow case: Load name and receiver from stack and jump to runtime. 295 // Slow case: Load name and receiver from stack and jump to runtime.
296 __ bind(&slow); 296 __ bind(&slow);
297 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1); 297 __ IncrementCounter(&Counters::keyed_load_generic_slow, 1);
298 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); 298 GenerateRuntimeGetProperty(masm);
299 299
300 __ bind(&check_string); 300 __ bind(&check_string);
301 // The key is not a smi. 301 // The key is not a smi.
302 // Is it a string? 302 // Is it a string?
303 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edx); 303 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edx);
304 __ j(above_equal, &slow); 304 __ j(above_equal, &slow);
305 // Is the string an array index, with cached numeric value? 305 // Is the string an array index, with cached numeric value?
306 __ mov(ebx, FieldOperand(eax, String::kHashFieldOffset)); 306 __ mov(ebx, FieldOperand(eax, String::kHashFieldOffset));
307 __ test(ebx, Immediate(String::kIsArrayIndexMask)); 307 __ test(ebx, Immediate(String::kIsArrayIndexMask));
308 __ j(not_zero, &index_string, not_taken); 308 __ j(not_zero, &index_string, not_taken);
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 // If we fail allocation of the HeapNumber, we still have a value on 579 // If we fail allocation of the HeapNumber, we still have a value on
580 // top of the FPU stack. Remove it. 580 // top of the FPU stack. Remove it.
581 __ bind(&failed_allocation); 581 __ bind(&failed_allocation);
582 __ ffree(); 582 __ ffree();
583 __ fincstp(); 583 __ fincstp();
584 // Fall through to slow case. 584 // Fall through to slow case.
585 585
586 // Slow case: Load name and receiver from stack and jump to runtime. 586 // Slow case: Load name and receiver from stack and jump to runtime.
587 __ bind(&slow); 587 __ bind(&slow);
588 __ IncrementCounter(&Counters::keyed_load_external_array_slow, 1); 588 __ IncrementCounter(&Counters::keyed_load_external_array_slow, 1);
589 Generate(masm, ExternalReference(Runtime::kKeyedGetProperty)); 589 GenerateRuntimeGetProperty(masm);
590 } 590 }
591 591
592 592
593 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 593 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
594 // ----------- S t a t e ------------- 594 // ----------- S t a t e -------------
595 // -- eax : value 595 // -- eax : value
596 // -- esp[0] : return address 596 // -- esp[0] : return address
597 // -- esp[4] : key 597 // -- esp[4] : key
598 // -- esp[8] : receiver 598 // -- esp[8] : receiver
599 // ----------------------------------- 599 // -----------------------------------
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 __ mov(edx, Operand(ebx)); 638 __ mov(edx, Operand(ebx));
639 __ sar(edx, kSmiTagSize); // untag the index and use it for the comparison 639 __ sar(edx, kSmiTagSize); // untag the index and use it for the comparison
640 __ cmp(edx, FieldOperand(ecx, Array::kLengthOffset)); 640 __ cmp(edx, FieldOperand(ecx, Array::kLengthOffset));
641 // eax: value 641 // eax: value
642 // ecx: FixedArray 642 // ecx: FixedArray
643 // ebx: index (as a smi) 643 // ebx: index (as a smi)
644 __ j(below, &fast, taken); 644 __ j(below, &fast, taken);
645 645
646 // Slow case: call runtime. 646 // Slow case: call runtime.
647 __ bind(&slow); 647 __ bind(&slow);
648 Generate(masm, ExternalReference(Runtime::kSetProperty)); 648 GenerateRuntimeSetProperty(masm);
649 649
650 // Check whether the elements is a pixel array. 650 // Check whether the elements is a pixel array.
651 // eax: value 651 // eax: value
652 // ecx: elements array 652 // ecx: elements array
653 // ebx: index (as a smi) 653 // ebx: index (as a smi)
654 __ bind(&check_pixel_array); 654 __ bind(&check_pixel_array);
655 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), 655 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset),
656 Immediate(Factory::pixel_array_map())); 656 Immediate(Factory::pixel_array_map()));
657 __ j(not_equal, &slow); 657 __ j(not_equal, &slow);
658 // Check that the value is a smi. If a conversion is needed call into the 658 // Check that the value is a smi. If a conversion is needed call into the
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 default: 911 default:
912 UNREACHABLE(); 912 UNREACHABLE();
913 break; 913 break;
914 } 914 }
915 __ mov(eax, edx); // Return the original value. 915 __ mov(eax, edx); // Return the original value.
916 __ ret(0); 916 __ ret(0);
917 } 917 }
918 918
919 // Slow case: call runtime. 919 // Slow case: call runtime.
920 __ bind(&slow); 920 __ bind(&slow);
921 Generate(masm, ExternalReference(Runtime::kSetProperty)); 921 GenerateRuntimeSetProperty(masm);
922 } 922 }
923 923
924 924
925 // Defined in ic.cc. 925 // Defined in ic.cc.
926 Object* CallIC_Miss(Arguments args); 926 Object* CallIC_Miss(Arguments args);
927 927
928 void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { 928 void CallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
929 // ----------- S t a t e ------------- 929 // ----------- S t a t e -------------
930 // -- ecx : name 930 // -- ecx : name
931 // -- esp[0] : return address 931 // -- esp[0] : return address
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 1157
1158 __ mov(eax, Operand(esp, kPointerSize)); 1158 __ mov(eax, Operand(esp, kPointerSize));
1159 1159
1160 // Probe the stub cache. 1160 // Probe the stub cache.
1161 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, 1161 Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC,
1162 NOT_IN_LOOP, 1162 NOT_IN_LOOP,
1163 MONOMORPHIC); 1163 MONOMORPHIC);
1164 StubCache::GenerateProbe(masm, flags, eax, ecx, ebx, edx); 1164 StubCache::GenerateProbe(masm, flags, eax, ecx, ebx, edx);
1165 1165
1166 // Cache miss: Jump to runtime. 1166 // Cache miss: Jump to runtime.
1167 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); 1167 GenerateMiss(masm);
1168 } 1168 }
1169 1169
1170 1170
1171 void LoadIC::GenerateNormal(MacroAssembler* masm) { 1171 void LoadIC::GenerateNormal(MacroAssembler* masm) {
1172 // ----------- S t a t e ------------- 1172 // ----------- S t a t e -------------
1173 // -- ecx : name 1173 // -- ecx : name
1174 // -- esp[0] : return address 1174 // -- esp[0] : return address
1175 // -- esp[4] : receiver 1175 // -- esp[4] : receiver
1176 // ----------------------------------- 1176 // -----------------------------------
1177 Label miss, probe, global; 1177 Label miss, probe, global;
(...skipping 29 matching lines...) Expand all
1207 __ ret(0); 1207 __ ret(0);
1208 1208
1209 // Global object access: Check access rights. 1209 // Global object access: Check access rights.
1210 __ bind(&global); 1210 __ bind(&global);
1211 __ CheckAccessGlobalProxy(eax, edx, &miss); 1211 __ CheckAccessGlobalProxy(eax, edx, &miss);
1212 __ jmp(&probe); 1212 __ jmp(&probe);
1213 1213
1214 // Cache miss: Restore receiver from stack and jump to runtime. 1214 // Cache miss: Restore receiver from stack and jump to runtime.
1215 __ bind(&miss); 1215 __ bind(&miss);
1216 __ mov(eax, Operand(esp, 1 * kPointerSize)); 1216 __ mov(eax, Operand(esp, 1 * kPointerSize));
1217 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss))); 1217 GenerateMiss(masm);
1218 } 1218 }
1219 1219
1220 1220
1221 void LoadIC::GenerateMiss(MacroAssembler* masm) { 1221 void LoadIC::GenerateMiss(MacroAssembler* masm) {
1222 // ----------- S t a t e ------------- 1222 // ----------- S t a t e -------------
1223 // -- ecx : name 1223 // -- ecx : name
1224 // -- esp[0] : return address 1224 // -- esp[0] : return address
1225 // -- esp[4] : receiver 1225 // -- esp[4] : receiver
1226 // ----------------------------------- 1226 // -----------------------------------
1227 1227
1228 Generate(masm, ExternalReference(IC_Utility(kLoadIC_Miss)));
1229 }
1230
1231
1232 void LoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) {
1233 // ----------- S t a t e -------------
1234 // -- ecx : name
1235 // -- esp[0] : return address
1236 // -- esp[4] : receiver
1237 // -----------------------------------
1238
1239 __ mov(eax, Operand(esp, kPointerSize));
1240 __ pop(ebx); 1228 __ pop(ebx);
1241 __ push(eax); // receiver 1229 __ push(Operand(esp, 0)); // receiver
1242 __ push(ecx); // name 1230 __ push(ecx); // name
1243 __ push(ebx); // return address 1231 __ push(ebx); // return address
1244 1232
1245 // Perform tail call to the entry. 1233 // Perform tail call to the entry.
1246 __ TailCallRuntime(f, 2, 1); 1234 __ TailCallRuntime(ExternalReference(IC_Utility(kLoadIC_Miss)), 2, 1);
1247 } 1235 }
1248 1236
1249 1237
1250 // One byte opcode for test eax,0xXXXXXXXX. 1238 // One byte opcode for test eax,0xXXXXXXXX.
1251 static const byte kTestEaxByte = 0xA9; 1239 static const byte kTestEaxByte = 0xA9;
1252 1240
1253 1241
1254 void LoadIC::ClearInlinedVersion(Address address) { 1242 void LoadIC::ClearInlinedVersion(Address address) {
1255 // Reset the map check of the inlined inobject property load (if 1243 // Reset the map check of the inlined inobject property load (if
1256 // present) to guarantee failure by holding an invalid map (the null 1244 // present) to guarantee failure by holding an invalid map (the null
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 Object* KeyedLoadIC_Miss(Arguments args); 1333 Object* KeyedLoadIC_Miss(Arguments args);
1346 1334
1347 1335
1348 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 1336 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
1349 // ----------- S t a t e ------------- 1337 // ----------- S t a t e -------------
1350 // -- esp[0] : return address 1338 // -- esp[0] : return address
1351 // -- esp[4] : name 1339 // -- esp[4] : name
1352 // -- esp[8] : receiver 1340 // -- esp[8] : receiver
1353 // ----------------------------------- 1341 // -----------------------------------
1354 1342
1355 Generate(masm, ExternalReference(IC_Utility(kKeyedLoadIC_Miss))); 1343 __ pop(ebx);
1344 __ push(Operand(esp, kPointerSize)); // receiver
1345 __ push(Operand(esp, kPointerSize)); // name
1346 __ push(ebx); // return address
1347
1348 // Perform tail call to the entry.
1349 __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedLoadIC_Miss)), 2, 1);
1356 } 1350 }
1357 1351
1358 1352
1359 void KeyedLoadIC::Generate(MacroAssembler* masm, const ExternalReference& f) { 1353 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
1360 // ----------- S t a t e ------------- 1354 // ----------- S t a t e -------------
1361 // -- esp[0] : return address 1355 // -- esp[0] : return address
1362 // -- esp[4] : name 1356 // -- esp[4] : name
1363 // -- esp[8] : receiver 1357 // -- esp[8] : receiver
1364 // ----------------------------------- 1358 // -----------------------------------
1365 1359
1366 __ mov(eax, Operand(esp, kPointerSize));
1367 __ mov(ecx, Operand(esp, 2 * kPointerSize));
1368 __ pop(ebx); 1360 __ pop(ebx);
1369 __ push(ecx); // receiver 1361 __ push(Operand(esp, 1 * kPointerSize)); // receiver
1370 __ push(eax); // name 1362 __ push(Operand(esp, 1 * kPointerSize)); // name
1371 __ push(ebx); // return address 1363 __ push(ebx); // return address
1372 1364
1373 // Perform tail call to the entry. 1365 // Perform tail call to the entry.
1374 __ TailCallRuntime(f, 2, 1); 1366 __ TailCallRuntime(ExternalReference(Runtime::kKeyedGetProperty), 2, 1);
1375 } 1367 }
1376 1368
1377 1369
1378 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { 1370 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
1379 // ----------- S t a t e ------------- 1371 // ----------- S t a t e -------------
1380 // -- eax : value 1372 // -- eax : value
1381 // -- ecx : name 1373 // -- ecx : name
1382 // -- edx : receiver 1374 // -- edx : receiver
1383 // -- esp[0] : return address 1375 // -- esp[0] : return address
1384 // ----------------------------------- 1376 // -----------------------------------
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 __ push(ebx); 1420 __ push(ebx);
1429 1421
1430 // Perform tail call to the entry. 1422 // Perform tail call to the entry.
1431 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1); 1423 __ TailCallRuntime(ExternalReference(IC_Utility(kStoreIC_Miss)), 3, 1);
1432 } 1424 }
1433 1425
1434 1426
1435 // Defined in ic.cc. 1427 // Defined in ic.cc.
1436 Object* KeyedStoreIC_Miss(Arguments args); 1428 Object* KeyedStoreIC_Miss(Arguments args);
1437 1429
1438 void KeyedStoreIC::Generate(MacroAssembler* masm, const ExternalReference& f) { 1430 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm) {
1439 // ----------- S t a t e ------------- 1431 // ----------- S t a t e -------------
1440 // -- eax : value 1432 // -- eax : value
1441 // -- esp[0] : return address 1433 // -- esp[0] : return address
1442 // -- esp[4] : key 1434 // -- esp[4] : key
1443 // -- esp[8] : receiver 1435 // -- esp[8] : receiver
1444 // ----------------------------------- 1436 // -----------------------------------
1445 1437
1446 __ pop(ecx); 1438 __ pop(ecx);
1447 __ push(Operand(esp, 1 * kPointerSize)); 1439 __ push(Operand(esp, 1 * kPointerSize));
1448 __ push(Operand(esp, 1 * kPointerSize)); 1440 __ push(Operand(esp, 1 * kPointerSize));
1449 __ push(eax); 1441 __ push(eax);
1450 __ push(ecx); 1442 __ push(ecx);
1451 1443
1452 // Do tail-call to runtime routine. 1444 // Do tail-call to runtime routine.
1453 __ TailCallRuntime(f, 3, 1); 1445 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1);
1446 }
1447
1448
1449 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
1450 // ----------- S t a t e -------------
1451 // -- eax : value
1452 // -- esp[0] : return address
1453 // -- esp[4] : key
1454 // -- esp[8] : receiver
1455 // -----------------------------------
1456
1457 __ pop(ecx);
1458 __ push(Operand(esp, 1 * kPointerSize));
1459 __ push(Operand(esp, 1 * kPointerSize));
1460 __ push(eax);
1461 __ push(ecx);
1462
1463 // Do tail-call to runtime routine.
1464 __ TailCallRuntime(ExternalReference(IC_Utility(kKeyedStoreIC_Miss)), 3, 1);
1454 } 1465 }
1455 1466
1456 1467
1457 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { 1468 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) {
1458 // ----------- S t a t e ------------- 1469 // ----------- S t a t e -------------
1459 // -- eax : value 1470 // -- eax : value
1460 // -- ecx : transition map 1471 // -- ecx : transition map
1461 // -- esp[0] : return address 1472 // -- esp[0] : return address
1462 // -- esp[4] : key 1473 // -- esp[4] : key
1463 // -- esp[8] : receiver 1474 // -- esp[8] : receiver
1464 // ----------------------------------- 1475 // -----------------------------------
1465 1476
1466 __ pop(ebx); 1477 __ pop(ebx);
1467 __ push(Operand(esp, 1 * kPointerSize)); 1478 __ push(Operand(esp, 1 * kPointerSize));
1468 __ push(ecx); 1479 __ push(ecx);
1469 __ push(eax); 1480 __ push(eax);
1470 __ push(ebx); 1481 __ push(ebx);
1471 1482
1472 // Do tail-call to runtime routine. 1483 // Do tail-call to runtime routine.
1473 __ TailCallRuntime( 1484 __ TailCallRuntime(
1474 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1); 1485 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1);
1475 } 1486 }
1476 1487
1477 #undef __ 1488 #undef __
1478 1489
1479 1490
1480 } } // namespace v8::internal 1491 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/ic-arm.cc ('k') | src/ic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698