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

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

Issue 18014003: Add X32 port into V8 (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 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 24 matching lines...) Expand all
35 #include "stub-cache.h" 35 #include "stub-cache.h"
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 // ---------------------------------------------------------------------------- 40 // ----------------------------------------------------------------------------
41 // Static IC stub generators. 41 // Static IC stub generators.
42 // 42 //
43 43
44 #define __ ACCESS_MASM(masm) 44 #define __ ACCESS_MASM(masm)
45 45 #define __k __
46 #define __a __
46 47
47 static void GenerateGlobalInstanceTypeCheck(MacroAssembler* masm, 48 static void GenerateGlobalInstanceTypeCheck(MacroAssembler* masm,
48 Register type, 49 Register type,
49 Label* global_object) { 50 Label* global_object) {
50 // Register usage: 51 // Register usage:
51 // type: holds the receiver instance type on entry. 52 // type: holds the receiver instance type on entry.
52 __ cmpb(type, Immediate(JS_GLOBAL_OBJECT_TYPE)); 53 __ cmpb(type, Immediate(JS_GLOBAL_OBJECT_TYPE));
53 __ j(equal, global_object); 54 __ j(equal, global_object);
54 __ cmpb(type, Immediate(JS_BUILTINS_OBJECT_TYPE)); 55 __ cmpb(type, Immediate(JS_BUILTINS_OBJECT_TYPE));
55 __ j(equal, global_object); 56 __ j(equal, global_object);
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 __ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset)); 564 __ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset));
564 565
565 // Check that it has indexed interceptor and access checks 566 // Check that it has indexed interceptor and access checks
566 // are not enabled for this object. 567 // are not enabled for this object.
567 __ movb(rcx, FieldOperand(rcx, Map::kBitFieldOffset)); 568 __ movb(rcx, FieldOperand(rcx, Map::kBitFieldOffset));
568 __ andb(rcx, Immediate(kSlowCaseBitFieldMask)); 569 __ andb(rcx, Immediate(kSlowCaseBitFieldMask));
569 __ cmpb(rcx, Immediate(1 << Map::kHasIndexedInterceptor)); 570 __ cmpb(rcx, Immediate(1 << Map::kHasIndexedInterceptor));
570 __ j(not_zero, &slow); 571 __ j(not_zero, &slow);
571 572
572 // Everything is fine, call runtime. 573 // Everything is fine, call runtime.
573 __ pop(rcx); 574 __k pop(rcx);
574 __ push(rdx); // receiver 575 __ push(rdx); // receiver
575 __ push(rax); // key 576 __ push(rax); // key
576 __ push(rcx); // return address 577 __k push(rcx); // return address
577 578
578 // Perform tail call to the entry. 579 // Perform tail call to the entry.
579 __ TailCallExternalReference( 580 __ TailCallExternalReference(
580 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), 581 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor),
581 masm->isolate()), 582 masm->isolate()),
582 2, 583 2,
583 1); 584 1);
584 585
585 __ bind(&slow); 586 __ bind(&slow);
586 GenerateMiss(masm, MISS); 587 GenerateMiss(masm, MISS);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 // rsp[0] : return address 899 // rsp[0] : return address
899 // rsp[8] : argument argc 900 // rsp[8] : argument argc
900 // rsp[16] : argument argc - 1 901 // rsp[16] : argument argc - 1
901 // ... 902 // ...
902 // rsp[argc * 8] : argument 1 903 // rsp[argc * 8] : argument 1
903 // rsp[(argc + 1) * 8] : argument 0 = receiver 904 // rsp[(argc + 1) * 8] : argument 0 = receiver
904 // ----------------------------------- 905 // -----------------------------------
905 Label miss; 906 Label miss;
906 907
907 // Get the receiver of the function from the stack. 908 // Get the receiver of the function from the stack.
908 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 909 __a movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
909 910
910 GenerateNameDictionaryReceiverCheck(masm, rdx, rax, rbx, &miss); 911 GenerateNameDictionaryReceiverCheck(masm, rdx, rax, rbx, &miss);
911 912
912 // rax: elements 913 // rax: elements
913 // Search the dictionary placing the result in rdi. 914 // Search the dictionary placing the result in rdi.
914 GenerateDictionaryLoad(masm, &miss, rax, rcx, rbx, rdi, rdi); 915 GenerateDictionaryLoad(masm, &miss, rax, rcx, rbx, rdi, rdi);
915 916
916 GenerateFunctionTailCall(masm, argc, &miss); 917 GenerateFunctionTailCall(masm, argc, &miss);
917 918
918 __ bind(&miss); 919 __ bind(&miss);
(...skipping 15 matching lines...) Expand all
934 // ----------------------------------- 935 // -----------------------------------
935 936
936 Counters* counters = masm->isolate()->counters(); 937 Counters* counters = masm->isolate()->counters();
937 if (id == IC::kCallIC_Miss) { 938 if (id == IC::kCallIC_Miss) {
938 __ IncrementCounter(counters->call_miss(), 1); 939 __ IncrementCounter(counters->call_miss(), 1);
939 } else { 940 } else {
940 __ IncrementCounter(counters->keyed_call_miss(), 1); 941 __ IncrementCounter(counters->keyed_call_miss(), 1);
941 } 942 }
942 943
943 // Get the receiver of the function from the stack; 1 ~ return address. 944 // Get the receiver of the function from the stack; 1 ~ return address.
944 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 945 __a movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
945 946
946 // Enter an internal frame. 947 // Enter an internal frame.
947 { 948 {
948 FrameScope scope(masm, StackFrame::INTERNAL); 949 FrameScope scope(masm, StackFrame::INTERNAL);
949 950
950 // Push the receiver and the name of the function. 951 // Push the receiver and the name of the function.
951 __ push(rdx); 952 __ push(rdx);
952 __ push(rcx); 953 __ push(rcx);
953 954
954 // Call the entry. 955 // Call the entry.
955 CEntryStub stub(1); 956 CEntryStub stub(1);
956 __ Set(rax, 2); 957 __ Set(rax, 2);
957 __ LoadAddress(rbx, ExternalReference(IC_Utility(id), masm->isolate())); 958 __ LoadAddress(rbx, ExternalReference(IC_Utility(id), masm->isolate()));
958 __ CallStub(&stub); 959 __ CallStub(&stub);
959 960
960 // Move result to rdi and exit the internal frame. 961 // Move result to rdi and exit the internal frame.
961 __ movq(rdi, rax); 962 __ movq(rdi, rax);
962 } 963 }
963 964
964 // Check if the receiver is a global object of some sort. 965 // Check if the receiver is a global object of some sort.
965 // This can happen only for regular CallIC but not KeyedCallIC. 966 // This can happen only for regular CallIC but not KeyedCallIC.
966 if (id == IC::kCallIC_Miss) { 967 if (id == IC::kCallIC_Miss) {
967 Label invoke, global; 968 Label invoke, global;
968 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); // receiver 969 // receiver
970 __a movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
969 __ JumpIfSmi(rdx, &invoke); 971 __ JumpIfSmi(rdx, &invoke);
970 __ CmpObjectType(rdx, JS_GLOBAL_OBJECT_TYPE, rcx); 972 __ CmpObjectType(rdx, JS_GLOBAL_OBJECT_TYPE, rcx);
971 __ j(equal, &global); 973 __ j(equal, &global);
972 __ CmpInstanceType(rcx, JS_BUILTINS_OBJECT_TYPE); 974 __ CmpInstanceType(rcx, JS_BUILTINS_OBJECT_TYPE);
973 __ j(not_equal, &invoke); 975 __ j(not_equal, &invoke);
974 976
975 // Patch the receiver on the stack. 977 // Patch the receiver on the stack.
976 __ bind(&global); 978 __ bind(&global);
977 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset)); 979 __ movq(rdx, FieldOperand(rdx, GlobalObject::kGlobalReceiverOffset));
978 __ movq(Operand(rsp, (argc + 1) * kPointerSize), rdx); 980 __a movq(Operand(rsp, (argc + 1) * kPointerSize), rdx);
979 __ bind(&invoke); 981 __ bind(&invoke);
980 } 982 }
981 983
982 // Invoke the function. 984 // Invoke the function.
983 CallKind call_kind = CallICBase::Contextual::decode(extra_state) 985 CallKind call_kind = CallICBase::Contextual::decode(extra_state)
984 ? CALL_AS_FUNCTION 986 ? CALL_AS_FUNCTION
985 : CALL_AS_METHOD; 987 : CALL_AS_METHOD;
986 ParameterCount actual(argc); 988 ParameterCount actual(argc);
987 __ InvokeFunction(rdi, 989 __ InvokeFunction(rdi,
988 actual, 990 actual,
(...skipping 10 matching lines...) Expand all
999 // rcx : function name 1001 // rcx : function name
1000 // rsp[0] : return address 1002 // rsp[0] : return address
1001 // rsp[8] : argument argc 1003 // rsp[8] : argument argc
1002 // rsp[16] : argument argc - 1 1004 // rsp[16] : argument argc - 1
1003 // ... 1005 // ...
1004 // rsp[argc * 8] : argument 1 1006 // rsp[argc * 8] : argument 1
1005 // rsp[(argc + 1) * 8] : argument 0 = receiver 1007 // rsp[(argc + 1) * 8] : argument 0 = receiver
1006 // ----------------------------------- 1008 // -----------------------------------
1007 1009
1008 // Get the receiver of the function from the stack; 1 ~ return address. 1010 // Get the receiver of the function from the stack; 1 ~ return address.
1009 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 1011 __a movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
1010 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state); 1012 GenerateMonomorphicCacheProbe(masm, argc, Code::CALL_IC, extra_ic_state);
1011 GenerateMiss(masm, argc, extra_ic_state); 1013 GenerateMiss(masm, argc, extra_ic_state);
1012 } 1014 }
1013 1015
1014 1016
1015 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { 1017 void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) {
1016 // ----------- S t a t e ------------- 1018 // ----------- S t a t e -------------
1017 // rcx : function name 1019 // rcx : function name
1018 // rsp[0] : return address 1020 // rsp[0] : return address
1019 // rsp[8] : argument argc 1021 // rsp[8] : argument argc
1020 // rsp[16] : argument argc - 1 1022 // rsp[16] : argument argc - 1
1021 // ... 1023 // ...
1022 // rsp[argc * 8] : argument 1 1024 // rsp[argc * 8] : argument 1
1023 // rsp[(argc + 1) * 8] : argument 0 = receiver 1025 // rsp[(argc + 1) * 8] : argument 0 = receiver
1024 // ----------------------------------- 1026 // -----------------------------------
1025 1027
1026 // Get the receiver of the function from the stack; 1 ~ return address. 1028 // Get the receiver of the function from the stack; 1 ~ return address.
1027 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 1029 __a movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
1028 1030
1029 Label do_call, slow_call, slow_load; 1031 Label do_call, slow_call, slow_load;
1030 Label check_number_dictionary, check_name, lookup_monomorphic_cache; 1032 Label check_number_dictionary, check_name, lookup_monomorphic_cache;
1031 Label index_smi, index_name; 1033 Label index_smi, index_name;
1032 1034
1033 // Check that the key is a smi. 1035 // Check that the key is a smi.
1034 __ JumpIfNotSmi(rcx, &check_name); 1036 __ JumpIfNotSmi(rcx, &check_name);
1035 1037
1036 __ bind(&index_smi); 1038 __ bind(&index_smi);
1037 // Now the key is known to be a smi. This place is also jumped to from below 1039 // Now the key is known to be a smi. This place is also jumped to from below
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 // ----------- S t a t e ------------- 1297 // ----------- S t a t e -------------
1296 // rcx : function name 1298 // rcx : function name
1297 // rsp[0] : return address 1299 // rsp[0] : return address
1298 // rsp[8] : argument argc 1300 // rsp[8] : argument argc
1299 // rsp[16] : argument argc - 1 1301 // rsp[16] : argument argc - 1
1300 // ... 1302 // ...
1301 // rsp[argc * 8] : argument 1 1303 // rsp[argc * 8] : argument 1
1302 // rsp[(argc + 1) * 8] : argument 0 = receiver 1304 // rsp[(argc + 1) * 8] : argument 0 = receiver
1303 // ----------------------------------- 1305 // -----------------------------------
1304 Label slow, notin; 1306 Label slow, notin;
1305 __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); 1307 __a movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
1306 Operand mapped_location = GenerateMappedArgumentsLookup( 1308 Operand mapped_location = GenerateMappedArgumentsLookup(
1307 masm, rdx, rcx, rbx, rax, r8, &notin, &slow); 1309 masm, rdx, rcx, rbx, rax, r8, &notin, &slow);
1308 __ movq(rdi, mapped_location); 1310 __ movq(rdi, mapped_location);
1309 GenerateFunctionTailCall(masm, argc, &slow); 1311 GenerateFunctionTailCall(masm, argc, &slow);
1310 __ bind(&notin); 1312 __ bind(&notin);
1311 // The unmapped lookup expects that the parameter map is in rbx. 1313 // The unmapped lookup expects that the parameter map is in rbx.
1312 Operand unmapped_location = 1314 Operand unmapped_location =
1313 GenerateUnmappedArgumentsLookup(masm, rcx, rbx, rax, &slow); 1315 GenerateUnmappedArgumentsLookup(masm, rcx, rbx, rax, &slow);
1314 __ CompareRoot(unmapped_location, Heap::kTheHoleValueRootIndex); 1316 __ CompareRoot(unmapped_location, Heap::kTheHoleValueRootIndex);
1315 __ j(equal, &slow); 1317 __ j(equal, &slow);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 void LoadIC::GenerateMiss(MacroAssembler* masm) { 1364 void LoadIC::GenerateMiss(MacroAssembler* masm) {
1363 // ----------- S t a t e ------------- 1365 // ----------- S t a t e -------------
1364 // -- rax : receiver 1366 // -- rax : receiver
1365 // -- rcx : name 1367 // -- rcx : name
1366 // -- rsp[0] : return address 1368 // -- rsp[0] : return address
1367 // ----------------------------------- 1369 // -----------------------------------
1368 1370
1369 Counters* counters = masm->isolate()->counters(); 1371 Counters* counters = masm->isolate()->counters();
1370 __ IncrementCounter(counters->load_miss(), 1); 1372 __ IncrementCounter(counters->load_miss(), 1);
1371 1373
1372 __ pop(rbx); 1374 __k pop(rbx);
1373 __ push(rax); // receiver 1375 __ push(rax); // receiver
1374 __ push(rcx); // name 1376 __ push(rcx); // name
1375 __ push(rbx); // return address 1377 __k push(rbx); // return address
1376 1378
1377 // Perform tail call to the entry. 1379 // Perform tail call to the entry.
1378 ExternalReference ref = 1380 ExternalReference ref =
1379 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); 1381 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
1380 __ TailCallExternalReference(ref, 2, 1); 1382 __ TailCallExternalReference(ref, 2, 1);
1381 } 1383 }
1382 1384
1383 1385
1384 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 1386 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
1385 // ----------- S t a t e ------------- 1387 // ----------- S t a t e -------------
1386 // -- rax : receiver 1388 // -- rax : receiver
1387 // -- rcx : name 1389 // -- rcx : name
1388 // -- rsp[0] : return address 1390 // -- rsp[0] : return address
1389 // ----------------------------------- 1391 // -----------------------------------
1390 1392
1391 __ pop(rbx); 1393 __k pop(rbx);
1392 __ push(rax); // receiver 1394 __ push(rax); // receiver
1393 __ push(rcx); // name 1395 __ push(rcx); // name
1394 __ push(rbx); // return address 1396 __k push(rbx); // return address
1395 1397
1396 // Perform tail call to the entry. 1398 // Perform tail call to the entry.
1397 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); 1399 __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
1398 } 1400 }
1399 1401
1400 1402
1401 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { 1403 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
1402 // ----------- S t a t e ------------- 1404 // ----------- S t a t e -------------
1403 // -- rax : key 1405 // -- rax : key
1404 // -- rdx : receiver 1406 // -- rdx : receiver
1405 // -- rsp[0] : return address 1407 // -- rsp[0] : return address
1406 // ----------------------------------- 1408 // -----------------------------------
1407 1409
1408 Counters* counters = masm->isolate()->counters(); 1410 Counters* counters = masm->isolate()->counters();
1409 __ IncrementCounter(counters->keyed_load_miss(), 1); 1411 __ IncrementCounter(counters->keyed_load_miss(), 1);
1410 1412
1411 __ pop(rbx); 1413 __k pop(rbx);
1412 __ push(rdx); // receiver 1414 __ push(rdx); // receiver
1413 __ push(rax); // name 1415 __ push(rax); // name
1414 __ push(rbx); // return address 1416 __k push(rbx); // return address
1415 1417
1416 // Perform tail call to the entry. 1418 // Perform tail call to the entry.
1417 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC 1419 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
1418 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric), 1420 ? ExternalReference(IC_Utility(kKeyedLoadIC_MissForceGeneric),
1419 masm->isolate()) 1421 masm->isolate())
1420 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); 1422 : ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
1421 __ TailCallExternalReference(ref, 2, 1); 1423 __ TailCallExternalReference(ref, 2, 1);
1422 } 1424 }
1423 1425
1424 1426
1425 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 1427 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
1426 // ----------- S t a t e ------------- 1428 // ----------- S t a t e -------------
1427 // -- rax : key 1429 // -- rax : key
1428 // -- rdx : receiver 1430 // -- rdx : receiver
1429 // -- rsp[0] : return address 1431 // -- rsp[0] : return address
1430 // ----------------------------------- 1432 // -----------------------------------
1431 1433
1432 __ pop(rbx); 1434 __k pop(rbx);
1433 __ push(rdx); // receiver 1435 __ push(rdx); // receiver
1434 __ push(rax); // name 1436 __ push(rax); // name
1435 __ push(rbx); // return address 1437 __k push(rbx); // return address
1436 1438
1437 // Perform tail call to the entry. 1439 // Perform tail call to the entry.
1438 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); 1440 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
1439 } 1441 }
1440 1442
1441 1443
1442 void StoreIC::GenerateMegamorphic(MacroAssembler* masm, 1444 void StoreIC::GenerateMegamorphic(MacroAssembler* masm,
1443 StrictModeFlag strict_mode) { 1445 StrictModeFlag strict_mode) {
1444 // ----------- S t a t e ------------- 1446 // ----------- S t a t e -------------
1445 // -- rax : value 1447 // -- rax : value
(...skipping 14 matching lines...) Expand all
1460 1462
1461 1463
1462 void StoreIC::GenerateMiss(MacroAssembler* masm) { 1464 void StoreIC::GenerateMiss(MacroAssembler* masm) {
1463 // ----------- S t a t e ------------- 1465 // ----------- S t a t e -------------
1464 // -- rax : value 1466 // -- rax : value
1465 // -- rcx : name 1467 // -- rcx : name
1466 // -- rdx : receiver 1468 // -- rdx : receiver
1467 // -- rsp[0] : return address 1469 // -- rsp[0] : return address
1468 // ----------------------------------- 1470 // -----------------------------------
1469 1471
1470 __ pop(rbx); 1472 __k pop(rbx);
1471 __ push(rdx); // receiver 1473 __ push(rdx); // receiver
1472 __ push(rcx); // name 1474 __ push(rcx); // name
1473 __ push(rax); // value 1475 __ push(rax); // value
1474 __ push(rbx); // return address 1476 __k push(rbx); // return address
1475 1477
1476 // Perform tail call to the entry. 1478 // Perform tail call to the entry.
1477 ExternalReference ref = 1479 ExternalReference ref =
1478 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate()); 1480 ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate());
1479 __ TailCallExternalReference(ref, 3, 1); 1481 __ TailCallExternalReference(ref, 3, 1);
1480 } 1482 }
1481 1483
1482 1484
1483 void StoreIC::GenerateNormal(MacroAssembler* masm) { 1485 void StoreIC::GenerateNormal(MacroAssembler* masm) {
1484 // ----------- S t a t e ------------- 1486 // ----------- S t a t e -------------
(...skipping 19 matching lines...) Expand all
1504 1506
1505 1507
1506 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, 1508 void StoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
1507 StrictModeFlag strict_mode) { 1509 StrictModeFlag strict_mode) {
1508 // ----------- S t a t e ------------- 1510 // ----------- S t a t e -------------
1509 // -- rax : value 1511 // -- rax : value
1510 // -- rcx : name 1512 // -- rcx : name
1511 // -- rdx : receiver 1513 // -- rdx : receiver
1512 // -- rsp[0] : return address 1514 // -- rsp[0] : return address
1513 // ----------------------------------- 1515 // -----------------------------------
1514 __ pop(rbx); 1516 __k pop(rbx);
1515 __ push(rdx); 1517 __ push(rdx);
1516 __ push(rcx); 1518 __ push(rcx);
1517 __ push(rax); 1519 __ push(rax);
1518 __ Push(Smi::FromInt(NONE)); // PropertyAttributes 1520 __ Push(Smi::FromInt(NONE)); // PropertyAttributes
1519 __ Push(Smi::FromInt(strict_mode)); 1521 __ Push(Smi::FromInt(strict_mode));
1520 __ push(rbx); // return address 1522 __k push(rbx); // return address
1521 1523
1522 // Do tail-call to runtime routine. 1524 // Do tail-call to runtime routine.
1523 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); 1525 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1524 } 1526 }
1525 1527
1526 1528
1527 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm, 1529 void KeyedStoreIC::GenerateRuntimeSetProperty(MacroAssembler* masm,
1528 StrictModeFlag strict_mode) { 1530 StrictModeFlag strict_mode) {
1529 // ----------- S t a t e ------------- 1531 // ----------- S t a t e -------------
1530 // -- rax : value 1532 // -- rax : value
1531 // -- rcx : key 1533 // -- rcx : key
1532 // -- rdx : receiver 1534 // -- rdx : receiver
1533 // -- rsp[0] : return address 1535 // -- rsp[0] : return address
1534 // ----------------------------------- 1536 // -----------------------------------
1535 1537
1536 __ pop(rbx); 1538 __k pop(rbx);
1537 __ push(rdx); // receiver 1539 __ push(rdx); // receiver
1538 __ push(rcx); // key 1540 __ push(rcx); // key
1539 __ push(rax); // value 1541 __ push(rax); // value
1540 __ Push(Smi::FromInt(NONE)); // PropertyAttributes 1542 __ Push(Smi::FromInt(NONE)); // PropertyAttributes
1541 __ Push(Smi::FromInt(strict_mode)); // Strict mode. 1543 __ Push(Smi::FromInt(strict_mode)); // Strict mode.
1542 __ push(rbx); // return address 1544 __k push(rbx); // return address
1543 1545
1544 // Do tail-call to runtime routine. 1546 // Do tail-call to runtime routine.
1545 __ TailCallRuntime(Runtime::kSetProperty, 5, 1); 1547 __ TailCallRuntime(Runtime::kSetProperty, 5, 1);
1546 } 1548 }
1547 1549
1548 1550
1549 void StoreIC::GenerateSlow(MacroAssembler* masm) { 1551 void StoreIC::GenerateSlow(MacroAssembler* masm) {
1550 // ----------- S t a t e ------------- 1552 // ----------- S t a t e -------------
1551 // -- rax : value 1553 // -- rax : value
1552 // -- rcx : key 1554 // -- rcx : key
1553 // -- rdx : receiver 1555 // -- rdx : receiver
1554 // -- rsp[0] : return address 1556 // -- rsp[0] : return address
1555 // ----------------------------------- 1557 // -----------------------------------
1556 1558
1557 __ pop(rbx); 1559 __k pop(rbx);
1558 __ push(rdx); // receiver 1560 __ push(rdx); // receiver
1559 __ push(rcx); // key 1561 __ push(rcx); // key
1560 __ push(rax); // value 1562 __ push(rax); // value
1561 __ push(rbx); // return address 1563 __k push(rbx); // return address
1562 1564
1563 // Do tail-call to runtime routine. 1565 // Do tail-call to runtime routine.
1564 ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate()); 1566 ExternalReference ref(IC_Utility(kStoreIC_Slow), masm->isolate());
1565 __ TailCallExternalReference(ref, 3, 1); 1567 __ TailCallExternalReference(ref, 3, 1);
1566 } 1568 }
1567 1569
1568 1570
1569 void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) { 1571 void KeyedStoreIC::GenerateSlow(MacroAssembler* masm) {
1570 // ----------- S t a t e ------------- 1572 // ----------- S t a t e -------------
1571 // -- rax : value 1573 // -- rax : value
1572 // -- rcx : key 1574 // -- rcx : key
1573 // -- rdx : receiver 1575 // -- rdx : receiver
1574 // -- rsp[0] : return address 1576 // -- rsp[0] : return address
1575 // ----------------------------------- 1577 // -----------------------------------
1576 1578
1577 __ pop(rbx); 1579 __k pop(rbx);
1578 __ push(rdx); // receiver 1580 __ push(rdx); // receiver
1579 __ push(rcx); // key 1581 __ push(rcx); // key
1580 __ push(rax); // value 1582 __ push(rax); // value
1581 __ push(rbx); // return address 1583 __k push(rbx); // return address
1582 1584
1583 // Do tail-call to runtime routine. 1585 // Do tail-call to runtime routine.
1584 ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate()); 1586 ExternalReference ref(IC_Utility(kKeyedStoreIC_Slow), masm->isolate());
1585 __ TailCallExternalReference(ref, 3, 1); 1587 __ TailCallExternalReference(ref, 3, 1);
1586 } 1588 }
1587 1589
1588 1590
1589 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) { 1591 void KeyedStoreIC::GenerateMiss(MacroAssembler* masm, ICMissMode miss_mode) {
1590 // ----------- S t a t e ------------- 1592 // ----------- S t a t e -------------
1591 // -- rax : value 1593 // -- rax : value
1592 // -- rcx : key 1594 // -- rcx : key
1593 // -- rdx : receiver 1595 // -- rdx : receiver
1594 // -- rsp[0] : return address 1596 // -- rsp[0] : return address
1595 // ----------------------------------- 1597 // -----------------------------------
1596 1598
1597 __ pop(rbx); 1599 __k pop(rbx);
1598 __ push(rdx); // receiver 1600 __ push(rdx); // receiver
1599 __ push(rcx); // key 1601 __ push(rcx); // key
1600 __ push(rax); // value 1602 __ push(rax); // value
1601 __ push(rbx); // return address 1603 __k push(rbx); // return address
1602 1604
1603 // Do tail-call to runtime routine. 1605 // Do tail-call to runtime routine.
1604 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC 1606 ExternalReference ref = miss_mode == MISS_FORCE_GENERIC
1605 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric), 1607 ? ExternalReference(IC_Utility(kKeyedStoreIC_MissForceGeneric),
1606 masm->isolate()) 1608 masm->isolate())
1607 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate()); 1609 : ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
1608 __ TailCallExternalReference(ref, 3, 1); 1610 __ TailCallExternalReference(ref, 3, 1);
1609 } 1611 }
1610 1612
1611 1613
1612 void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) { 1614 void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) {
1613 // ----------- S t a t e ------------- 1615 // ----------- S t a t e -------------
1614 // -- rbx : target map 1616 // -- rbx : target map
1615 // -- rdx : receiver 1617 // -- rdx : receiver
1616 // -- rsp[0] : return address 1618 // -- rsp[0] : return address
1617 // ----------------------------------- 1619 // -----------------------------------
1618 // Must return the modified receiver in eax. 1620 // Must return the modified receiver in eax.
1619 if (!FLAG_trace_elements_transitions) { 1621 if (!FLAG_trace_elements_transitions) {
1620 Label fail; 1622 Label fail;
1621 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, 1623 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS,
1622 FAST_DOUBLE_ELEMENTS); 1624 FAST_DOUBLE_ELEMENTS);
1623 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, &fail); 1625 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, &fail);
1624 __ movq(rax, rdx); 1626 __ movq(rax, rdx);
1625 __ Ret(); 1627 __ Ret();
1626 __ bind(&fail); 1628 __ bind(&fail);
1627 } 1629 }
1628 1630
1629 __ pop(rbx); 1631 __k pop(rbx);
1630 __ push(rdx); 1632 __ push(rdx);
1631 __ push(rbx); // return address 1633 __k push(rbx); // return address
1632 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1); 1634 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1);
1633 } 1635 }
1634 1636
1635 1637
1636 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject( 1638 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject(
1637 MacroAssembler* masm) { 1639 MacroAssembler* masm) {
1638 // ----------- S t a t e ------------- 1640 // ----------- S t a t e -------------
1639 // -- rbx : target map 1641 // -- rbx : target map
1640 // -- rdx : receiver 1642 // -- rdx : receiver
1641 // -- rsp[0] : return address 1643 // -- rsp[0] : return address
1642 // ----------------------------------- 1644 // -----------------------------------
1643 // Must return the modified receiver in eax. 1645 // Must return the modified receiver in eax.
1644 if (!FLAG_trace_elements_transitions) { 1646 if (!FLAG_trace_elements_transitions) {
1645 Label fail; 1647 Label fail;
1646 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, 1648 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS,
1647 FAST_ELEMENTS); 1649 FAST_ELEMENTS);
1648 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, &fail); 1650 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, &fail);
1649 __ movq(rax, rdx); 1651 __ movq(rax, rdx);
1650 __ Ret(); 1652 __ Ret();
1651 __ bind(&fail); 1653 __ bind(&fail);
1652 } 1654 }
1653 1655
1654 __ pop(rbx); 1656 __k pop(rbx);
1655 __ push(rdx); 1657 __ push(rdx);
1656 __ push(rbx); // return address 1658 __k push(rbx); // return address
1657 __ TailCallRuntime(Runtime::kTransitionElementsDoubleToObject, 1, 1); 1659 __ TailCallRuntime(Runtime::kTransitionElementsDoubleToObject, 1, 1);
1658 } 1660 }
1659 1661
1660 1662
1663 #undef __a
1664 #undef __k
1661 #undef __ 1665 #undef __
1662 1666
1663 1667
1664 Condition CompareIC::ComputeCondition(Token::Value op) { 1668 Condition CompareIC::ComputeCondition(Token::Value op) {
1665 switch (op) { 1669 switch (op) {
1666 case Token::EQ_STRICT: 1670 case Token::EQ_STRICT:
1667 case Token::EQ: 1671 case Token::EQ:
1668 return equal; 1672 return equal;
1669 case Token::LT: 1673 case Token::LT:
1670 return less; 1674 return less;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1725 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) 1729 Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
1726 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 1730 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
1727 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 1731 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
1728 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1732 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1729 } 1733 }
1730 1734
1731 1735
1732 } } // namespace v8::internal 1736 } } // namespace v8::internal
1733 1737
1734 #endif // V8_TARGET_ARCH_X64 1738 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698