OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); | 254 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); |
255 __ mov(r0, scratch1); | 255 __ mov(r0, scratch1); |
256 __ Ret(); | 256 __ Ret(); |
257 } | 257 } |
258 | 258 |
259 | 259 |
260 // Generate StoreField code, value is passed in r0 register. | 260 // Generate StoreField code, value is passed in r0 register. |
261 // After executing generated code, the receiver_reg and name_reg | 261 // After executing generated code, the receiver_reg and name_reg |
262 // may be clobbered. | 262 // may be clobbered. |
263 void StubCompiler::GenerateStoreField(MacroAssembler* masm, | 263 void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
264 Builtins::Name storage_extend, | |
265 JSObject* object, | 264 JSObject* object, |
266 int index, | 265 int index, |
267 Map* transition, | 266 Map* transition, |
268 Register receiver_reg, | 267 Register receiver_reg, |
269 Register name_reg, | 268 Register name_reg, |
270 Register scratch, | 269 Register scratch, |
271 Label* miss_label) { | 270 Label* miss_label) { |
272 // r0 : value | 271 // r0 : value |
273 Label exit; | 272 Label exit; |
274 | 273 |
(...skipping 12 matching lines...) Expand all Loading... |
287 } | 286 } |
288 | 287 |
289 // Stub never generated for non-global objects that require access | 288 // Stub never generated for non-global objects that require access |
290 // checks. | 289 // checks. |
291 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); | 290 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded()); |
292 | 291 |
293 // Perform map transition for the receiver if necessary. | 292 // Perform map transition for the receiver if necessary. |
294 if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { | 293 if ((transition != NULL) && (object->map()->unused_property_fields() == 0)) { |
295 // The properties must be extended before we can store the value. | 294 // The properties must be extended before we can store the value. |
296 // We jump to a runtime call that extends the properties array. | 295 // We jump to a runtime call that extends the properties array. |
| 296 __ push(receiver_reg); |
297 __ mov(r2, Operand(Handle<Map>(transition))); | 297 __ mov(r2, Operand(Handle<Map>(transition))); |
298 // Please note, if we implement keyed store for arm we need | 298 __ stm(db_w, sp, r2.bit() | r0.bit()); |
299 // to call the Builtins::KeyedStoreIC_ExtendStorage. | 299 __ TailCallRuntime( |
300 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_ExtendStorage)); | 300 ExternalReference(IC_Utility(IC::kSharedStoreIC_ExtendStorage)), |
301 __ Jump(ic, RelocInfo::CODE_TARGET); | 301 3, 1); |
302 return; | 302 return; |
303 } | 303 } |
304 | 304 |
305 if (transition != NULL) { | 305 if (transition != NULL) { |
306 // Update the map of the object; no write barrier updating is | 306 // Update the map of the object; no write barrier updating is |
307 // needed because the map is never in new space. | 307 // needed because the map is never in new space. |
308 __ mov(ip, Operand(Handle<Map>(transition))); | 308 __ mov(ip, Operand(Handle<Map>(transition))); |
309 __ str(ip, FieldMemOperand(receiver_reg, HeapObject::kMapOffset)); | 309 __ str(ip, FieldMemOperand(receiver_reg, HeapObject::kMapOffset)); |
310 } | 310 } |
311 | 311 |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 // -- lr : return address | 1208 // -- lr : return address |
1209 // -- [sp] : receiver | 1209 // -- [sp] : receiver |
1210 // ----------------------------------- | 1210 // ----------------------------------- |
1211 Label miss; | 1211 Label miss; |
1212 | 1212 |
1213 // Get the receiver from the stack. | 1213 // Get the receiver from the stack. |
1214 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); | 1214 __ ldr(r3, MemOperand(sp, 0 * kPointerSize)); |
1215 | 1215 |
1216 // name register might be clobbered. | 1216 // name register might be clobbered. |
1217 GenerateStoreField(masm(), | 1217 GenerateStoreField(masm(), |
1218 Builtins::StoreIC_ExtendStorage, | |
1219 object, | 1218 object, |
1220 index, | 1219 index, |
1221 transition, | 1220 transition, |
1222 r3, r2, r1, | 1221 r3, r2, r1, |
1223 &miss); | 1222 &miss); |
1224 __ bind(&miss); | 1223 __ bind(&miss); |
1225 __ mov(r2, Operand(Handle<String>(name))); // restore name | 1224 __ mov(r2, Operand(Handle<String>(name))); // restore name |
1226 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 1225 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
1227 __ Jump(ic, RelocInfo::CODE_TARGET); | 1226 __ Jump(ic, RelocInfo::CODE_TARGET); |
1228 | 1227 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 __ IncrementCounter(&Counters::keyed_store_field, 1, r1, r3); | 1711 __ IncrementCounter(&Counters::keyed_store_field, 1, r1, r3); |
1713 | 1712 |
1714 // Check that the name has not changed. | 1713 // Check that the name has not changed. |
1715 __ cmp(r2, Operand(Handle<String>(name))); | 1714 __ cmp(r2, Operand(Handle<String>(name))); |
1716 __ b(ne, &miss); | 1715 __ b(ne, &miss); |
1717 | 1716 |
1718 // Load receiver from the stack. | 1717 // Load receiver from the stack. |
1719 __ ldr(r3, MemOperand(sp)); | 1718 __ ldr(r3, MemOperand(sp)); |
1720 // r1 is used as scratch register, r3 and r2 might be clobbered. | 1719 // r1 is used as scratch register, r3 and r2 might be clobbered. |
1721 GenerateStoreField(masm(), | 1720 GenerateStoreField(masm(), |
1722 Builtins::StoreIC_ExtendStorage, | |
1723 object, | 1721 object, |
1724 index, | 1722 index, |
1725 transition, | 1723 transition, |
1726 r3, r2, r1, | 1724 r3, r2, r1, |
1727 &miss); | 1725 &miss); |
1728 __ bind(&miss); | 1726 __ bind(&miss); |
1729 | 1727 |
1730 __ DecrementCounter(&Counters::keyed_store_field, 1, r1, r3); | 1728 __ DecrementCounter(&Counters::keyed_store_field, 1, r1, r3); |
1731 __ mov(r2, Operand(Handle<String>(name))); // restore name register. | 1729 __ mov(r2, Operand(Handle<String>(name))); // restore name register. |
1732 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 1730 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); | 1874 __ Jump(generic_construct_stub, RelocInfo::CODE_TARGET); |
1877 | 1875 |
1878 // Return the generated code. | 1876 // Return the generated code. |
1879 return GetCode(); | 1877 return GetCode(); |
1880 } | 1878 } |
1881 | 1879 |
1882 | 1880 |
1883 #undef __ | 1881 #undef __ |
1884 | 1882 |
1885 } } // namespace v8::internal | 1883 } } // namespace v8::internal |
OLD | NEW |