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

Side by Side Diff: src/ia32/builtins-ia32.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/arm64/builtins-arm64.cc ('k') | src/mips/builtins-mips.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 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_IA32 5 #if V8_TARGET_ARCH_IA32
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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 __ j(equal, &bytecode_array_not_present); 565 __ j(equal, &bytecode_array_not_present);
566 if (FLAG_debug_code) { 566 if (FLAG_debug_code) {
567 __ AssertNotSmi(kInterpreterBytecodeArrayRegister); 567 __ AssertNotSmi(kInterpreterBytecodeArrayRegister);
568 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE, 568 __ CmpObjectType(kInterpreterBytecodeArrayRegister, BYTECODE_ARRAY_TYPE,
569 eax); 569 eax);
570 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 570 __ Assert(equal, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
571 } 571 }
572 572
573 // Push bytecode array. 573 // Push bytecode array.
574 __ push(kInterpreterBytecodeArrayRegister); 574 __ push(kInterpreterBytecodeArrayRegister);
575 // Push zero for bytecode array offset. 575 // Push Smi tagged initial bytecode array offset.
576 __ push(Immediate(0)); 576 __ push(Immediate(Smi::FromInt(BytecodeArray::kHeaderSize - kHeapObjectTag)));
577 577
578 // Allocate the local and temporary register file on the stack. 578 // Allocate the local and temporary register file on the stack.
579 { 579 {
580 // Load frame size from the BytecodeArray object. 580 // Load frame size from the BytecodeArray object.
581 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister, 581 __ mov(ebx, FieldOperand(kInterpreterBytecodeArrayRegister,
582 BytecodeArray::kFrameSizeOffset)); 582 BytecodeArray::kFrameSizeOffset));
583 583
584 // Do a stack check to ensure we don't go over the limit. 584 // Do a stack check to ensure we don't go over the limit.
585 Label ok; 585 Label ok;
586 __ mov(ecx, esp); 586 __ mov(ecx, esp);
(...skipping 12 matching lines...) Expand all
599 __ jmp(&loop_check); 599 __ jmp(&loop_check);
600 __ bind(&loop_header); 600 __ bind(&loop_header);
601 // TODO(rmcilroy): Consider doing more than one push per loop iteration. 601 // TODO(rmcilroy): Consider doing more than one push per loop iteration.
602 __ push(eax); 602 __ push(eax);
603 // Continue loop if not done. 603 // Continue loop if not done.
604 __ bind(&loop_check); 604 __ bind(&loop_check);
605 __ sub(ebx, Immediate(kPointerSize)); 605 __ sub(ebx, Immediate(kPointerSize));
606 __ j(greater_equal, &loop_header); 606 __ j(greater_equal, &loop_header);
607 } 607 }
608 608
609 // Load accumulator, register file, bytecode offset, dispatch table into 609 // Load accumulator, bytecode offset and dispatch table into registers.
610 // registers.
611 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 610 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
612 __ mov(edx, ebp);
613 __ add(edx, Immediate(InterpreterFrameConstants::kRegisterFileFromFp));
614 __ mov(kInterpreterBytecodeOffsetRegister, 611 __ mov(kInterpreterBytecodeOffsetRegister,
615 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag)); 612 Immediate(BytecodeArray::kHeaderSize - kHeapObjectTag));
616 __ mov(kInterpreterDispatchTableRegister, 613 __ mov(kInterpreterDispatchTableRegister,
617 Immediate(ExternalReference::interpreter_dispatch_table_address( 614 Immediate(ExternalReference::interpreter_dispatch_table_address(
618 masm->isolate()))); 615 masm->isolate())));
619 616
620 // Dispatch to the first bytecode handler for the function. 617 // Dispatch to the first bytecode handler for the function.
621 __ movzx_b(ebx, Operand(kInterpreterBytecodeArrayRegister, 618 __ movzx_b(ebx, Operand(kInterpreterBytecodeArrayRegister,
622 kInterpreterBytecodeOffsetRegister, times_1, 0)); 619 kInterpreterBytecodeOffsetRegister, times_1, 0));
623 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx, 620 __ mov(ebx, Operand(kInterpreterDispatchTableRegister, ebx,
(...skipping 2284 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 // And "return" to the OSR entry point of the function. 2905 // And "return" to the OSR entry point of the function.
2909 __ ret(0); 2906 __ ret(0);
2910 } 2907 }
2911 2908
2912 2909
2913 #undef __ 2910 #undef __
2914 } // namespace internal 2911 } // namespace internal
2915 } // namespace v8 2912 } // namespace v8
2916 2913
2917 #endif // V8_TARGET_ARCH_IA32 2914 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698