Use unsigned comparison for stack checks
We use signed comparison when we compare the difference between SP and stack limit to the size we are going to push, but need to use unsigned comparison when we compare SP and stack limit directly. R=mvstanton@chromium.org Bug: chromium:876210 Change-Id: I3ca5233677c42aebadb78920592a7c6d8e33a825 Reviewed-on: https://chromium-review.googlesource.com/1206870 Reviewed-by: Michael Stanton <mvstanton@chromium.org> Commit-Queue: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#55675}
This commit is contained in:
parent
217cced963
commit
c79fa41870
@ -1860,7 +1860,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
|
|||||||
// (i.e. debug break and preemption) here, so check the "real stack
|
// (i.e. debug break and preemption) here, so check the "real stack
|
||||||
// limit".
|
// limit".
|
||||||
__ CompareRoot(sp, Heap::kRealStackLimitRootIndex);
|
__ CompareRoot(sp, Heap::kRealStackLimitRootIndex);
|
||||||
__ b(gt, &done); // Signed comparison.
|
__ b(hs, &done);
|
||||||
// Restore the stack pointer.
|
// Restore the stack pointer.
|
||||||
__ add(sp, sp, Operand(r4, LSL, kPointerSizeLog2));
|
__ add(sp, sp, Operand(r4, LSL, kPointerSizeLog2));
|
||||||
{
|
{
|
||||||
|
@ -2217,7 +2217,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
|
|||||||
__ Sub(x10, sp, x10);
|
__ Sub(x10, sp, x10);
|
||||||
// Check if the arguments will overflow the stack.
|
// Check if the arguments will overflow the stack.
|
||||||
__ Cmp(x10, Operand(bound_argc, LSL, kPointerSizeLog2));
|
__ Cmp(x10, Operand(bound_argc, LSL, kPointerSizeLog2));
|
||||||
__ B(gt, &done); // Signed comparison.
|
__ B(hs, &done);
|
||||||
__ TailCallRuntime(Runtime::kThrowStackOverflow);
|
__ TailCallRuntime(Runtime::kThrowStackOverflow);
|
||||||
__ Bind(&done);
|
__ Bind(&done);
|
||||||
}
|
}
|
||||||
|
@ -1992,7 +1992,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
|
|||||||
// (i.e. debug break and preemption) here, so check the "real stack
|
// (i.e. debug break and preemption) here, so check the "real stack
|
||||||
// limit".
|
// limit".
|
||||||
__ CompareRoot(esp, ecx, Heap::kRealStackLimitRootIndex);
|
__ CompareRoot(esp, ecx, Heap::kRealStackLimitRootIndex);
|
||||||
__ j(greater, &done, Label::kNear); // Signed comparison.
|
__ j(above_equal, &done, Label::kNear);
|
||||||
// Restore the stack pointer.
|
// Restore the stack pointer.
|
||||||
__ lea(esp, Operand(esp, ebx, times_pointer_size, 0));
|
__ lea(esp, Operand(esp, ebx, times_pointer_size, 0));
|
||||||
{
|
{
|
||||||
|
@ -1864,7 +1864,7 @@ void Builtins::Generate_CallBoundFunctionImpl(MacroAssembler* masm) {
|
|||||||
// Check the stack for overflow. We are not trying to catch interruptions
|
// Check the stack for overflow. We are not trying to catch interruptions
|
||||||
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
||||||
__ LoadRoot(kScratchReg, Heap::kRealStackLimitRootIndex);
|
__ LoadRoot(kScratchReg, Heap::kRealStackLimitRootIndex);
|
||||||
__ Branch(&done, gt, sp, Operand(kScratchReg)); // Signed comparison.
|
__ Branch(&done, hs, sp, Operand(kScratchReg));
|
||||||
// Restore the stack pointer.
|
// Restore the stack pointer.
|
||||||
__ Addu(sp, sp, Operand(t1));
|
__ Addu(sp, sp, Operand(t1));
|
||||||
{
|
{
|
||||||
@ -2022,7 +2022,7 @@ void Builtins::Generate_ConstructBoundFunction(MacroAssembler* masm) {
|
|||||||
// Check the stack for overflow. We are not trying to catch interruptions
|
// Check the stack for overflow. We are not trying to catch interruptions
|
||||||
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
||||||
__ LoadRoot(kScratchReg, Heap::kRealStackLimitRootIndex);
|
__ LoadRoot(kScratchReg, Heap::kRealStackLimitRootIndex);
|
||||||
__ Branch(&done, gt, sp, Operand(kScratchReg)); // Signed comparison.
|
__ Branch(&done, hs, sp, Operand(kScratchReg));
|
||||||
// Restore the stack pointer.
|
// Restore the stack pointer.
|
||||||
__ Addu(sp, sp, Operand(t1));
|
__ Addu(sp, sp, Operand(t1));
|
||||||
{
|
{
|
||||||
|
@ -1884,7 +1884,7 @@ void Builtins::Generate_CallBoundFunctionImpl(MacroAssembler* masm) {
|
|||||||
// Check the stack for overflow. We are not trying to catch interruptions
|
// Check the stack for overflow. We are not trying to catch interruptions
|
||||||
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
||||||
__ LoadRoot(kScratchReg, Heap::kRealStackLimitRootIndex);
|
__ LoadRoot(kScratchReg, Heap::kRealStackLimitRootIndex);
|
||||||
__ Branch(&done, gt, sp, Operand(kScratchReg)); // Signed comparison.
|
__ Branch(&done, hs, sp, Operand(kScratchReg));
|
||||||
// Restore the stack pointer.
|
// Restore the stack pointer.
|
||||||
__ Daddu(sp, sp, Operand(a5));
|
__ Daddu(sp, sp, Operand(a5));
|
||||||
{
|
{
|
||||||
@ -2038,7 +2038,7 @@ void Builtins::Generate_ConstructBoundFunction(MacroAssembler* masm) {
|
|||||||
// Check the stack for overflow. We are not trying to catch interruptions
|
// Check the stack for overflow. We are not trying to catch interruptions
|
||||||
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
// (i.e. debug break and preemption) here, so check the "real stack limit".
|
||||||
__ LoadRoot(kScratchReg, Heap::kRealStackLimitRootIndex);
|
__ LoadRoot(kScratchReg, Heap::kRealStackLimitRootIndex);
|
||||||
__ Branch(&done, gt, sp, Operand(kScratchReg)); // Signed comparison.
|
__ Branch(&done, hs, sp, Operand(kScratchReg));
|
||||||
// Restore the stack pointer.
|
// Restore the stack pointer.
|
||||||
__ Daddu(sp, sp, Operand(a5));
|
__ Daddu(sp, sp, Operand(a5));
|
||||||
{
|
{
|
||||||
|
@ -2050,7 +2050,7 @@ void Generate_PushBoundArguments(MacroAssembler* masm) {
|
|||||||
// (i.e. debug break and preemption) here, so check the "real stack
|
// (i.e. debug break and preemption) here, so check the "real stack
|
||||||
// limit".
|
// limit".
|
||||||
__ CompareRoot(rsp, Heap::kRealStackLimitRootIndex);
|
__ CompareRoot(rsp, Heap::kRealStackLimitRootIndex);
|
||||||
__ j(greater, &done, Label::kNear); // Signed comparison.
|
__ j(above_equal, &done, Label::kNear);
|
||||||
// Restore the stack pointer.
|
// Restore the stack pointer.
|
||||||
__ leap(rsp, Operand(rsp, rbx, times_pointer_size, 0));
|
__ leap(rsp, Operand(rsp, rbx, times_pointer_size, 0));
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user