OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3765 __ bind(&check_frame_marker); | 3765 __ bind(&check_frame_marker); |
3766 __ SmiCompare(Operand(fp.reg(), StandardFrameConstants::kMarkerOffset), | 3766 __ SmiCompare(Operand(fp.reg(), StandardFrameConstants::kMarkerOffset), |
3767 Smi::FromInt(StackFrame::CONSTRUCT)); | 3767 Smi::FromInt(StackFrame::CONSTRUCT)); |
3768 fp.Unuse(); | 3768 fp.Unuse(); |
3769 destination()->Split(equal); | 3769 destination()->Split(equal); |
3770 } | 3770 } |
3771 | 3771 |
3772 | 3772 |
3773 void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) { | 3773 void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) { |
3774 ASSERT(args->length() == 0); | 3774 ASSERT(args->length() == 0); |
3775 // ArgumentsAccessStub takes the parameter count as an input argument | 3775 |
3776 // in register eax. Create a constant result for it. | 3776 Result fp = allocator_->Allocate(); |
3777 Result count(Handle<Smi>(Smi::FromInt(scope()->num_parameters()))); | 3777 Result result = allocator_->Allocate(); |
3778 // Call the shared stub to get to the arguments.length. | 3778 ASSERT(fp.is_valid() && result.is_valid()); |
3779 ArgumentsAccessStub stub(ArgumentsAccessStub::READ_LENGTH); | 3779 |
3780 Result result = frame_->CallStub(&stub, &count); | 3780 Label exit; |
| 3781 |
| 3782 // Get the number of formal parameters. |
| 3783 __ Move(result.reg(), Smi::FromInt(scope()->num_parameters())); |
| 3784 |
| 3785 // Check if the calling frame is an arguments adaptor frame. |
| 3786 __ movq(fp.reg(), Operand(rbp, StandardFrameConstants::kCallerFPOffset)); |
| 3787 __ SmiCompare(Operand(fp.reg(), StandardFrameConstants::kContextOffset), |
| 3788 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
| 3789 __ j(not_equal, &exit); |
| 3790 |
| 3791 // Arguments adaptor case: Read the arguments length from the |
| 3792 // adaptor frame. |
| 3793 __ movq(result.reg(), |
| 3794 Operand(fp.reg(), ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 3795 |
| 3796 __ bind(&exit); |
| 3797 result.set_type_info(TypeInfo::Smi()); |
| 3798 if (FLAG_debug_code) { |
| 3799 __ AbortIfNotSmi(result.reg(), "Computed arguments.length is not a smi."); |
| 3800 } |
3781 frame_->Push(&result); | 3801 frame_->Push(&result); |
3782 } | 3802 } |
3783 | 3803 |
3784 | 3804 |
3785 void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) { | 3805 void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) { |
3786 Comment(masm_, "[ GenerateFastCharCodeAt"); | 3806 Comment(masm_, "[ GenerateFastCharCodeAt"); |
3787 ASSERT(args->length() == 2); | 3807 ASSERT(args->length() == 2); |
3788 | 3808 |
3789 Label slow_case; | 3809 Label slow_case; |
3790 Label end; | 3810 Label end; |
(...skipping 3989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7780 // Slow-case: Handle non-smi or out-of-bounds access to arguments | 7800 // Slow-case: Handle non-smi or out-of-bounds access to arguments |
7781 // by calling the runtime system. | 7801 // by calling the runtime system. |
7782 __ bind(&slow); | 7802 __ bind(&slow); |
7783 __ pop(rbx); // Return address. | 7803 __ pop(rbx); // Return address. |
7784 __ push(rdx); | 7804 __ push(rdx); |
7785 __ push(rbx); | 7805 __ push(rbx); |
7786 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); | 7806 __ TailCallRuntime(Runtime::kGetArgumentsProperty, 1, 1); |
7787 } | 7807 } |
7788 | 7808 |
7789 | 7809 |
7790 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) { | |
7791 // Check if the calling frame is an arguments adaptor frame. | |
7792 Label adaptor; | |
7793 __ movq(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); | |
7794 __ SmiCompare(Operand(rdx, StandardFrameConstants::kContextOffset), | |
7795 Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | |
7796 | |
7797 // Arguments adaptor case: Read the arguments length from the | |
7798 // adaptor frame and return it. | |
7799 // Otherwise nothing to do: The number of formal parameters has already been | |
7800 // passed in register eax by calling function. Just return it. | |
7801 __ cmovq(equal, rax, | |
7802 Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); | |
7803 __ ret(0); | |
7804 } | |
7805 | |
7806 | |
7807 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { | 7810 void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) { |
7808 // Check that stack should contain next handler, frame pointer, state and | 7811 // Check that stack should contain next handler, frame pointer, state and |
7809 // return address in that order. | 7812 // return address in that order. |
7810 ASSERT_EQ(StackHandlerConstants::kFPOffset + kPointerSize, | 7813 ASSERT_EQ(StackHandlerConstants::kFPOffset + kPointerSize, |
7811 StackHandlerConstants::kStateOffset); | 7814 StackHandlerConstants::kStateOffset); |
7812 ASSERT_EQ(StackHandlerConstants::kStateOffset + kPointerSize, | 7815 ASSERT_EQ(StackHandlerConstants::kStateOffset + kPointerSize, |
7813 StackHandlerConstants::kPCOffset); | 7816 StackHandlerConstants::kPCOffset); |
7814 | 7817 |
7815 ExternalReference handler_address(Top::k_handler_address); | 7818 ExternalReference handler_address(Top::k_handler_address); |
7816 __ movq(kScratchRegister, handler_address); | 7819 __ movq(kScratchRegister, handler_address); |
(...skipping 2224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10041 // Call the function from C++. | 10044 // Call the function from C++. |
10042 return FUNCTION_CAST<ModuloFunction>(buffer); | 10045 return FUNCTION_CAST<ModuloFunction>(buffer); |
10043 } | 10046 } |
10044 | 10047 |
10045 #endif | 10048 #endif |
10046 | 10049 |
10047 | 10050 |
10048 #undef __ | 10051 #undef __ |
10049 | 10052 |
10050 } } // namespace v8::internal | 10053 } } // namespace v8::internal |
OLD | NEW |