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

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

Issue 93121: Fix bugs 145 and 323, preemption and apply on ARM. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 8 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 | « src/arm/assembler-arm.h ('k') | src/arm/codegen-arm.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 const int kFunctionOffset = 4 * kPointerSize; 410 const int kFunctionOffset = 4 * kPointerSize;
411 411
412 __ EnterInternalFrame(); 412 __ EnterInternalFrame();
413 413
414 __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function 414 __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function
415 __ push(r0); 415 __ push(r0);
416 __ ldr(r0, MemOperand(fp, kArgsOffset)); // get the args array 416 __ ldr(r0, MemOperand(fp, kArgsOffset)); // get the args array
417 __ push(r0); 417 __ push(r0);
418 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_JS); 418 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_JS);
419 419
420 // Eagerly check for stack-overflow before starting to push the arguments. 420 Label no_preemption, retry_preemption;
421 // r0: number of arguments 421 __ bind(&retry_preemption);
422 Label okay;
423 ExternalReference stack_guard_limit_address = 422 ExternalReference stack_guard_limit_address =
424 ExternalReference::address_of_stack_guard_limit(); 423 ExternalReference::address_of_stack_guard_limit();
425 __ mov(r2, Operand(stack_guard_limit_address)); 424 __ mov(r2, Operand(stack_guard_limit_address));
426 __ ldr(r2, MemOperand(r2)); 425 __ ldr(r2, MemOperand(r2));
426 __ cmp(sp, r2);
427 __ b(hi, &no_preemption);
428
429 // We have encountered a preemption or stack overflow already before we push
430 // the array contents. Save r0 which is the Smi-tagged length of the array.
431 __ push(r0);
432
433 // Runtime routines expect at least one argument, so give it a Smi.
434 __ mov(r0, Operand(Smi::FromInt(0)));
435 __ push(r0);
436 __ CallRuntime(Runtime::kStackGuard, 1);
437
438 // Since we returned, it wasn't a stack overflow. Restore r0 and try again.
439 __ pop(r0);
440 __ b(&retry_preemption);
441
442 __ bind(&no_preemption);
443
444 // Eagerly check for stack-overflow before starting to push the arguments.
445 // r0: number of arguments.
446 // r2: stack limit.
447 Label okay;
427 __ sub(r2, sp, r2); 448 __ sub(r2, sp, r2);
428 __ sub(r2, r2, Operand(3 * kPointerSize)); // limit, index, receiver
429 449
430 __ cmp(r2, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); 450 __ cmp(r2, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize));
431 __ b(hi, &okay); 451 __ b(hi, &okay);
432 452
433 // Out of stack space. 453 // Out of stack space.
434 __ ldr(r1, MemOperand(fp, kFunctionOffset)); 454 __ ldr(r1, MemOperand(fp, kFunctionOffset));
435 __ push(r1); 455 __ push(r1);
436 __ push(r0); 456 __ push(r0);
437 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_JS); 457 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_JS);
438 458
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 // Dont adapt arguments. 670 // Dont adapt arguments.
651 // ------------------------------------------- 671 // -------------------------------------------
652 __ bind(&dont_adapt_arguments); 672 __ bind(&dont_adapt_arguments);
653 __ mov(pc, r3); 673 __ mov(pc, r3);
654 } 674 }
655 675
656 676
657 #undef __ 677 #undef __
658 678
659 } } // namespace v8::internal 679 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/assembler-arm.h ('k') | src/arm/codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698