OLD | NEW |
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 int num_parameters = function_->scope()->num_parameters(); | 98 int num_parameters = function_->scope()->num_parameters(); |
99 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); | 99 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); |
100 __ Jump(lr); | 100 __ Jump(lr); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 | 104 |
105 void FastCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { | 105 void FastCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { |
106 Comment cmnt(masm_, "[ ExpressionStatement"); | 106 Comment cmnt(masm_, "[ ExpressionStatement"); |
107 Visit(stmt->expression()); | 107 Visit(stmt->expression()); |
108 __ pop(); | |
109 } | 108 } |
110 | 109 |
111 | 110 |
112 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { | 111 void FastCodeGenerator::VisitReturnStatement(ReturnStatement* stmt) { |
113 Comment cmnt(masm_, "[ ReturnStatement"); | 112 Comment cmnt(masm_, "[ ReturnStatement"); |
114 Visit(stmt->expression()); | 113 Visit(stmt->expression()); |
115 __ pop(r0); | 114 __ pop(r0); |
116 __ RecordJSReturn(); | 115 __ RecordJSReturn(); |
117 __ mov(sp, fp); | 116 __ mov(sp, fp); |
118 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | 117 __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
119 int num_parameters = function_->scope()->num_parameters(); | 118 int num_parameters = function_->scope()->num_parameters(); |
120 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); | 119 __ add(sp, sp, Operand((num_parameters + 1) * kPointerSize)); |
121 __ Jump(lr); | 120 __ Jump(lr); |
122 } | 121 } |
123 | 122 |
124 | 123 |
125 void FastCodeGenerator::VisitSlot(Slot* expr) { | 124 void FastCodeGenerator::VisitSlot(Slot* expr) { |
126 Comment cmnt(masm_, "[ Slot"); | 125 Comment cmnt(masm_, "[ Slot"); |
127 __ ldr(ip, MemOperand(fp, SlotOffset(expr))); | 126 if (expr->location().is_temporary()) { |
128 __ push(ip); | 127 __ ldr(ip, MemOperand(fp, SlotOffset(expr))); |
| 128 __ push(ip); |
| 129 } else { |
| 130 ASSERT(expr->location().is_nowhere()); |
| 131 } |
129 } | 132 } |
130 | 133 |
131 | 134 |
132 void FastCodeGenerator::VisitLiteral(Literal* expr) { | 135 void FastCodeGenerator::VisitLiteral(Literal* expr) { |
133 Comment cmnt(masm_, "[ Literal"); | 136 Comment cmnt(masm_, "[ Literal"); |
134 __ mov(ip, Operand(expr->handle())); | 137 if (expr->location().is_temporary()) { |
135 __ push(ip); | 138 __ mov(ip, Operand(expr->handle())); |
| 139 __ push(ip); |
| 140 } else { |
| 141 ASSERT(expr->location().is_nowhere()); |
| 142 } |
136 } | 143 } |
137 | 144 |
138 | 145 |
139 void FastCodeGenerator::VisitAssignment(Assignment* expr) { | 146 void FastCodeGenerator::VisitAssignment(Assignment* expr) { |
140 Comment cmnt(masm_, "[ Assignment"); | 147 Comment cmnt(masm_, "[ Assignment"); |
141 ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR); | 148 ASSERT(expr->op() == Token::ASSIGN || expr->op() == Token::INIT_VAR); |
142 | 149 |
143 Visit(expr->value()); | 150 Visit(expr->value()); |
144 | 151 |
145 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); | 152 Variable* var = expr->target()->AsVariableProxy()->AsVariable(); |
146 ASSERT(var != NULL && var->slot() != NULL); | 153 ASSERT(var != NULL && var->slot() != NULL); |
147 __ ldr(ip, MemOperand(sp)); | 154 |
| 155 if (expr->location().is_temporary()) { |
| 156 __ ldr(ip, MemOperand(sp)); |
| 157 } else { |
| 158 ASSERT(expr->location().is_nowhere()); |
| 159 __ pop(ip); |
| 160 } |
148 __ str(ip, MemOperand(fp, SlotOffset(var->slot()))); | 161 __ str(ip, MemOperand(fp, SlotOffset(var->slot()))); |
149 } | 162 } |
150 | 163 |
151 | 164 |
152 } } // namespace v8::internal | 165 } } // namespace v8::internal |
OLD | NEW |