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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 1533004: Inline %_ArgumentsLength. (Closed)
Patch Set: Created 10 years, 8 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
« no previous file with comments | « no previous file | src/codegen.h » ('j') | src/ia32/codegen-ia32.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3569 matching lines...) Expand 10 before | Expand all | Expand 10 after
3580 __ ldr(r1, MemOperand(r2, StandardFrameConstants::kMarkerOffset)); 3580 __ ldr(r1, MemOperand(r2, StandardFrameConstants::kMarkerOffset));
3581 __ cmp(r1, Operand(Smi::FromInt(StackFrame::CONSTRUCT))); 3581 __ cmp(r1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
3582 cc_reg_ = eq; 3582 cc_reg_ = eq;
3583 } 3583 }
3584 3584
3585 3585
3586 void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) { 3586 void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
3587 VirtualFrame::SpilledScope spilled_scope; 3587 VirtualFrame::SpilledScope spilled_scope;
3588 ASSERT(args->length() == 0); 3588 ASSERT(args->length() == 0);
3589 3589
3590 // Seed the result with the formal parameters count, which will be used 3590 Label exit;
3591 // in case no arguments adaptor frame is found below the current frame. 3591
3592 // Get the number of formal parameters.
3592 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); 3593 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters())));
3593 3594
3594 // Call the shared stub to get to the arguments.length. 3595 // Check if the calling frame is an arguments adaptor frame.
3595 ArgumentsAccessStub stub(ArgumentsAccessStub::READ_LENGTH); 3596 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
3596 frame_->CallStub(&stub, 0); 3597 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
3598 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
3599 __ b(ne, &exit);
3600
3601 // Arguments adaptor case: Read the arguments length from the
3602 // adaptor frame.
3603 __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset));
3604
3605 __ bind(&exit);
3597 frame_->EmitPush(r0); 3606 frame_->EmitPush(r0);
3598 } 3607 }
3599 3608
3600 3609
3601 void CodeGenerator::GenerateArguments(ZoneList<Expression*>* args) { 3610 void CodeGenerator::GenerateArguments(ZoneList<Expression*>* args) {
3602 VirtualFrame::SpilledScope spilled_scope; 3611 VirtualFrame::SpilledScope spilled_scope;
3603 ASSERT(args->length() == 1); 3612 ASSERT(args->length() == 1);
3604 3613
3605 // Satisfy contract with ArgumentsAccessStub: 3614 // Satisfy contract with ArgumentsAccessStub:
3606 // Load the key into r1 and the formal parameters count into r0. 3615 // Load the key into r1 and the formal parameters count into r0.
(...skipping 3177 matching lines...) Expand 10 before | Expand all | Expand 10 after
6784 __ pop(); 6793 __ pop();
6785 __ pop(); 6794 __ pop();
6786 __ mov(pc, Operand(lr)); // Return. 6795 __ mov(pc, Operand(lr)); // Return.
6787 6796
6788 // Slow-case. Tail call builtin. 6797 // Slow-case. Tail call builtin.
6789 __ bind(&slow); 6798 __ bind(&slow);
6790 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS); 6799 __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS);
6791 } 6800 }
6792 6801
6793 6802
6794 void ArgumentsAccessStub::GenerateReadLength(MacroAssembler* masm) {
6795 // Check if the calling frame is an arguments adaptor frame.
6796 Label adaptor;
6797 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
6798 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
6799 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
6800 __ b(eq, &adaptor);
6801
6802 // Nothing to do: The formal number of parameters has already been
6803 // passed in register r0 by calling function. Just return it.
6804 __ Jump(lr);
6805
6806 // Arguments adaptor case: Read the arguments length from the
6807 // adaptor frame and return it.
6808 __ bind(&adaptor);
6809 __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset));
6810 __ Jump(lr);
6811 }
6812
6813
6814 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { 6803 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
6815 // The displacement is the offset of the last parameter (if any) 6804 // The displacement is the offset of the last parameter (if any)
6816 // relative to the frame pointer. 6805 // relative to the frame pointer.
6817 static const int kDisplacement = 6806 static const int kDisplacement =
6818 StandardFrameConstants::kCallerSPOffset - kPointerSize; 6807 StandardFrameConstants::kCallerSPOffset - kPointerSize;
6819 6808
6820 // Check that the key is a smi. 6809 // Check that the key is a smi.
6821 Label slow; 6810 Label slow;
6822 __ BranchOnNotSmi(r1, &slow); 6811 __ BranchOnNotSmi(r1, &slow);
6823 6812
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after
7954 7943
7955 // Just jump to runtime to add the two strings. 7944 // Just jump to runtime to add the two strings.
7956 __ bind(&string_add_runtime); 7945 __ bind(&string_add_runtime);
7957 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 7946 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
7958 } 7947 }
7959 7948
7960 7949
7961 #undef __ 7950 #undef __
7962 7951
7963 } } // namespace v8::internal 7952 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/codegen.h » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698