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

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

Issue 3136032: Simplify the way constructors are called and avoid pushing... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 EmitCallWithStub(expr); 1693 EmitCallWithStub(expr);
1694 } 1694 }
1695 } 1695 }
1696 1696
1697 1697
1698 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 1698 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
1699 Comment cmnt(masm_, "[ CallNew"); 1699 Comment cmnt(masm_, "[ CallNew");
1700 // According to ECMA-262, section 11.2.2, page 44, the function 1700 // According to ECMA-262, section 11.2.2, page 44, the function
1701 // expression in new calls must be evaluated before the 1701 // expression in new calls must be evaluated before the
1702 // arguments. 1702 // arguments.
1703 // Push function on the stack. 1703
1704 // Push constructor on the stack. If it's not a function it's used as
1705 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
1706 // ignored.
1704 VisitForValue(expr->expression(), kStack); 1707 VisitForValue(expr->expression(), kStack);
1705 1708
1706 // Push global object (receiver).
1707 __ ldr(r0, CodeGenerator::GlobalObject());
1708 __ push(r0);
1709 // Push the arguments ("left-to-right") on the stack. 1709 // Push the arguments ("left-to-right") on the stack.
1710 ZoneList<Expression*>* args = expr->arguments(); 1710 ZoneList<Expression*>* args = expr->arguments();
1711 int arg_count = args->length(); 1711 int arg_count = args->length();
1712 for (int i = 0; i < arg_count; i++) { 1712 for (int i = 0; i < arg_count; i++) {
1713 VisitForValue(args->at(i), kStack); 1713 VisitForValue(args->at(i), kStack);
1714 } 1714 }
1715 1715
1716 // Call the construct call builtin that handles allocation and 1716 // Call the construct call builtin that handles allocation and
1717 // constructor invocation. 1717 // constructor invocation.
1718 SetSourcePosition(expr->position()); 1718 SetSourcePosition(expr->position());
1719 1719
1720 // Load function, arg_count into r1 and r0. 1720 // Load function and argument count into r1 and r0.
1721 __ mov(r0, Operand(arg_count)); 1721 __ mov(r0, Operand(arg_count));
1722 // Function is in sp[arg_count + 1]. 1722 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize));
1723 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
1724 1723
1725 Handle<Code> construct_builtin(Builtins::builtin(Builtins::JSConstructCall)); 1724 Handle<Code> construct_builtin(Builtins::builtin(Builtins::JSConstructCall));
1726 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL); 1725 __ Call(construct_builtin, RelocInfo::CONSTRUCT_CALL);
1727 1726 Apply(context_, r0);
1728 // Replace function on TOS with result in r0, or pop it.
1729 DropAndApply(1, context_, r0);
1730 } 1727 }
1731 1728
1732 1729
1733 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) { 1730 void FullCodeGenerator::EmitIsSmi(ZoneList<Expression*>* args) {
1734 ASSERT(args->length() == 1); 1731 ASSERT(args->length() == 1);
1735 1732
1736 VisitForValue(args->at(0), kAccumulator); 1733 VisitForValue(args->at(0), kAccumulator);
1737 1734
1738 Label materialize_true, materialize_false; 1735 Label materialize_true, materialize_false;
1739 Label* if_true = NULL; 1736 Label* if_true = NULL;
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
3154 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 3151 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
3155 __ add(pc, r1, Operand(masm_->CodeObject())); 3152 __ add(pc, r1, Operand(masm_->CodeObject()));
3156 } 3153 }
3157 3154
3158 3155
3159 #undef __ 3156 #undef __
3160 3157
3161 } } // namespace v8::internal 3158 } } // namespace v8::internal
3162 3159
3163 #endif // V8_TARGET_ARCH_ARM 3160 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698