| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2176 // Non-initializing assignments to consts are ignored. | 2176 // Non-initializing assignments to consts are ignored. |
| 2177 } | 2177 } |
| 2178 | 2178 |
| 2179 | 2179 |
| 2180 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { | 2180 void FullCodeGenerator::EmitNamedPropertyAssignment(Assignment* expr) { |
| 2181 // Assignment to a property, using a named store IC. | 2181 // Assignment to a property, using a named store IC. |
| 2182 Property* prop = expr->target()->AsProperty(); | 2182 Property* prop = expr->target()->AsProperty(); |
| 2183 ASSERT(prop != NULL); | 2183 ASSERT(prop != NULL); |
| 2184 ASSERT(prop->key()->AsLiteral() != NULL); | 2184 ASSERT(prop->key()->AsLiteral() != NULL); |
| 2185 | 2185 |
| 2186 // If the assignment starts a block of assignments to the same object, | |
| 2187 // change to slow case to avoid the quadratic behavior of repeatedly | |
| 2188 // adding fast properties. | |
| 2189 if (expr->starts_initialization_block()) { | |
| 2190 __ push(result_register()); | |
| 2191 __ ldr(ip, MemOperand(sp, kPointerSize)); // Receiver is now under value. | |
| 2192 __ push(ip); | |
| 2193 __ CallRuntime(Runtime::kToSlowProperties, 1); | |
| 2194 __ pop(result_register()); | |
| 2195 } | |
| 2196 | |
| 2197 // Record source code position before IC call. | 2186 // Record source code position before IC call. |
| 2198 SetSourcePosition(expr->position()); | 2187 SetSourcePosition(expr->position()); |
| 2199 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); | 2188 __ mov(r2, Operand(prop->key()->AsLiteral()->handle())); |
| 2200 // Load receiver to r1. Leave a copy in the stack if needed for turning the | 2189 __ pop(r1); |
| 2201 // receiver into fast case. | |
| 2202 if (expr->ends_initialization_block()) { | |
| 2203 __ ldr(r1, MemOperand(sp)); | |
| 2204 } else { | |
| 2205 __ pop(r1); | |
| 2206 } | |
| 2207 | 2190 |
| 2208 Handle<Code> ic = is_classic_mode() | 2191 Handle<Code> ic = is_classic_mode() |
| 2209 ? isolate()->builtins()->StoreIC_Initialize() | 2192 ? isolate()->builtins()->StoreIC_Initialize() |
| 2210 : isolate()->builtins()->StoreIC_Initialize_Strict(); | 2193 : isolate()->builtins()->StoreIC_Initialize_Strict(); |
| 2211 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); | 2194 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); |
| 2212 | 2195 |
| 2213 // If the assignment ends an initialization block, revert to fast case. | |
| 2214 if (expr->ends_initialization_block()) { | |
| 2215 __ push(r0); // Result of assignment, saved even if not needed. | |
| 2216 // Receiver is under the result value. | |
| 2217 __ ldr(ip, MemOperand(sp, kPointerSize)); | |
| 2218 __ push(ip); | |
| 2219 __ CallRuntime(Runtime::kToFastProperties, 1); | |
| 2220 __ pop(r0); | |
| 2221 __ Drop(1); | |
| 2222 } | |
| 2223 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2196 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 2224 context()->Plug(r0); | 2197 context()->Plug(r0); |
| 2225 } | 2198 } |
| 2226 | 2199 |
| 2227 | 2200 |
| 2228 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { | 2201 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { |
| 2229 // Assignment to a property, using a keyed store IC. | 2202 // Assignment to a property, using a keyed store IC. |
| 2230 | 2203 |
| 2231 // If the assignment starts a block of assignments to the same object, | |
| 2232 // change to slow case to avoid the quadratic behavior of repeatedly | |
| 2233 // adding fast properties. | |
| 2234 if (expr->starts_initialization_block()) { | |
| 2235 __ push(result_register()); | |
| 2236 // Receiver is now under the key and value. | |
| 2237 __ ldr(ip, MemOperand(sp, 2 * kPointerSize)); | |
| 2238 __ push(ip); | |
| 2239 __ CallRuntime(Runtime::kToSlowProperties, 1); | |
| 2240 __ pop(result_register()); | |
| 2241 } | |
| 2242 | |
| 2243 // Record source code position before IC call. | 2204 // Record source code position before IC call. |
| 2244 SetSourcePosition(expr->position()); | 2205 SetSourcePosition(expr->position()); |
| 2245 __ pop(r1); // Key. | 2206 __ pop(r1); // Key. |
| 2246 // Load receiver to r2. Leave a copy in the stack if needed for turning the | 2207 __ pop(r2); |
| 2247 // receiver into fast case. | |
| 2248 if (expr->ends_initialization_block()) { | |
| 2249 __ ldr(r2, MemOperand(sp)); | |
| 2250 } else { | |
| 2251 __ pop(r2); | |
| 2252 } | |
| 2253 | 2208 |
| 2254 Handle<Code> ic = is_classic_mode() | 2209 Handle<Code> ic = is_classic_mode() |
| 2255 ? isolate()->builtins()->KeyedStoreIC_Initialize() | 2210 ? isolate()->builtins()->KeyedStoreIC_Initialize() |
| 2256 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); | 2211 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); |
| 2257 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); | 2212 CallIC(ic, RelocInfo::CODE_TARGET, expr->AssignmentFeedbackId()); |
| 2258 | 2213 |
| 2259 // If the assignment ends an initialization block, revert to fast case. | |
| 2260 if (expr->ends_initialization_block()) { | |
| 2261 __ push(r0); // Result of assignment, saved even if not needed. | |
| 2262 // Receiver is under the result value. | |
| 2263 __ ldr(ip, MemOperand(sp, kPointerSize)); | |
| 2264 __ push(ip); | |
| 2265 __ CallRuntime(Runtime::kToFastProperties, 1); | |
| 2266 __ pop(r0); | |
| 2267 __ Drop(1); | |
| 2268 } | |
| 2269 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); | 2214 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); |
| 2270 context()->Plug(r0); | 2215 context()->Plug(r0); |
| 2271 } | 2216 } |
| 2272 | 2217 |
| 2273 | 2218 |
| 2274 void FullCodeGenerator::VisitProperty(Property* expr) { | 2219 void FullCodeGenerator::VisitProperty(Property* expr) { |
| 2275 Comment cmnt(masm_, "[ Property"); | 2220 Comment cmnt(masm_, "[ Property"); |
| 2276 Expression* key = expr->key(); | 2221 Expression* key = expr->key(); |
| 2277 | 2222 |
| 2278 if (key->IsPropertyName()) { | 2223 if (key->IsPropertyName()) { |
| (...skipping 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4584 *context_length = 0; | 4529 *context_length = 0; |
| 4585 return previous_; | 4530 return previous_; |
| 4586 } | 4531 } |
| 4587 | 4532 |
| 4588 | 4533 |
| 4589 #undef __ | 4534 #undef __ |
| 4590 | 4535 |
| 4591 } } // namespace v8::internal | 4536 } } // namespace v8::internal |
| 4592 | 4537 |
| 4593 #endif // V8_TARGET_ARCH_ARM | 4538 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |