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

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

Issue 1950913004: [Interpreter] Fix bytecode offset for stack overflows. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Also fixes error-to-sttring-stack-overflow.html Created 4 years, 7 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
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/mjsunit/stack-traces-overflow.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 __ j(equal, &bytecode_array_not_present); 566 __ j(equal, &bytecode_array_not_present);
567 if (FLAG_debug_code) { 567 if (FLAG_debug_code) {
568 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 568 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
569 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 569 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
570 eax); 570 eax);
571 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 571 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
572 } 572 }
573 573
574 // Push bytecode array. 574 // Push bytecode array.
575 __ push(kInterpreterBytecodeArrayRegister); 575 __ push(kInterpreterBytecodeArrayRegister);
576 // Push zero for bytecode array offset. 576 // Push Smi tagged initial bytecode array offset.
577 __ push(Immediate(0)); 577 __ push(Immediate(Smi::FromInt(BytecodeArray::kHeaderSize - kHeapObjectTag)));
578 578
579 // Allocate the local and temporary register file on the stack. 579 // Allocate the local and temporary register file on the stack.
580 { 580 {
581 // Load frame size from the BytecodeArray object. 581 // Load frame size from the BytecodeArray object.
582 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, 582 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister,
583 BytecodeArray::kFrameSizeOffset)); 583 BytecodeArray::kFrameSizeOffset));
584 584
585 // Do a stack check to ensure we don't go over the limit. 585 // Do a stack check to ensure we don't go over the limit.
586 Label ok; 586 Label ok;
587 __ mov(ecx, esp); 587 __ mov(ecx, esp);
(...skipping 12 matching lines...) Expand all
600 __ jmp(&loop_check); 600 __ jmp(&loop_check);
601 __ bind(&loop_header); 601 __ bind(&loop_header);
602 // TODO(rmcilroy): Consider doing more than one push per loop iteration. 602 // TODO(rmcilroy): Consider doing more than one push per loop iteration.
603 __ push(eax); 603 __ push(eax);
604 // Continue loop if not done. 604 // Continue loop if not done.
605 __ bind(&loop_check); 605 __ bind(&loop_check);
606 __ sub(ebx, Immediate(kPointerSize)); 606 __ sub(ebx, Immediate(kPointerSize));
607 __ j(greater_equal, &loop_header); 607 __ j(greater_equal, &loop_header);
608 } 608 }
609 609
610 // Load accumulator, register file, bytecode offset, dispatch table into 610 // Load accumulator, bytecode offset and dispatch table into registers.
611 // registers.
612 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 611 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
613 __ mov(edx, ebp);
614 __ add(edx, Immediate(InterpreterFrameConstants::kRegisterFileFromFp));
615 __ mov(kInterpreterBytecodeOffsetRegister, 612 __ mov(kInterpreterBytecodeOffsetRegister,
616 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); 613 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
617 __ mov(kInterpreterDispatchTableRegister, 614 __ mov(kInterpreterDispatchTableRegister,
618 Immediate(ExternalReference::interpreter_dispatch_table_address( 615 Immediate(ExternalReference::interpreter_dispatch_table_address(
619 masm->isolate()))); 616 masm->isolate())));
620 617
621 // Dispatch to the first bytecode handler for the function. 618 // Dispatch to the first bytecode handler for the function.
622 __ movzx_b(ebx, Operand(kInterpreterBytecodeArrayRegister, 619 __ movzx_b(ebx, Operand(kInterpreterBytecodeArrayRegister,
623 kInterpreterBytecodeOffsetRegister, times_1, 0)); 620 kInterpreterBytecodeOffsetRegister, times_1, 0));
624 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx, 621 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx,
(...skipping 2314 matching lines...) Expand 10 before | Expand all | Expand 10 after
2939 // And "return" to the OSR entry point of the function. 2936 // And "return" to the OSR entry point of the function.
2940 __ ret(0); 2937 __ ret(0);
2941 } 2938 }
2942 2939
2943 2940
2944 #undef __ 2941 #undef __
2945 } // namespace internal 2942 } // namespace internal
2946 } // namespace v8 2943 } // namespace v8
2947 2944
2948 #endif // V8_TARGET_ARCH_X87 2945 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | test/mjsunit/stack-traces-overflow.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698