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

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

Issue 201042: Win64 - Allow returning two values from a runtime function. (Closed)
Patch Set: Fixed typo. Created 11 years, 3 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // ----------------------------------- 229 // -----------------------------------
230 230
231 __ movq(rax, Operand(rsp, kPointerSize)); 231 __ movq(rax, Operand(rsp, kPointerSize));
232 __ movq(rcx, Operand(rsp, 2 * kPointerSize)); 232 __ movq(rcx, Operand(rsp, 2 * kPointerSize));
233 __ pop(rbx); 233 __ pop(rbx);
234 __ push(rcx); // receiver 234 __ push(rcx); // receiver
235 __ push(rax); // name 235 __ push(rax); // name
236 __ push(rbx); // return address 236 __ push(rbx); // return address
237 237
238 // Perform tail call to the entry. 238 // Perform tail call to the entry.
239 __ TailCallRuntime(f, 2); 239 __ TailCallRuntime(f, 2, 1);
240 } 240 }
241 241
242 242
243 #ifdef DEBUG 243 #ifdef DEBUG
244 // For use in assert below. 244 // For use in assert below.
245 static int TenToThe(int exponent) { 245 static int TenToThe(int exponent) {
246 ASSERT(exponent <= 9); 246 ASSERT(exponent <= 9);
247 ASSERT(exponent >= 1); 247 ASSERT(exponent >= 1);
248 int answer = 10; 248 int answer = 10;
249 for (int i = 1; i < exponent; i++) answer *= 10; 249 for (int i = 1; i < exponent; i++) answer *= 10;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 // -- rsp[16] : receiver 366 // -- rsp[16] : receiver
367 // ----------------------------------- 367 // -----------------------------------
368 368
369 __ pop(rcx); 369 __ pop(rcx);
370 __ push(Operand(rsp, 1 * kPointerSize)); // receiver 370 __ push(Operand(rsp, 1 * kPointerSize)); // receiver
371 __ push(Operand(rsp, 1 * kPointerSize)); // key 371 __ push(Operand(rsp, 1 * kPointerSize)); // key
372 __ push(rax); // value 372 __ push(rax); // value
373 __ push(rcx); // return address 373 __ push(rcx); // return address
374 374
375 // Do tail-call to runtime routine. 375 // Do tail-call to runtime routine.
376 __ TailCallRuntime(f, 3); 376 __ TailCallRuntime(f, 3, 1);
377 } 377 }
378 378
379 379
380 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) { 380 void KeyedStoreIC::GenerateExtendStorage(MacroAssembler* masm) {
381 // ----------- S t a t e ------------- 381 // ----------- S t a t e -------------
382 // -- rax : value 382 // -- rax : value
383 // -- rcx : transition map 383 // -- rcx : transition map
384 // -- rsp[0] : return address 384 // -- rsp[0] : return address
385 // -- rsp[8] : key 385 // -- rsp[8] : key
386 // -- rsp[16] : receiver 386 // -- rsp[16] : receiver
387 // ----------------------------------- 387 // -----------------------------------
388 388
389 __ pop(rbx); 389 __ pop(rbx);
390 __ push(Operand(rsp, 1 * kPointerSize)); // receiver 390 __ push(Operand(rsp, 1 * kPointerSize)); // receiver
391 __ push(rcx); // transition map 391 __ push(rcx); // transition map
392 __ push(rax); // value 392 __ push(rax); // value
393 __ push(rbx); // return address 393 __ push(rbx); // return address
394 394
395 // Do tail-call to runtime routine. 395 // Do tail-call to runtime routine.
396 __ TailCallRuntime( 396 __ TailCallRuntime(
397 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); 397 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1);
398 } 398 }
399 399
400 400
401 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) { 401 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm) {
402 // ----------- S t a t e ------------- 402 // ----------- S t a t e -------------
403 // -- rax : value 403 // -- rax : value
404 // -- rsp[0] : return address 404 // -- rsp[0] : return address
405 // -- rsp[8] : key 405 // -- rsp[8] : key
406 // -- rsp[16] : receiver 406 // -- rsp[16] : receiver
407 // ----------------------------------- 407 // -----------------------------------
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 453
454 454
455 // Slow case: Push extra copies of the arguments (3). 455 // Slow case: Push extra copies of the arguments (3).
456 __ bind(&slow); 456 __ bind(&slow);
457 __ pop(rcx); 457 __ pop(rcx);
458 __ push(Operand(rsp, 1 * kPointerSize)); 458 __ push(Operand(rsp, 1 * kPointerSize));
459 __ push(Operand(rsp, 1 * kPointerSize)); 459 __ push(Operand(rsp, 1 * kPointerSize));
460 __ push(rax); 460 __ push(rax);
461 __ push(rcx); 461 __ push(rcx);
462 // Do tail-call to runtime routine. 462 // Do tail-call to runtime routine.
463 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3); 463 __ TailCallRuntime(ExternalReference(Runtime::kSetProperty), 3, 1);
464 464
465 465
466 // Extra capacity case: Check if there is extra capacity to 466 // Extra capacity case: Check if there is extra capacity to
467 // perform the store and update the length. Used for adding one 467 // perform the store and update the length. Used for adding one
468 // element to the array by writing to array[array.length]. 468 // element to the array by writing to array[array.length].
469 __ bind(&extra); 469 __ bind(&extra);
470 // rax: value 470 // rax: value
471 // rdx: JSArray 471 // rdx: JSArray
472 // rcx: FixedArray 472 // rcx: FixedArray
473 // rbx: index (as a smi) 473 // rbx: index (as a smi)
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 __ movq(rbx, Operand(rsp, (argc + 2) * kPointerSize)); 525 __ movq(rbx, Operand(rsp, (argc + 2) * kPointerSize));
526 526
527 // Enter an internal frame. 527 // Enter an internal frame.
528 __ EnterInternalFrame(); 528 __ EnterInternalFrame();
529 529
530 // Push the receiver and the name of the function. 530 // Push the receiver and the name of the function.
531 __ push(rdx); 531 __ push(rdx);
532 __ push(rbx); 532 __ push(rbx);
533 533
534 // Call the entry. 534 // Call the entry.
535 CEntryStub stub; 535 CEntryStub stub(1);
536 __ movq(rax, Immediate(2)); 536 __ movq(rax, Immediate(2));
537 __ movq(rbx, f); 537 __ movq(rbx, f);
538 __ CallStub(&stub); 538 __ CallStub(&stub);
539 539
540 // Move result to rdi and exit the internal frame. 540 // Move result to rdi and exit the internal frame.
541 __ movq(rdi, rax); 541 __ movq(rdi, rax);
542 __ LeaveInternalFrame(); 542 __ LeaveInternalFrame();
543 543
544 // Check if the receiver is a global object of some sort. 544 // Check if the receiver is a global object of some sort.
545 Label invoke, global; 545 Label invoke, global;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 // ----------------------------------- 756 // -----------------------------------
757 757
758 __ movq(rax, Operand(rsp, kPointerSize)); 758 __ movq(rax, Operand(rsp, kPointerSize));
759 759
760 __ pop(rbx); 760 __ pop(rbx);
761 __ push(rax); // receiver 761 __ push(rax); // receiver
762 __ push(rcx); // name 762 __ push(rcx); // name
763 __ push(rbx); // return address 763 __ push(rbx); // return address
764 764
765 // Perform tail call to the entry. 765 // Perform tail call to the entry.
766 __ TailCallRuntime(f, 2); 766 __ TailCallRuntime(f, 2, 1);
767 } 767 }
768 768
769 769
770 void LoadIC::GenerateArrayLength(MacroAssembler* masm) { 770 void LoadIC::GenerateArrayLength(MacroAssembler* masm) {
771 // ----------- S t a t e ------------- 771 // ----------- S t a t e -------------
772 // -- rcx : name 772 // -- rcx : name
773 // -- rsp[0] : return address 773 // -- rsp[0] : return address
774 // -- rsp[8] : receiver 774 // -- rsp[8] : receiver
775 // ----------------------------------- 775 // -----------------------------------
776 776
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 // -- rsp[0] : return address 933 // -- rsp[0] : return address
934 // -- rsp[8] : receiver 934 // -- rsp[8] : receiver
935 // ----------------------------------- 935 // -----------------------------------
936 __ pop(rbx); 936 __ pop(rbx);
937 __ push(Operand(rsp, 0)); // receiver 937 __ push(Operand(rsp, 0)); // receiver
938 __ push(rcx); // name 938 __ push(rcx); // name
939 __ push(rax); // value 939 __ push(rax); // value
940 __ push(rbx); // return address 940 __ push(rbx); // return address
941 941
942 // Perform tail call to the entry. 942 // Perform tail call to the entry.
943 __ TailCallRuntime(f, 3); 943 __ TailCallRuntime(f, 3, 1);
944 } 944 }
945 945
946 void StoreIC::GenerateExtendStorage(MacroAssembler* masm) { 946 void StoreIC::GenerateExtendStorage(MacroAssembler* masm) {
947 // ----------- S t a t e ------------- 947 // ----------- S t a t e -------------
948 // -- rax : value 948 // -- rax : value
949 // -- rcx : Map (target of map transition) 949 // -- rcx : Map (target of map transition)
950 // -- rsp[0] : return address 950 // -- rsp[0] : return address
951 // -- rsp[8] : receiver 951 // -- rsp[8] : receiver
952 // ----------------------------------- 952 // -----------------------------------
953 953
954 __ pop(rbx); 954 __ pop(rbx);
955 __ push(Operand(rsp, 0)); // receiver 955 __ push(Operand(rsp, 0)); // receiver
956 __ push(rcx); // transition map 956 __ push(rcx); // transition map
957 __ push(rax); // value 957 __ push(rax); // value
958 __ push(rbx); // return address 958 __ push(rbx); // return address
959 959
960 // Perform tail call to the entry. 960 // Perform tail call to the entry.
961 __ TailCallRuntime( 961 __ TailCallRuntime(
962 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); 962 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3, 1);
963 } 963 }
964 964
965 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) { 965 void StoreIC::GenerateMegamorphic(MacroAssembler* masm) {
966 // ----------- S t a t e ------------- 966 // ----------- S t a t e -------------
967 // -- rax : value 967 // -- rax : value
968 // -- rcx : name 968 // -- rcx : name
969 // -- rsp[0] : return address 969 // -- rsp[0] : return address
970 // -- rsp[8] : receiver 970 // -- rsp[8] : receiver
971 // ----------------------------------- 971 // -----------------------------------
972 972
973 // Get the receiver from the stack and probe the stub cache. 973 // Get the receiver from the stack and probe the stub cache.
974 __ movq(rdx, Operand(rsp, kPointerSize)); 974 __ movq(rdx, Operand(rsp, kPointerSize));
975 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC, 975 Code::Flags flags = Code::ComputeFlags(Code::STORE_IC,
976 NOT_IN_LOOP, 976 NOT_IN_LOOP,
977 MONOMORPHIC); 977 MONOMORPHIC);
978 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg); 978 StubCache::GenerateProbe(masm, flags, rdx, rcx, rbx, no_reg);
979 979
980 // Cache miss: Jump to runtime. 980 // Cache miss: Jump to runtime.
981 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss))); 981 Generate(masm, ExternalReference(IC_Utility(kStoreIC_Miss)));
982 } 982 }
983 983
984 984
985 #undef __ 985 #undef __
986 986
987 987
988 } } // namespace v8::internal 988 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698