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

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

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 10 years, 1 month 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/disasm-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('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 18 matching lines...) Expand all
29 29
30 #if defined(V8_TARGET_ARCH_ARM) 30 #if defined(V8_TARGET_ARCH_ARM)
31 31
32 #include "code-stubs.h" 32 #include "code-stubs.h"
33 #include "codegen-inl.h" 33 #include "codegen-inl.h"
34 #include "compiler.h" 34 #include "compiler.h"
35 #include "debug.h" 35 #include "debug.h"
36 #include "full-codegen.h" 36 #include "full-codegen.h"
37 #include "parser.h" 37 #include "parser.h"
38 #include "scopes.h" 38 #include "scopes.h"
39 #include "stub-cache.h"
39 40
40 namespace v8 { 41 namespace v8 {
41 namespace internal { 42 namespace internal {
42 43
43 #define __ ACCESS_MASM(masm_) 44 #define __ ACCESS_MASM(masm_)
44 45
45 // Generate code for a JS function. On entry to the function the receiver 46 // Generate code for a JS function. On entry to the function the receiver
46 // and arguments have been pushed on the stack left to right. The actual 47 // and arguments have been pushed on the stack left to right. The actual
47 // argument count matches the formal parameter count expected by the 48 // argument count matches the formal parameter count expected by the
48 // function. 49 // function.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // Visit all the explicit declarations unless there is an illegal 165 // Visit all the explicit declarations unless there is an illegal
165 // redeclaration. 166 // redeclaration.
166 if (scope()->HasIllegalRedeclaration()) { 167 if (scope()->HasIllegalRedeclaration()) {
167 scope()->VisitIllegalRedeclaration(this); 168 scope()->VisitIllegalRedeclaration(this);
168 } else { 169 } else {
169 VisitDeclarations(scope()->declarations()); 170 VisitDeclarations(scope()->declarations());
170 } 171 }
171 } 172 }
172 173
173 // Check the stack for overflow or break request. 174 // Check the stack for overflow or break request.
174 // Put the lr setup instruction in the delay slot. The kInstrSize is
175 // added to the implicit 8 byte offset that always applies to operations
176 // with pc and gives a return address 12 bytes down.
177 { Comment cmnt(masm_, "[ Stack check"); 175 { Comment cmnt(masm_, "[ Stack check");
178 __ LoadRoot(r2, Heap::kStackLimitRootIndex); 176 __ LoadRoot(r2, Heap::kStackLimitRootIndex);
179 __ add(lr, pc, Operand(Assembler::kInstrSize));
180 __ cmp(sp, Operand(r2)); 177 __ cmp(sp, Operand(r2));
181 StackCheckStub stub; 178 StackCheckStub stub;
182 __ mov(pc, 179 __ mov(ip,
183 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()), 180 Operand(reinterpret_cast<intptr_t>(stub.GetCode().location()),
184 RelocInfo::CODE_TARGET), 181 RelocInfo::CODE_TARGET),
185 LeaveCC, 182 LeaveCC,
186 lo); 183 lo);
184 __ Call(ip, lo);
187 } 185 }
188 186
189 if (FLAG_trace) { 187 if (FLAG_trace) {
190 __ CallRuntime(Runtime::kTraceEnter, 0); 188 __ CallRuntime(Runtime::kTraceEnter, 0);
191 } 189 }
192 190
193 { Comment cmnt(masm_, "[ Body"); 191 { Comment cmnt(masm_, "[ Body");
194 ASSERT(loop_depth() == 0); 192 ASSERT(loop_depth() == 0);
195 VisitStatements(function()->body()); 193 VisitStatements(function()->body());
196 ASSERT(loop_depth() == 0); 194 ASSERT(loop_depth() == 0);
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 __ ldr(temp, ContextOperand(next, Context::EXTENSION_INDEX)); 1010 __ ldr(temp, ContextOperand(next, Context::EXTENSION_INDEX));
1013 __ tst(temp, temp); 1011 __ tst(temp, temp);
1014 __ b(ne, slow); 1012 __ b(ne, slow);
1015 // Load next context in chain. 1013 // Load next context in chain.
1016 __ ldr(next, ContextOperand(next, Context::CLOSURE_INDEX)); 1014 __ ldr(next, ContextOperand(next, Context::CLOSURE_INDEX));
1017 __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset)); 1015 __ ldr(next, FieldMemOperand(next, JSFunction::kContextOffset));
1018 __ b(&loop); 1016 __ b(&loop);
1019 __ bind(&fast); 1017 __ bind(&fast);
1020 } 1018 }
1021 1019
1022 __ ldr(r0, CodeGenerator::GlobalObject()); 1020 __ ldr(r0, GlobalObjectOperand());
1023 __ mov(r2, Operand(slot->var()->name())); 1021 __ mov(r2, Operand(slot->var()->name()));
1024 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) 1022 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF)
1025 ? RelocInfo::CODE_TARGET 1023 ? RelocInfo::CODE_TARGET
1026 : RelocInfo::CODE_TARGET_CONTEXT; 1024 : RelocInfo::CODE_TARGET_CONTEXT;
1027 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 1025 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
1028 EmitCallIC(ic, mode); 1026 EmitCallIC(ic, mode);
1029 } 1027 }
1030 1028
1031 1029
1032 void FullCodeGenerator::EmitVariableLoad(Variable* var) { 1030 void FullCodeGenerator::EmitVariableLoad(Variable* var) {
1033 // Four cases: non-this global variables, lookup slots, all other 1031 // Four cases: non-this global variables, lookup slots, all other
1034 // types of slots, and parameters that rewrite to explicit property 1032 // types of slots, and parameters that rewrite to explicit property
1035 // accesses on the arguments object. 1033 // accesses on the arguments object.
1036 Slot* slot = var->AsSlot(); 1034 Slot* slot = var->AsSlot();
1037 Property* property = var->AsProperty(); 1035 Property* property = var->AsProperty();
1038 1036
1039 if (var->is_global() && !var->is_this()) { 1037 if (var->is_global() && !var->is_this()) {
1040 Comment cmnt(masm_, "Global variable"); 1038 Comment cmnt(masm_, "Global variable");
1041 // Use inline caching. Variable name is passed in r2 and the global 1039 // Use inline caching. Variable name is passed in r2 and the global
1042 // object (receiver) in r0. 1040 // object (receiver) in r0.
1043 __ ldr(r0, CodeGenerator::GlobalObject()); 1041 __ ldr(r0, GlobalObjectOperand());
1044 __ mov(r2, Operand(var->name())); 1042 __ mov(r2, Operand(var->name()));
1045 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 1043 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
1046 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT); 1044 EmitCallIC(ic, RelocInfo::CODE_TARGET_CONTEXT);
1047 context()->Plug(r0); 1045 context()->Plug(r0);
1048 1046
1049 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { 1047 } else if (slot != NULL && slot->type() == Slot::LOOKUP) {
1050 Label done, slow; 1048 Label done, slow;
1051 1049
1052 // Generate code for loading from variables potentially shadowed 1050 // Generate code for loading from variables potentially shadowed
1053 // by eval-introduced variables. 1051 // by eval-introduced variables.
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 // here. 1505 // here.
1508 ASSERT(var != NULL); 1506 ASSERT(var != NULL);
1509 ASSERT(var->is_global() || var->AsSlot() != NULL); 1507 ASSERT(var->is_global() || var->AsSlot() != NULL);
1510 1508
1511 if (var->is_global()) { 1509 if (var->is_global()) {
1512 ASSERT(!var->is_this()); 1510 ASSERT(!var->is_this());
1513 // Assignment to a global variable. Use inline caching for the 1511 // Assignment to a global variable. Use inline caching for the
1514 // assignment. Right-hand-side value is passed in r0, variable name in 1512 // assignment. Right-hand-side value is passed in r0, variable name in
1515 // r2, and the global object in r1. 1513 // r2, and the global object in r1.
1516 __ mov(r2, Operand(var->name())); 1514 __ mov(r2, Operand(var->name()));
1517 __ ldr(r1, CodeGenerator::GlobalObject()); 1515 __ ldr(r1, GlobalObjectOperand());
1518 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize)); 1516 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Initialize));
1519 EmitCallIC(ic, RelocInfo::CODE_TARGET); 1517 EmitCallIC(ic, RelocInfo::CODE_TARGET);
1520 1518
1521 } else if (var->mode() != Variable::CONST || op == Token::INIT_CONST) { 1519 } else if (var->mode() != Variable::CONST || op == Token::INIT_CONST) {
1522 // Perform the assignment for non-const variables and for initialization 1520 // Perform the assignment for non-const variables and for initialization
1523 // of const variables. Const assignments are simply skipped. 1521 // of const variables. Const assignments are simply skipped.
1524 Label done; 1522 Label done;
1525 Slot* slot = var->AsSlot(); 1523 Slot* slot = var->AsSlot();
1526 switch (slot->type()) { 1524 switch (slot->type()) {
1527 case Slot::PARAMETER: 1525 case Slot::PARAMETER:
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 { PreserveStatementPositionScope scope(masm()->positions_recorder()); 1689 { PreserveStatementPositionScope scope(masm()->positions_recorder());
1692 for (int i = 0; i < arg_count; i++) { 1690 for (int i = 0; i < arg_count; i++) {
1693 VisitForStackValue(args->at(i)); 1691 VisitForStackValue(args->at(i));
1694 } 1692 }
1695 __ mov(r2, Operand(name)); 1693 __ mov(r2, Operand(name));
1696 } 1694 }
1697 // Record source position for debugger. 1695 // Record source position for debugger.
1698 SetSourcePosition(expr->position(), FORCED_POSITION); 1696 SetSourcePosition(expr->position(), FORCED_POSITION);
1699 // Call the IC initialization code. 1697 // Call the IC initialization code.
1700 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 1698 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1701 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, in_loop); 1699 Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, in_loop);
1702 EmitCallIC(ic, mode); 1700 EmitCallIC(ic, mode);
1703 // Restore context register. 1701 // Restore context register.
1704 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1702 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1705 context()->Plug(r0); 1703 context()->Plug(r0);
1706 } 1704 }
1707 1705
1708 1706
1709 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, 1707 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
1710 Expression* key, 1708 Expression* key,
1711 RelocInfo::Mode mode) { 1709 RelocInfo::Mode mode) {
1710 // Load the key.
1711 VisitForAccumulatorValue(key);
1712
1713 // Swap the name of the function and the receiver on the stack to follow
1714 // the calling convention for call ICs.
1715 __ pop(r1);
1716 __ push(r0);
1717 __ push(r1);
1718
1712 // Code common for calls using the IC. 1719 // Code common for calls using the IC.
1713 ZoneList<Expression*>* args = expr->arguments(); 1720 ZoneList<Expression*>* args = expr->arguments();
1714 int arg_count = args->length(); 1721 int arg_count = args->length();
1715 { PreserveStatementPositionScope scope(masm()->positions_recorder()); 1722 { PreserveStatementPositionScope scope(masm()->positions_recorder());
1716 for (int i = 0; i < arg_count; i++) { 1723 for (int i = 0; i < arg_count; i++) {
1717 VisitForStackValue(args->at(i)); 1724 VisitForStackValue(args->at(i));
1718 } 1725 }
1719 VisitForAccumulatorValue(key);
1720 __ mov(r2, r0);
1721 } 1726 }
1722 // Record source position for debugger. 1727 // Record source position for debugger.
1723 SetSourcePosition(expr->position(), FORCED_POSITION); 1728 SetSourcePosition(expr->position(), FORCED_POSITION);
1724 // Call the IC initialization code. 1729 // Call the IC initialization code.
1725 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 1730 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1726 Handle<Code> ic = CodeGenerator::ComputeKeyedCallInitialize(arg_count, 1731 Handle<Code> ic = StubCache::ComputeKeyedCallInitialize(arg_count, in_loop);
1727 in_loop); 1732 __ ldr(r2, MemOperand(sp, (arg_count + 1) * kPointerSize)); // Key.
1728 EmitCallIC(ic, mode); 1733 EmitCallIC(ic, mode);
1729 // Restore context register. 1734 // Restore context register.
1730 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1735 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1731 context()->Plug(r0); 1736 context()->DropAndPlug(1, r0); // Drop the key still on the stack.
1732 } 1737 }
1733 1738
1734 1739
1735 void FullCodeGenerator::EmitCallWithStub(Call* expr) { 1740 void FullCodeGenerator::EmitCallWithStub(Call* expr) {
1736 // Code common for calls using the call stub. 1741 // Code common for calls using the call stub.
1737 ZoneList<Expression*>* args = expr->arguments(); 1742 ZoneList<Expression*>* args = expr->arguments();
1738 int arg_count = args->length(); 1743 int arg_count = args->length();
1739 { PreserveStatementPositionScope scope(masm()->positions_recorder()); 1744 { PreserveStatementPositionScope scope(masm()->positions_recorder());
1740 for (int i = 0; i < arg_count; i++) { 1745 for (int i = 0; i < arg_count; i++) {
1741 VisitForStackValue(args->at(i)); 1746 VisitForStackValue(args->at(i));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 // Record source position for debugger. 1807 // Record source position for debugger.
1803 SetSourcePosition(expr->position(), FORCED_POSITION); 1808 SetSourcePosition(expr->position(), FORCED_POSITION);
1804 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP; 1809 InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
1805 CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_VALUE); 1810 CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_VALUE);
1806 __ CallStub(&stub); 1811 __ CallStub(&stub);
1807 // Restore context register. 1812 // Restore context register.
1808 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 1813 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1809 context()->DropAndPlug(1, r0); 1814 context()->DropAndPlug(1, r0);
1810 } else if (var != NULL && !var->is_this() && var->is_global()) { 1815 } else if (var != NULL && !var->is_this() && var->is_global()) {
1811 // Push global object as receiver for the call IC. 1816 // Push global object as receiver for the call IC.
1812 __ ldr(r0, CodeGenerator::GlobalObject()); 1817 __ ldr(r0, GlobalObjectOperand());
1813 __ push(r0); 1818 __ push(r0);
1814 EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT); 1819 EmitCallWithIC(expr, var->name(), RelocInfo::CODE_TARGET_CONTEXT);
1815 } else if (var != NULL && var->AsSlot() != NULL && 1820 } else if (var != NULL && var->AsSlot() != NULL &&
1816 var->AsSlot()->type() == Slot::LOOKUP) { 1821 var->AsSlot()->type() == Slot::LOOKUP) {
1817 // Call to a lookup slot (dynamically introduced variable). 1822 // Call to a lookup slot (dynamically introduced variable).
1818 Label slow, done; 1823 Label slow, done;
1819 1824
1820 { PreserveStatementPositionScope scope(masm()->positions_recorder()); 1825 { PreserveStatementPositionScope scope(masm()->positions_recorder());
1821 // Generate code for loading from variables potentially shadowed 1826 // Generate code for loading from variables potentially shadowed
1822 // by eval-introduced variables. 1827 // by eval-introduced variables.
(...skipping 15 matching lines...) Expand all
1838 // If fast case code has been generated, emit code to push the 1843 // If fast case code has been generated, emit code to push the
1839 // function and receiver and have the slow path jump around this 1844 // function and receiver and have the slow path jump around this
1840 // code. 1845 // code.
1841 if (done.is_linked()) { 1846 if (done.is_linked()) {
1842 Label call; 1847 Label call;
1843 __ b(&call); 1848 __ b(&call);
1844 __ bind(&done); 1849 __ bind(&done);
1845 // Push function. 1850 // Push function.
1846 __ push(r0); 1851 __ push(r0);
1847 // Push global receiver. 1852 // Push global receiver.
1848 __ ldr(r1, CodeGenerator::GlobalObject()); 1853 __ ldr(r1, GlobalObjectOperand());
1849 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); 1854 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
1850 __ push(r1); 1855 __ push(r1);
1851 __ bind(&call); 1856 __ bind(&call);
1852 } 1857 }
1853 1858
1854 EmitCallWithStub(expr); 1859 EmitCallWithStub(expr);
1855 } else if (fun->AsProperty() != NULL) { 1860 } else if (fun->AsProperty() != NULL) {
1856 // Call to an object property. 1861 // Call to an object property.
1857 Property* prop = fun->AsProperty(); 1862 Property* prop = fun->AsProperty();
1858 Literal* key = prop->key()->AsLiteral(); 1863 Literal* key = prop->key()->AsLiteral();
(...skipping 13 matching lines...) Expand all
1872 if (prop->is_synthetic()) { 1877 if (prop->is_synthetic()) {
1873 { PreserveStatementPositionScope scope(masm()->positions_recorder()); 1878 { PreserveStatementPositionScope scope(masm()->positions_recorder());
1874 VisitForAccumulatorValue(prop->key()); 1879 VisitForAccumulatorValue(prop->key());
1875 } 1880 }
1876 // Record source code position for IC call. 1881 // Record source code position for IC call.
1877 SetSourcePosition(prop->position(), FORCED_POSITION); 1882 SetSourcePosition(prop->position(), FORCED_POSITION);
1878 __ pop(r1); // We do not need to keep the receiver. 1883 __ pop(r1); // We do not need to keep the receiver.
1879 1884
1880 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); 1885 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
1881 EmitCallIC(ic, RelocInfo::CODE_TARGET); 1886 EmitCallIC(ic, RelocInfo::CODE_TARGET);
1882 __ ldr(r1, CodeGenerator::GlobalObject()); 1887 __ ldr(r1, GlobalObjectOperand());
1883 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); 1888 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
1884 __ Push(r0, r1); // Function, receiver. 1889 __ Push(r0, r1); // Function, receiver.
1885 EmitCallWithStub(expr); 1890 EmitCallWithStub(expr);
1886 } else { 1891 } else {
1887 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET); 1892 EmitKeyedCallWithIC(expr, prop->key(), RelocInfo::CODE_TARGET);
1888 } 1893 }
1889 } 1894 }
1890 } else { 1895 } else {
1891 // Call to some other expression. If the expression is an anonymous 1896 // Call to some other expression. If the expression is an anonymous
1892 // function literal not called in a loop, mark it as one that should 1897 // function literal not called in a loop, mark it as one that should
1893 // also use the fast code generator. 1898 // also use the fast code generator.
1894 FunctionLiteral* lit = fun->AsFunctionLiteral(); 1899 FunctionLiteral* lit = fun->AsFunctionLiteral();
1895 if (lit != NULL && 1900 if (lit != NULL &&
1896 lit->name()->Equals(Heap::empty_string()) && 1901 lit->name()->Equals(Heap::empty_string()) &&
1897 loop_depth() == 0) { 1902 loop_depth() == 0) {
1898 lit->set_try_full_codegen(true); 1903 lit->set_try_full_codegen(true);
1899 } 1904 }
1900 1905
1901 { PreserveStatementPositionScope scope(masm()->positions_recorder()); 1906 { PreserveStatementPositionScope scope(masm()->positions_recorder());
1902 VisitForStackValue(fun); 1907 VisitForStackValue(fun);
1903 } 1908 }
1904 // Load global receiver object. 1909 // Load global receiver object.
1905 __ ldr(r1, CodeGenerator::GlobalObject()); 1910 __ ldr(r1, GlobalObjectOperand());
1906 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset)); 1911 __ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
1907 __ push(r1); 1912 __ push(r1);
1908 // Emit function call. 1913 // Emit function call.
1909 EmitCallWithStub(expr); 1914 EmitCallWithStub(expr);
1910 } 1915 }
1911 } 1916 }
1912 1917
1913 1918
1914 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 1919 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
1915 Comment cmnt(masm_, "[ CallNew"); 1920 Comment cmnt(masm_, "[ CallNew");
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 Comment cmnt(masm_, "[ InlineRuntimeCall"); 2778 Comment cmnt(masm_, "[ InlineRuntimeCall");
2774 EmitInlineRuntimeCall(expr); 2779 EmitInlineRuntimeCall(expr);
2775 return; 2780 return;
2776 } 2781 }
2777 2782
2778 Comment cmnt(masm_, "[ CallRuntime"); 2783 Comment cmnt(masm_, "[ CallRuntime");
2779 ZoneList<Expression*>* args = expr->arguments(); 2784 ZoneList<Expression*>* args = expr->arguments();
2780 2785
2781 if (expr->is_jsruntime()) { 2786 if (expr->is_jsruntime()) {
2782 // Prepare for calling JS runtime function. 2787 // Prepare for calling JS runtime function.
2783 __ ldr(r0, CodeGenerator::GlobalObject()); 2788 __ ldr(r0, GlobalObjectOperand());
2784 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kBuiltinsOffset)); 2789 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kBuiltinsOffset));
2785 __ push(r0); 2790 __ push(r0);
2786 } 2791 }
2787 2792
2788 // Push the arguments ("left-to-right"). 2793 // Push the arguments ("left-to-right").
2789 int arg_count = args->length(); 2794 int arg_count = args->length();
2790 for (int i = 0; i < arg_count; i++) { 2795 for (int i = 0; i < arg_count; i++) {
2791 VisitForStackValue(args->at(i)); 2796 VisitForStackValue(args->at(i));
2792 } 2797 }
2793 2798
2794 if (expr->is_jsruntime()) { 2799 if (expr->is_jsruntime()) {
2795 // Call the JS runtime function. 2800 // Call the JS runtime function.
2796 __ mov(r2, Operand(expr->name())); 2801 __ mov(r2, Operand(expr->name()));
2797 Handle<Code> ic = CodeGenerator::ComputeCallInitialize(arg_count, 2802 Handle<Code> ic = StubCache::ComputeCallInitialize(arg_count, NOT_IN_LOOP);
2798 NOT_IN_LOOP);
2799 EmitCallIC(ic, RelocInfo::CODE_TARGET); 2803 EmitCallIC(ic, RelocInfo::CODE_TARGET);
2800 // Restore context register. 2804 // Restore context register.
2801 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2805 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2802 } else { 2806 } else {
2803 // Call the C runtime function. 2807 // Call the C runtime function.
2804 __ CallRuntime(expr->function(), arg_count); 2808 __ CallRuntime(expr->function(), arg_count);
2805 } 2809 }
2806 context()->Plug(r0); 2810 context()->Plug(r0);
2807 } 2811 }
2808 2812
(...skipping 16 matching lines...) Expand all
2825 // Result of deleting non-global, non-dynamic variables is false. 2829 // Result of deleting non-global, non-dynamic variables is false.
2826 // The subexpression does not have side effects. 2830 // The subexpression does not have side effects.
2827 context()->Plug(false); 2831 context()->Plug(false);
2828 } else { 2832 } else {
2829 // Property or variable reference. Call the delete builtin with 2833 // Property or variable reference. Call the delete builtin with
2830 // object and property name as arguments. 2834 // object and property name as arguments.
2831 if (prop != NULL) { 2835 if (prop != NULL) {
2832 VisitForStackValue(prop->obj()); 2836 VisitForStackValue(prop->obj());
2833 VisitForStackValue(prop->key()); 2837 VisitForStackValue(prop->key());
2834 } else if (var->is_global()) { 2838 } else if (var->is_global()) {
2835 __ ldr(r1, CodeGenerator::GlobalObject()); 2839 __ ldr(r1, GlobalObjectOperand());
2836 __ mov(r0, Operand(var->name())); 2840 __ mov(r0, Operand(var->name()));
2837 __ Push(r1, r0); 2841 __ Push(r1, r0);
2838 } else { 2842 } else {
2839 // Non-global variable. Call the runtime to look up the context 2843 // Non-global variable. Call the runtime to look up the context
2840 // where the variable was introduced. 2844 // where the variable was introduced.
2841 __ push(context_register()); 2845 __ push(context_register());
2842 __ mov(r2, Operand(var->name())); 2846 __ mov(r2, Operand(var->name()));
2843 __ push(r2); 2847 __ push(r2);
2844 __ CallRuntime(Runtime::kLookupContext, 2); 2848 __ CallRuntime(Runtime::kLookupContext, 2);
2845 __ push(r0); 2849 __ push(r0);
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
3091 } 3095 }
3092 } 3096 }
3093 3097
3094 3098
3095 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { 3099 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
3096 ASSERT(!context()->IsEffect()); 3100 ASSERT(!context()->IsEffect());
3097 ASSERT(!context()->IsTest()); 3101 ASSERT(!context()->IsTest());
3098 VariableProxy* proxy = expr->AsVariableProxy(); 3102 VariableProxy* proxy = expr->AsVariableProxy();
3099 if (proxy != NULL && !proxy->var()->is_this() && proxy->var()->is_global()) { 3103 if (proxy != NULL && !proxy->var()->is_this() && proxy->var()->is_global()) {
3100 Comment cmnt(masm_, "Global variable"); 3104 Comment cmnt(masm_, "Global variable");
3101 __ ldr(r0, CodeGenerator::GlobalObject()); 3105 __ ldr(r0, GlobalObjectOperand());
3102 __ mov(r2, Operand(proxy->name())); 3106 __ mov(r2, Operand(proxy->name()));
3103 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); 3107 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
3104 // Use a regular load, not a contextual load, to avoid a reference 3108 // Use a regular load, not a contextual load, to avoid a reference
3105 // error. 3109 // error.
3106 EmitCallIC(ic, RelocInfo::CODE_TARGET); 3110 EmitCallIC(ic, RelocInfo::CODE_TARGET);
3107 context()->Plug(r0); 3111 context()->Plug(r0);
3108 } else if (proxy != NULL && 3112 } else if (proxy != NULL &&
3109 proxy->var()->AsSlot() != NULL && 3113 proxy->var()->AsSlot() != NULL &&
3110 proxy->var()->AsSlot()->type() == Slot::LOOKUP) { 3114 proxy->var()->AsSlot()->type() == Slot::LOOKUP) {
3111 Label done, slow; 3115 Label done, slow;
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
3422 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. 3426 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value.
3423 __ add(pc, r1, Operand(masm_->CodeObject())); 3427 __ add(pc, r1, Operand(masm_->CodeObject()));
3424 } 3428 }
3425 3429
3426 3430
3427 #undef __ 3431 #undef __
3428 3432
3429 } } // namespace v8::internal 3433 } } // namespace v8::internal
3430 3434
3431 #endif // V8_TARGET_ARCH_ARM 3435 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/disasm-arm.cc ('k') | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698