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

Side by Side Diff: src/arm/builtins-arm.cc

Issue 9015023: Undo allocation of half-formed array during elements transition (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 months 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 | « no previous file | src/ia32/builtins-ia32.cc » ('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 2011 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
11 // with the distribution. 11 // with the distribution.
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // sp[0]: last argument 309 // sp[0]: last argument
310 // This function is used for both construct and normal calls of Array. The only 310 // This function is used for both construct and normal calls of Array. The only
311 // difference between handling a construct call and a normal call is that for a 311 // difference between handling a construct call and a normal call is that for a
312 // construct call the constructor function in r1 needs to be preserved for 312 // construct call the constructor function in r1 needs to be preserved for
313 // entering the generic code. In both cases argc in r0 needs to be preserved. 313 // entering the generic code. In both cases argc in r0 needs to be preserved.
314 // Both registers are preserved by this code so no need to differentiate between 314 // Both registers are preserved by this code so no need to differentiate between
315 // construct call and normal call. 315 // construct call and normal call.
316 static void ArrayNativeCode(MacroAssembler* masm, 316 static void ArrayNativeCode(MacroAssembler* masm,
317 Label* call_generic_code) { 317 Label* call_generic_code) {
318 Counters* counters = masm->isolate()->counters(); 318 Counters* counters = masm->isolate()->counters();
319 Label argc_one_or_more, argc_two_or_more, not_empty_array, empty_array; 319 Label argc_one_or_more, argc_two_or_more, not_empty_array, empty_array,
320 has_non_smi_element;
320 321
321 // Check for array construction with zero arguments or one. 322 // Check for array construction with zero arguments or one.
322 __ cmp(r0, Operand(0, RelocInfo::NONE)); 323 __ cmp(r0, Operand(0, RelocInfo::NONE));
323 __ b(ne, &argc_one_or_more); 324 __ b(ne, &argc_one_or_more);
324 325
325 // Handle construction of an empty array. 326 // Handle construction of an empty array.
326 __ bind(&empty_array); 327 __ bind(&empty_array);
327 AllocateEmptyJSArray(masm, 328 AllocateEmptyJSArray(masm,
328 r1, 329 r1,
329 r2, 330 r2,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // r3: JSArray 409 // r3: JSArray
409 // r4: elements_array storage start (untagged) 410 // r4: elements_array storage start (untagged)
410 // r5: elements_array_end (untagged) 411 // r5: elements_array_end (untagged)
411 // sp[0]: last argument 412 // sp[0]: last argument
412 Label loop, entry; 413 Label loop, entry;
413 __ mov(r7, sp); 414 __ mov(r7, sp);
414 __ jmp(&entry); 415 __ jmp(&entry);
415 __ bind(&loop); 416 __ bind(&loop);
416 __ ldr(r2, MemOperand(r7, kPointerSize, PostIndex)); 417 __ ldr(r2, MemOperand(r7, kPointerSize, PostIndex));
417 if (FLAG_smi_only_arrays) { 418 if (FLAG_smi_only_arrays) {
418 __ JumpIfNotSmi(r2, call_generic_code); 419 __ JumpIfNotSmi(r2, &has_non_smi_element);
419 } 420 }
420 __ str(r2, MemOperand(r5, -kPointerSize, PreIndex)); 421 __ str(r2, MemOperand(r5, -kPointerSize, PreIndex));
421 __ bind(&entry); 422 __ bind(&entry);
422 __ cmp(r4, r5); 423 __ cmp(r4, r5);
423 __ b(lt, &loop); 424 __ b(lt, &loop);
424 __ mov(sp, r7); 425 __ mov(sp, r7);
425 426
426 // Remove caller arguments and receiver from the stack, setup return value and 427 // Remove caller arguments and receiver from the stack, setup return value and
427 // return. 428 // return.
428 // r0: argc 429 // r0: argc
429 // r3: JSArray 430 // r3: JSArray
430 // sp[0]: receiver 431 // sp[0]: receiver
431 __ add(sp, sp, Operand(kPointerSize)); 432 __ add(sp, sp, Operand(kPointerSize));
432 __ mov(r0, r3); 433 __ mov(r0, r3);
433 __ Jump(lr); 434 __ Jump(lr);
435
436 __ bind(&has_non_smi_element);
437 __ UndoAllocationInNewSpace(r3, r4);
438 __ b(call_generic_code);
434 } 439 }
435 440
436 441
437 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) { 442 void Builtins::Generate_InternalArrayCode(MacroAssembler* masm) {
438 // ----------- S t a t e ------------- 443 // ----------- S t a t e -------------
439 // -- r0 : number of arguments 444 // -- r0 : number of arguments
440 // -- lr : return address 445 // -- lr : return address
441 // -- sp[...]: constructor arguments 446 // -- sp[...]: constructor arguments
442 // ----------------------------------- 447 // -----------------------------------
443 Label generic_array_code, one_or_more_arguments, two_or_more_arguments; 448 Label generic_array_code, one_or_more_arguments, two_or_more_arguments;
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1769 __ bind(&dont_adapt_arguments); 1774 __ bind(&dont_adapt_arguments);
1770 __ Jump(r3); 1775 __ Jump(r3);
1771 } 1776 }
1772 1777
1773 1778
1774 #undef __ 1779 #undef __
1775 1780
1776 } } // namespace v8::internal 1781 } } // namespace v8::internal
1777 1782
1778 #endif // V8_TARGET_ARCH_ARM 1783 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698