OLD | NEW |
---|---|
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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
468 __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex), | 468 __ movq(args.GetArgumentOperand(offset - FCA::kIsolateIndex), |
469 kScratchRegister); | 469 kScratchRegister); |
470 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 470 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
471 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex), | 471 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueDefaultValueIndex), |
472 kScratchRegister); | 472 kScratchRegister); |
473 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset), | 473 __ movq(args.GetArgumentOperand(offset - FCA::kReturnValueOffset), |
474 kScratchRegister); | 474 kScratchRegister); |
475 | 475 |
476 // Prepare arguments. | 476 // Prepare arguments. |
477 STATIC_ASSERT(kFastApiCallArguments == 7); | 477 STATIC_ASSERT(kFastApiCallArguments == 7); |
478 __ lea(rax, Operand(rsp, 1 * kPointerSize)); | 478 __ lea(rax, args.GetArgumentOperand(offset - FCA::kHolderIndex)); |
haitao.feng
2013/12/04 08:04:26
Sorry this one was missed from https://codereview.
| |
479 | 479 |
480 GenerateFastApiCallBody(masm, optimization, argc, false); | 480 GenerateFastApiCallBody(masm, optimization, argc, false); |
481 } | 481 } |
482 | 482 |
483 | 483 |
484 // Generate call to api function. | 484 // Generate call to api function. |
485 // This function uses push() to generate smaller, faster code than | 485 // This function uses push() to generate smaller, faster code than |
486 // the version above. It is an optimization that should will be removed | 486 // the version above. It is an optimization that should will be removed |
487 // when api call ICs are generated in hydrogen. | 487 // when api call ICs are generated in hydrogen. |
488 static void GenerateFastApiCall(MacroAssembler* masm, | 488 static void GenerateFastApiCall(MacroAssembler* masm, |
489 const CallOptimization& optimization, | 489 const CallOptimization& optimization, |
490 Register receiver, | 490 Register receiver, |
491 Register scratch1, | 491 Register scratch1, |
492 Register scratch2, | 492 Register scratch2, |
493 Register scratch3, | 493 Register scratch3, |
494 int argc, | 494 int argc, |
495 Register* values) { | 495 Register* values) { |
496 ASSERT(optimization.is_simple_api_call()); | 496 ASSERT(optimization.is_simple_api_call()); |
497 | 497 |
498 // Copy return value. | 498 __ PopReturnAddressTo(scratch1); |
499 __ pop(scratch1); | |
500 | 499 |
501 // receiver | 500 // receiver |
502 __ push(receiver); | 501 __ push(receiver); |
503 | 502 |
504 // Write the arguments to stack frame. | 503 // Write the arguments to stack frame. |
505 for (int i = 0; i < argc; i++) { | 504 for (int i = 0; i < argc; i++) { |
506 Register arg = values[argc-1-i]; | 505 Register arg = values[argc-1-i]; |
507 ASSERT(!receiver.is(arg)); | 506 ASSERT(!receiver.is(arg)); |
508 ASSERT(!scratch1.is(arg)); | 507 ASSERT(!scratch1.is(arg)); |
509 ASSERT(!scratch2.is(arg)); | 508 ASSERT(!scratch2.is(arg)); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 // isolate | 555 // isolate |
557 __ Move(scratch3, | 556 __ Move(scratch3, |
558 ExternalReference::isolate_address(masm->isolate())); | 557 ExternalReference::isolate_address(masm->isolate())); |
559 __ push(scratch3); | 558 __ push(scratch3); |
560 // holder | 559 // holder |
561 __ push(receiver); | 560 __ push(receiver); |
562 | 561 |
563 ASSERT(!scratch1.is(rax)); | 562 ASSERT(!scratch1.is(rax)); |
564 // store receiver address for GenerateFastApiCallBody | 563 // store receiver address for GenerateFastApiCallBody |
565 __ movq(rax, rsp); | 564 __ movq(rax, rsp); |
566 | 565 __ PushReturnAddressFrom(scratch1); |
567 // return address | |
568 __ push(scratch1); | |
569 | 566 |
570 GenerateFastApiCallBody(masm, optimization, argc, true); | 567 GenerateFastApiCallBody(masm, optimization, argc, true); |
571 } | 568 } |
572 | 569 |
573 | 570 |
574 static void GenerateFastApiCallBody(MacroAssembler* masm, | 571 static void GenerateFastApiCallBody(MacroAssembler* masm, |
575 const CallOptimization& optimization, | 572 const CallOptimization& optimization, |
576 int argc, | 573 int argc, |
577 bool restore_context) { | 574 bool restore_context) { |
578 // ----------- S t a t e ------------- | 575 // ----------- S t a t e ------------- |
(...skipping 2332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2911 // ----------------------------------- | 2908 // ----------------------------------- |
2912 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2909 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2913 } | 2910 } |
2914 | 2911 |
2915 | 2912 |
2916 #undef __ | 2913 #undef __ |
2917 | 2914 |
2918 } } // namespace v8::internal | 2915 } } // namespace v8::internal |
2919 | 2916 |
2920 #endif // V8_TARGET_ARCH_X64 | 2917 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |