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

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

Issue 338017: Remove --check-stack flag from V8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 1 month 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/flag-definitions.h ('k') | src/ia32/codegen-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 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 513 }
514 514
515 515
516 void Builtins::Generate_FunctionApply(MacroAssembler* masm) { 516 void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
517 __ EnterInternalFrame(); 517 __ EnterInternalFrame();
518 518
519 __ push(Operand(ebp, 4 * kPointerSize)); // push this 519 __ push(Operand(ebp, 4 * kPointerSize)); // push this
520 __ push(Operand(ebp, 2 * kPointerSize)); // push arguments 520 __ push(Operand(ebp, 2 * kPointerSize)); // push arguments
521 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); 521 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION);
522 522
523 if (FLAG_check_stack) { 523 // Check the stack for overflow or a break request.
524 // We need to catch preemptions right here, otherwise an unlucky preemption 524 // We need to catch preemptions right here, otherwise an unlucky preemption
525 // could show up as a failed apply. 525 // could show up as a failed apply.
526 ExternalReference stack_guard_limit = 526 ExternalReference stack_guard_limit =
527 ExternalReference::address_of_stack_guard_limit(); 527 ExternalReference::address_of_stack_guard_limit();
528 Label retry_preemption; 528 Label retry_preemption;
529 Label no_preemption; 529 Label no_preemption;
530 __ bind(&retry_preemption); 530 __ bind(&retry_preemption);
531 __ mov(edi, Operand::StaticVariable(stack_guard_limit)); 531 __ mov(edi, Operand::StaticVariable(stack_guard_limit));
532 __ cmp(esp, Operand(edi)); 532 __ cmp(esp, Operand(edi));
533 __ j(above, &no_preemption, taken); 533 __ j(above, &no_preemption, taken);
534 534
535 // Preemption! 535 // Preemption!
536 // Because builtins always remove the receiver from the stack, we 536 // Because builtins always remove the receiver from the stack, we
537 // have to fake one to avoid underflowing the stack. 537 // have to fake one to avoid underflowing the stack.
538 __ push(eax); 538 __ push(eax);
539 __ push(Immediate(Smi::FromInt(0))); 539 __ push(Immediate(Smi::FromInt(0)));
540 540
541 // Do call to runtime routine. 541 // Do call to runtime routine.
542 __ CallRuntime(Runtime::kStackGuard, 1); 542 __ CallRuntime(Runtime::kStackGuard, 1);
543 __ pop(eax); 543 __ pop(eax);
544 __ jmp(&retry_preemption); 544 __ jmp(&retry_preemption);
545 545
546 __ bind(&no_preemption); 546 __ bind(&no_preemption);
547 547
548 Label okay; 548 Label okay;
549 // Make ecx the space we have left. 549 // Make ecx the space we have left.
550 __ mov(ecx, Operand(esp)); 550 __ mov(ecx, Operand(esp));
551 __ sub(ecx, Operand(edi)); 551 __ sub(ecx, Operand(edi));
552 // Make edx the space we need for the array when it is unrolled onto the 552 // Make edx the space we need for the array when it is unrolled onto the
553 // stack. 553 // stack.
554 __ mov(edx, Operand(eax)); 554 __ mov(edx, Operand(eax));
555 __ shl(edx, kPointerSizeLog2 - kSmiTagSize); 555 __ shl(edx, kPointerSizeLog2 - kSmiTagSize);
556 __ cmp(ecx, Operand(edx)); 556 __ cmp(ecx, Operand(edx));
557 __ j(greater, &okay, taken); 557 __ j(greater, &okay, taken);
558 558
559 // Too bad: Out of stack space. 559 // Too bad: Out of stack space.
560 __ push(Operand(ebp, 4 * kPointerSize)); // push this 560 __ push(Operand(ebp, 4 * kPointerSize)); // push this
561 __ push(eax); 561 __ push(eax);
562 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); 562 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION);
563 __ bind(&okay); 563 __ bind(&okay);
564 } 564 // End of stack check.
565 565
566 // Push current index and limit. 566 // Push current index and limit.
567 const int kLimitOffset = 567 const int kLimitOffset =
568 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize; 568 StandardFrameConstants::kExpressionsOffset - 1 * kPointerSize;
569 const int kIndexOffset = kLimitOffset - 1 * kPointerSize; 569 const int kIndexOffset = kLimitOffset - 1 * kPointerSize;
570 __ push(eax); // limit 570 __ push(eax); // limit
571 __ push(Immediate(0)); // index 571 __ push(Immediate(0)); // index
572 572
573 // Change context eagerly to get the right global object if 573 // Change context eagerly to get the right global object if
574 // necessary. 574 // necessary.
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 // Dont adapt arguments. 1224 // Dont adapt arguments.
1225 // ------------------------------------------- 1225 // -------------------------------------------
1226 __ bind(&dont_adapt_arguments); 1226 __ bind(&dont_adapt_arguments);
1227 __ jmp(Operand(edx)); 1227 __ jmp(Operand(edx));
1228 } 1228 }
1229 1229
1230 1230
1231 #undef __ 1231 #undef __
1232 1232
1233 } } // namespace v8::internal 1233 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698