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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 293 |
294 // Handle construction of an empty array. | 294 // Handle construction of an empty array. |
295 AllocateEmptyJSArray(masm, | 295 AllocateEmptyJSArray(masm, |
296 r1, | 296 r1, |
297 r2, | 297 r2, |
298 r3, | 298 r3, |
299 r4, | 299 r4, |
300 r5, | 300 r5, |
301 JSArray::kPreallocatedArrayElements, | 301 JSArray::kPreallocatedArrayElements, |
302 call_generic_code); | 302 call_generic_code); |
303 __ IncrementCounter(&Counters::array_function_native, 1, r3, r4); | 303 __ IncrementCounter(&COUNTER(array_function_native), 1, r3, r4); |
304 // Setup return value, remove receiver from stack and return. | 304 // Setup return value, remove receiver from stack and return. |
305 __ mov(r0, r2); | 305 __ mov(r0, r2); |
306 __ add(sp, sp, Operand(kPointerSize)); | 306 __ add(sp, sp, Operand(kPointerSize)); |
307 __ Jump(lr); | 307 __ Jump(lr); |
308 | 308 |
309 // Check for one argument. Bail out if argument is not smi or if it is | 309 // Check for one argument. Bail out if argument is not smi or if it is |
310 // negative. | 310 // negative. |
311 __ bind(&argc_one_or_more); | 311 __ bind(&argc_one_or_more); |
312 __ cmp(r0, Operand(1)); | 312 __ cmp(r0, Operand(1)); |
313 __ b(ne, &argc_two_or_more); | 313 __ b(ne, &argc_two_or_more); |
(...skipping 15 matching lines...) Expand all Loading... |
329 AllocateJSArray(masm, | 329 AllocateJSArray(masm, |
330 r1, | 330 r1, |
331 r2, | 331 r2, |
332 r3, | 332 r3, |
333 r4, | 333 r4, |
334 r5, | 334 r5, |
335 r6, | 335 r6, |
336 r7, | 336 r7, |
337 true, | 337 true, |
338 call_generic_code); | 338 call_generic_code); |
339 __ IncrementCounter(&Counters::array_function_native, 1, r2, r4); | 339 __ IncrementCounter(&COUNTER(array_function_native), 1, r2, r4); |
340 // Setup return value, remove receiver and argument from stack and return. | 340 // Setup return value, remove receiver and argument from stack and return. |
341 __ mov(r0, r3); | 341 __ mov(r0, r3); |
342 __ add(sp, sp, Operand(2 * kPointerSize)); | 342 __ add(sp, sp, Operand(2 * kPointerSize)); |
343 __ Jump(lr); | 343 __ Jump(lr); |
344 | 344 |
345 // Handle construction of an array from a list of arguments. | 345 // Handle construction of an array from a list of arguments. |
346 __ bind(&argc_two_or_more); | 346 __ bind(&argc_two_or_more); |
347 __ mov(r2, Operand(r0, LSL, kSmiTagSize)); // Convet argc to a smi. | 347 __ mov(r2, Operand(r0, LSL, kSmiTagSize)); // Convet argc to a smi. |
348 | 348 |
349 // r0: argc | 349 // r0: argc |
350 // r1: constructor | 350 // r1: constructor |
351 // r2: array_size (smi) | 351 // r2: array_size (smi) |
352 // sp[0]: last argument | 352 // sp[0]: last argument |
353 AllocateJSArray(masm, | 353 AllocateJSArray(masm, |
354 r1, | 354 r1, |
355 r2, | 355 r2, |
356 r3, | 356 r3, |
357 r4, | 357 r4, |
358 r5, | 358 r5, |
359 r6, | 359 r6, |
360 r7, | 360 r7, |
361 false, | 361 false, |
362 call_generic_code); | 362 call_generic_code); |
363 __ IncrementCounter(&Counters::array_function_native, 1, r2, r6); | 363 __ IncrementCounter(&COUNTER(array_function_native), 1, r2, r6); |
364 | 364 |
365 // Fill arguments as array elements. Copy from the top of the stack (last | 365 // Fill arguments as array elements. Copy from the top of the stack (last |
366 // element) to the array backing store filling it backwards. Note: | 366 // element) to the array backing store filling it backwards. Note: |
367 // elements_array_end points after the backing store therefore PreIndex is | 367 // elements_array_end points after the backing store therefore PreIndex is |
368 // used when filling the backing store. | 368 // used when filling the backing store. |
369 // r0: argc | 369 // r0: argc |
370 // r3: JSArray | 370 // r3: JSArray |
371 // r4: elements_array storage start (untagged) | 371 // r4: elements_array storage start (untagged) |
372 // r5: elements_array_end (untagged) | 372 // r5: elements_array_end (untagged) |
373 // sp[0]: last argument | 373 // sp[0]: last argument |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 // return. | 771 // return. |
772 __ bind(&exit); | 772 __ bind(&exit); |
773 // r0: result | 773 // r0: result |
774 // sp[0]: receiver (newly allocated object) | 774 // sp[0]: receiver (newly allocated object) |
775 // sp[1]: constructor function | 775 // sp[1]: constructor function |
776 // sp[2]: number of arguments (smi-tagged) | 776 // sp[2]: number of arguments (smi-tagged) |
777 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); | 777 __ ldr(r1, MemOperand(sp, 2 * kPointerSize)); |
778 __ LeaveConstructFrame(); | 778 __ LeaveConstructFrame(); |
779 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); | 779 __ add(sp, sp, Operand(r1, LSL, kPointerSizeLog2 - 1)); |
780 __ add(sp, sp, Operand(kPointerSize)); | 780 __ add(sp, sp, Operand(kPointerSize)); |
781 __ IncrementCounter(&Counters::constructed_objects, 1, r1, r2); | 781 __ IncrementCounter(&COUNTER(constructed_objects), 1, r1, r2); |
782 __ Jump(lr); | 782 __ Jump(lr); |
783 } | 783 } |
784 | 784 |
785 | 785 |
786 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 786 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
787 bool is_construct) { | 787 bool is_construct) { |
788 // Called from Generate_JS_Entry | 788 // Called from Generate_JS_Entry |
789 // r0: code entry | 789 // r0: code entry |
790 // r1: function | 790 // r1: function |
791 // r2: receiver | 791 // r2: receiver |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1262 // Dont adapt arguments. | 1262 // Dont adapt arguments. |
1263 // ------------------------------------------- | 1263 // ------------------------------------------- |
1264 __ bind(&dont_adapt_arguments); | 1264 __ bind(&dont_adapt_arguments); |
1265 __ Jump(r3); | 1265 __ Jump(r3); |
1266 } | 1266 } |
1267 | 1267 |
1268 | 1268 |
1269 #undef __ | 1269 #undef __ |
1270 | 1270 |
1271 } } // namespace v8::internal | 1271 } } // namespace v8::internal |
OLD | NEW |