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 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2683 __ lw(result, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2683 __ lw(result, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
2684 __ lw(result, | 2684 __ lw(result, |
2685 MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset)); | 2685 MemOperand(result, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
2686 __ SmiUntag(result); | 2686 __ SmiUntag(result); |
2687 | 2687 |
2688 // Argument length is in result register. | 2688 // Argument length is in result register. |
2689 __ bind(&done); | 2689 __ bind(&done); |
2690 } | 2690 } |
2691 | 2691 |
2692 | 2692 |
2693 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { | 2693 void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { |
2694 Register receiver = ToRegister(instr->receiver()); | 2694 Register receiver = ToRegister(instr->receiver()); |
2695 Register function = ToRegister(instr->function()); | 2695 Register function = ToRegister(instr->function()); |
2696 Register length = ToRegister(instr->length()); | |
2697 Register elements = ToRegister(instr->elements()); | |
2698 Register scratch = scratch0(); | 2696 Register scratch = scratch0(); |
2699 ASSERT(receiver.is(a0)); // Used for parameter count. | |
2700 ASSERT(function.is(a1)); // Required by InvokeFunction. | |
2701 ASSERT(ToRegister(instr->result()).is(v0)); | |
2702 | 2697 |
2703 // If the receiver is null or undefined, we have to pass the global | 2698 // If the receiver is null or undefined, we have to pass the global |
2704 // object as a receiver to normal functions. Values have to be | 2699 // object as a receiver to normal functions. Values have to be |
2705 // passed unchanged to builtins and strict-mode functions. | 2700 // passed unchanged to builtins and strict-mode functions. |
2706 Label global_object, receiver_ok; | 2701 Label global_object, receiver_ok; |
2707 | 2702 |
2708 // Do not transform the receiver to object for strict mode | 2703 // Do not transform the receiver to object for strict mode |
2709 // functions. | 2704 // functions. |
2710 __ lw(scratch, | 2705 __ lw(scratch, |
2711 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); | 2706 FieldMemOperand(function, JSFunction::kSharedFunctionInfoOffset)); |
(...skipping 20 matching lines...) Expand all Loading... |
2732 __ GetObjectType(receiver, scratch, scratch); | 2727 __ GetObjectType(receiver, scratch, scratch); |
2733 DeoptimizeIf(lt, instr->environment(), | 2728 DeoptimizeIf(lt, instr->environment(), |
2734 scratch, Operand(FIRST_SPEC_OBJECT_TYPE)); | 2729 scratch, Operand(FIRST_SPEC_OBJECT_TYPE)); |
2735 __ Branch(&receiver_ok); | 2730 __ Branch(&receiver_ok); |
2736 | 2731 |
2737 __ bind(&global_object); | 2732 __ bind(&global_object); |
2738 __ lw(receiver, GlobalObjectOperand()); | 2733 __ lw(receiver, GlobalObjectOperand()); |
2739 __ lw(receiver, | 2734 __ lw(receiver, |
2740 FieldMemOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); | 2735 FieldMemOperand(receiver, JSGlobalObject::kGlobalReceiverOffset)); |
2741 __ bind(&receiver_ok); | 2736 __ bind(&receiver_ok); |
| 2737 } |
| 2738 |
| 2739 void LCodeGen::DoApplyArguments(LApplyArguments* instr) { |
| 2740 Register receiver = ToRegister(instr->receiver()); |
| 2741 Register function = ToRegister(instr->function()); |
| 2742 Register length = ToRegister(instr->length()); |
| 2743 Register elements = ToRegister(instr->elements()); |
| 2744 Register scratch = scratch0(); |
| 2745 ASSERT(receiver.is(a0)); // Used for parameter count. |
| 2746 ASSERT(function.is(a1)); // Required by InvokeFunction. |
| 2747 ASSERT(ToRegister(instr->result()).is(v0)); |
2742 | 2748 |
2743 // Copy the arguments to this function possibly from the | 2749 // Copy the arguments to this function possibly from the |
2744 // adaptor frame below it. | 2750 // adaptor frame below it. |
2745 const uint32_t kArgumentsLimit = 1 * KB; | 2751 const uint32_t kArgumentsLimit = 1 * KB; |
2746 DeoptimizeIf(hi, instr->environment(), length, Operand(kArgumentsLimit)); | 2752 DeoptimizeIf(hi, instr->environment(), length, Operand(kArgumentsLimit)); |
2747 | 2753 |
2748 // Push the receiver and use the register to keep the original | 2754 // Push the receiver and use the register to keep the original |
2749 // number of arguments. | 2755 // number of arguments. |
2750 __ push(receiver); | 2756 __ push(receiver); |
2751 __ Move(receiver, length); | 2757 __ Move(receiver, length); |
(...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5046 __ Subu(scratch, result, scratch); | 5052 __ Subu(scratch, result, scratch); |
5047 __ lw(result, FieldMemOperand(scratch, | 5053 __ lw(result, FieldMemOperand(scratch, |
5048 FixedArray::kHeaderSize - kPointerSize)); | 5054 FixedArray::kHeaderSize - kPointerSize)); |
5049 __ bind(&done); | 5055 __ bind(&done); |
5050 } | 5056 } |
5051 | 5057 |
5052 | 5058 |
5053 #undef __ | 5059 #undef __ |
5054 | 5060 |
5055 } } // namespace v8::internal | 5061 } } // namespace v8::internal |
OLD | NEW |