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

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

Issue 352583008: Rollback to Version 3.28.4 (based on bleeding_edge revision r22031) (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 6 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
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-codegen-x64.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/ic-inl.h" 10 #include "src/ic-inl.h"
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 } 325 }
326 326
327 327
328 328
329 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { 329 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
330 // ----------- S t a t e ------------- 330 // ----------- S t a t e -------------
331 // -- rax : key 331 // -- rax : key
332 // -- rdx : receiver 332 // -- rdx : receiver
333 // -- rsp[0] : return address 333 // -- rsp[0] : return address
334 // ----------------------------------- 334 // -----------------------------------
335 ASSERT(rdx.is(ReceiverRegister()));
336 ASSERT(rax.is(NameRegister()));
337 Label slow, check_name, index_smi, index_name, property_array_property; 335 Label slow, check_name, index_smi, index_name, property_array_property;
338 Label probe_dictionary, check_number_dictionary; 336 Label probe_dictionary, check_number_dictionary;
339 337
340 // Check that the key is a smi. 338 // Check that the key is a smi.
341 __ JumpIfNotSmi(rax, &check_name); 339 __ JumpIfNotSmi(rax, &check_name);
342 __ bind(&index_smi); 340 __ bind(&index_smi);
343 // Now the key is known to be a smi. This place is also jumped to from below 341 // Now the key is known to be a smi. This place is also jumped to from below
344 // where a numeric string is converted to a smi. 342 // where a numeric string is converted to a smi.
345 343
346 GenerateKeyedLoadReceiverCheck( 344 GenerateKeyedLoadReceiverCheck(
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1); 483 __ IncrementCounter(counters->keyed_load_generic_symbol(), 1);
486 __ ret(0); 484 __ ret(0);
487 485
488 __ bind(&index_name); 486 __ bind(&index_name);
489 __ IndexFromHash(rbx, rax); 487 __ IndexFromHash(rbx, rax);
490 __ jmp(&index_smi); 488 __ jmp(&index_smi);
491 } 489 }
492 490
493 491
494 void KeyedLoadIC::GenerateString(MacroAssembler* masm) { 492 void KeyedLoadIC::GenerateString(MacroAssembler* masm) {
495 // Return address is on the stack. 493 // ----------- S t a t e -------------
494 // -- rax : key
495 // -- rdx : receiver
496 // -- rsp[0] : return address
497 // -----------------------------------
496 Label miss; 498 Label miss;
497 499
498 Register receiver = ReceiverRegister(); 500 Register receiver = rdx;
499 Register index = NameRegister(); 501 Register index = rax;
500 Register scratch = rcx; 502 Register scratch = rcx;
501 Register result = rax; 503 Register result = rax;
502 ASSERT(!scratch.is(receiver) && !scratch.is(index));
503 504
504 StringCharAtGenerator char_at_generator(receiver, 505 StringCharAtGenerator char_at_generator(receiver,
505 index, 506 index,
506 scratch, 507 scratch,
507 result, 508 result,
508 &miss, // When not a string. 509 &miss, // When not a string.
509 &miss, // When not a number. 510 &miss, // When not a number.
510 &miss, // When index out of range. 511 &miss, // When index out of range.
511 STRING_INDEX_IS_ARRAY_INDEX); 512 STRING_INDEX_IS_ARRAY_INDEX);
512 char_at_generator.GenerateFast(masm); 513 char_at_generator.GenerateFast(masm);
513 __ ret(0); 514 __ ret(0);
514 515
515 StubRuntimeCallHelper call_helper; 516 StubRuntimeCallHelper call_helper;
516 char_at_generator.GenerateSlow(masm, call_helper); 517 char_at_generator.GenerateSlow(masm, call_helper);
517 518
518 __ bind(&miss); 519 __ bind(&miss);
519 GenerateMiss(masm); 520 GenerateMiss(masm);
520 } 521 }
521 522
522 523
523 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { 524 void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
524 // Return address is on the stack. 525 // ----------- S t a t e -------------
526 // -- rax : key
527 // -- rdx : receiver
528 // -- rsp[0] : return address
529 // -----------------------------------
525 Label slow; 530 Label slow;
526 531
527 Register receiver = ReceiverRegister();
528 Register key = NameRegister();
529 Register scratch = rcx;
530 ASSERT(!scratch.is(receiver) && !scratch.is(key));
531
532 // Check that the receiver isn't a smi. 532 // Check that the receiver isn't a smi.
533 __ JumpIfSmi(receiver, &slow); 533 __ JumpIfSmi(rdx, &slow);
534 534
535 // Check that the key is an array index, that is Uint32. 535 // Check that the key is an array index, that is Uint32.
536 STATIC_ASSERT(kSmiValueSize <= 32); 536 STATIC_ASSERT(kSmiValueSize <= 32);
537 __ JumpUnlessNonNegativeSmi(key, &slow); 537 __ JumpUnlessNonNegativeSmi(rax, &slow);
538 538
539 // Get the map of the receiver. 539 // Get the map of the receiver.
540 __ movp(scratch, FieldOperand(receiver, HeapObject::kMapOffset)); 540 __ movp(rcx, FieldOperand(rdx, HeapObject::kMapOffset));
541 541
542 // Check that it has indexed interceptor and access checks 542 // Check that it has indexed interceptor and access checks
543 // are not enabled for this object. 543 // are not enabled for this object.
544 __ movb(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); 544 __ movb(rcx, FieldOperand(rcx, Map::kBitFieldOffset));
545 __ andb(scratch, Immediate(kSlowCaseBitFieldMask)); 545 __ andb(rcx, Immediate(kSlowCaseBitFieldMask));
546 __ cmpb(scratch, Immediate(1 << Map::kHasIndexedInterceptor)); 546 __ cmpb(rcx, Immediate(1 << Map::kHasIndexedInterceptor));
547 __ j(not_zero, &slow); 547 __ j(not_zero, &slow);
548 548
549 // Everything is fine, call runtime. 549 // Everything is fine, call runtime.
550 __ PopReturnAddressTo(scratch); 550 __ PopReturnAddressTo(rcx);
551 __ Push(receiver); // receiver 551 __ Push(rdx); // receiver
552 __ Push(key); // key 552 __ Push(rax); // key
553 __ PushReturnAddressFrom(scratch); 553 __ PushReturnAddressFrom(rcx);
554 554
555 // Perform tail call to the entry. 555 // Perform tail call to the entry.
556 __ TailCallExternalReference( 556 __ TailCallExternalReference(
557 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor), 557 ExternalReference(IC_Utility(kKeyedLoadPropertyWithInterceptor),
558 masm->isolate()), 558 masm->isolate()),
559 2, 559 2,
560 1); 560 1);
561 561
562 __ bind(&slow); 562 __ bind(&slow);
563 GenerateMiss(masm); 563 GenerateMiss(masm);
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 FixedArray::kHeaderSize); 885 FixedArray::kHeaderSize);
886 } 886 }
887 887
888 888
889 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { 889 void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
890 // ----------- S t a t e ------------- 890 // ----------- S t a t e -------------
891 // -- rax : key 891 // -- rax : key
892 // -- rdx : receiver 892 // -- rdx : receiver
893 // -- rsp[0] : return address 893 // -- rsp[0] : return address
894 // ----------------------------------- 894 // -----------------------------------
895 ASSERT(rdx.is(ReceiverRegister()));
896 ASSERT(rax.is(NameRegister()));
897 Label slow, notin; 895 Label slow, notin;
898 Operand mapped_location = 896 Operand mapped_location =
899 GenerateMappedArgumentsLookup( 897 GenerateMappedArgumentsLookup(
900 masm, rdx, rax, rbx, rcx, rdi, &notin, &slow); 898 masm, rdx, rax, rbx, rcx, rdi, &notin, &slow);
901 __ movp(rax, mapped_location); 899 __ movp(rax, mapped_location);
902 __ Ret(); 900 __ Ret();
903 __ bind(&notin); 901 __ bind(&notin);
904 // The unmapped lookup expects that the parameter map is in rbx. 902 // The unmapped lookup expects that the parameter map is in rbx.
905 Operand unmapped_location = 903 Operand unmapped_location =
906 GenerateUnmappedArgumentsLookup(masm, rax, rbx, rcx, &slow); 904 GenerateUnmappedArgumentsLookup(masm, rax, rbx, rcx, &slow);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 GenerateMiss(masm); 949 GenerateMiss(masm);
952 } 950 }
953 951
954 952
955 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { 953 void LoadIC::GenerateMegamorphic(MacroAssembler* masm) {
956 // ----------- S t a t e ------------- 954 // ----------- S t a t e -------------
957 // -- rax : receiver 955 // -- rax : receiver
958 // -- rcx : name 956 // -- rcx : name
959 // -- rsp[0] : return address 957 // -- rsp[0] : return address
960 // ----------------------------------- 958 // -----------------------------------
961 ASSERT(rax.is(ReceiverRegister()));
962 ASSERT(rcx.is(NameRegister()));
963 959
964 // Probe the stub cache. 960 // Probe the stub cache.
965 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC); 961 Code::Flags flags = Code::ComputeHandlerFlags(Code::LOAD_IC);
966 masm->isolate()->stub_cache()->GenerateProbe( 962 masm->isolate()->stub_cache()->GenerateProbe(
967 masm, flags, rax, rcx, rbx, rdx); 963 masm, flags, rax, rcx, rbx, rdx);
968 964
969 GenerateMiss(masm); 965 GenerateMiss(masm);
970 } 966 }
971 967
972 968
973 void LoadIC::GenerateNormal(MacroAssembler* masm) { 969 void LoadIC::GenerateNormal(MacroAssembler* masm) {
974 // ----------- S t a t e ------------- 970 // ----------- S t a t e -------------
975 // -- rax : receiver 971 // -- rax : receiver
976 // -- rcx : name 972 // -- rcx : name
977 // -- rsp[0] : return address 973 // -- rsp[0] : return address
978 // ----------------------------------- 974 // -----------------------------------
979 ASSERT(rax.is(ReceiverRegister()));
980 ASSERT(rcx.is(NameRegister()));
981 Label miss, slow; 975 Label miss, slow;
982 976
983 GenerateNameDictionaryReceiverCheck(masm, rax, rdx, rbx, &miss); 977 GenerateNameDictionaryReceiverCheck(masm, rax, rdx, rbx, &miss);
984 978
985 // rdx: elements 979 // rdx: elements
986 // Search the dictionary placing the result in rax. 980 // Search the dictionary placing the result in rax.
987 GenerateDictionaryLoad(masm, &slow, rdx, rcx, rbx, rdi, rax); 981 GenerateDictionaryLoad(masm, &slow, rdx, rcx, rbx, rdi, rax);
988 __ ret(0); 982 __ ret(0);
989 983
990 // Dictionary load failed, go slow (but don't miss). 984 // Dictionary load failed, go slow (but don't miss).
991 __ bind(&slow); 985 __ bind(&slow);
992 GenerateRuntimeGetProperty(masm); 986 GenerateRuntimeGetProperty(masm);
993 987
994 // Cache miss: Jump to runtime. 988 // Cache miss: Jump to runtime.
995 __ bind(&miss); 989 __ bind(&miss);
996 GenerateMiss(masm); 990 GenerateMiss(masm);
997 } 991 }
998 992
999 993
1000 // A register that isn't one of the parameters to the load ic.
1001 static const Register LoadIC_TempRegister() { return rbx; }
1002
1003
1004 static const Register KeyedLoadIC_TempRegister() {
1005 return rbx;
1006 }
1007
1008
1009 void LoadIC::GenerateMiss(MacroAssembler* masm) { 994 void LoadIC::GenerateMiss(MacroAssembler* masm) {
1010 // The return address is on the stack. 995 // ----------- S t a t e -------------
996 // -- rax : receiver
997 // -- rcx : name
998 // -- rsp[0] : return address
999 // -----------------------------------
1011 1000
1012 Counters* counters = masm->isolate()->counters(); 1001 Counters* counters = masm->isolate()->counters();
1013 __ IncrementCounter(counters->load_miss(), 1); 1002 __ IncrementCounter(counters->load_miss(), 1);
1014 1003
1015 __ PopReturnAddressTo(LoadIC_TempRegister()); 1004 __ PopReturnAddressTo(rbx);
1016 __ Push(ReceiverRegister()); // receiver 1005 __ Push(rax); // receiver
1017 __ Push(NameRegister()); // name 1006 __ Push(rcx); // name
1018 __ PushReturnAddressFrom(LoadIC_TempRegister()); 1007 __ PushReturnAddressFrom(rbx);
1019 1008
1020 // Perform tail call to the entry. 1009 // Perform tail call to the entry.
1021 ExternalReference ref = 1010 ExternalReference ref =
1022 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); 1011 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate());
1023 __ TailCallExternalReference(ref, 2, 1); 1012 __ TailCallExternalReference(ref, 2, 1);
1024 } 1013 }
1025 1014
1026 1015
1027 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 1016 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
1028 // The return address is on the stack. 1017 // ----------- S t a t e -------------
1018 // -- rax : receiver
1019 // -- rcx : name
1020 // -- rsp[0] : return address
1021 // -----------------------------------
1029 1022
1030 __ PopReturnAddressTo(LoadIC_TempRegister()); 1023 __ PopReturnAddressTo(rbx);
1031 __ Push(ReceiverRegister()); // receiver 1024 __ Push(rax); // receiver
1032 __ Push(NameRegister()); // name 1025 __ Push(rcx); // name
1033 __ PushReturnAddressFrom(LoadIC_TempRegister()); 1026 __ PushReturnAddressFrom(rbx);
1034 1027
1035 // Perform tail call to the entry. 1028 // Perform tail call to the entry.
1036 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); 1029 __ TailCallRuntime(Runtime::kGetProperty, 2, 1);
1037 } 1030 }
1038 1031
1039 1032
1040 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { 1033 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
1041 // The return address is on the stack. 1034 // ----------- S t a t e -------------
1035 // -- rax : key
1036 // -- rdx : receiver
1037 // -- rsp[0] : return address
1038 // -----------------------------------
1039
1042 Counters* counters = masm->isolate()->counters(); 1040 Counters* counters = masm->isolate()->counters();
1043 __ IncrementCounter(counters->keyed_load_miss(), 1); 1041 __ IncrementCounter(counters->keyed_load_miss(), 1);
1044 1042
1045 __ PopReturnAddressTo(KeyedLoadIC_TempRegister()); 1043 __ PopReturnAddressTo(rbx);
1046 __ Push(ReceiverRegister()); // receiver 1044 __ Push(rdx); // receiver
1047 __ Push(NameRegister()); // name 1045 __ Push(rax); // name
1048 __ PushReturnAddressFrom(KeyedLoadIC_TempRegister()); 1046 __ PushReturnAddressFrom(rbx);
1049 1047
1050 // Perform tail call to the entry. 1048 // Perform tail call to the entry.
1051 ExternalReference ref = 1049 ExternalReference ref =
1052 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); 1050 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate());
1053 __ TailCallExternalReference(ref, 2, 1); 1051 __ TailCallExternalReference(ref, 2, 1);
1054 } 1052 }
1055 1053
1056 1054
1057 // IC register specifications 1055 // IC register specifications
1058 const Register LoadIC::ReceiverRegister() { return rax; } 1056 const Register LoadIC::ReceiverRegister() { return rax; }
1059 const Register LoadIC::NameRegister() { return rcx; } 1057 const Register LoadIC::NameRegister() { return rcx; }
1060 const Register KeyedLoadIC::ReceiverRegister() { return rdx; } 1058 const Register KeyedLoadIC::ReceiverRegister() { return rdx; }
1061 const Register KeyedLoadIC::NameRegister() { return rax; } 1059 const Register KeyedLoadIC::NameRegister() { return rax; }
1062 1060
1063 1061
1064 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { 1062 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
1065 // The return address is on the stack. 1063 // ----------- S t a t e -------------
1064 // -- rax : key
1065 // -- rdx : receiver
1066 // -- rsp[0] : return address
1067 // -----------------------------------
1066 1068
1067 __ PopReturnAddressTo(KeyedLoadIC_TempRegister()); 1069 __ PopReturnAddressTo(rbx);
1068 __ Push(ReceiverRegister()); // receiver 1070 __ Push(rdx); // receiver
1069 __ Push(NameRegister()); // name 1071 __ Push(rax); // name
1070 __ PushReturnAddressFrom(KeyedLoadIC_TempRegister()); 1072 __ PushReturnAddressFrom(rbx);
1071 1073
1072 // Perform tail call to the entry. 1074 // Perform tail call to the entry.
1073 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1); 1075 __ TailCallRuntime(Runtime::kKeyedGetProperty, 2, 1);
1074 } 1076 }
1075 1077
1076 1078
1077 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { 1079 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
1078 // ----------- S t a t e ------------- 1080 // ----------- S t a t e -------------
1079 // -- rax : value 1081 // -- rax : value
1080 // -- rcx : name 1082 // -- rcx : name
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) 1309 Condition cc = (check == ENABLE_INLINED_SMI_CHECK)
1308 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) 1310 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero)
1309 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); 1311 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry);
1310 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); 1312 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc);
1311 } 1313 }
1312 1314
1313 1315
1314 } } // namespace v8::internal 1316 } } // namespace v8::internal
1315 1317
1316 #endif // V8_TARGET_ARCH_X64 1318 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698