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

Side by Side Diff: src/arm/builtins-arm.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 | « no previous file | src/arm64/builtins-arm64.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_ARM 5 #if V8_TARGET_ARCH_ARM
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 Heap::kUndefinedValueRootIndex); 1004 Heap::kUndefinedValueRootIndex);
1005 __ b(eq, &bytecode_array_not_present); 1005 __ b(eq, &bytecode_array_not_present);
1006 if (FLAG_debug_code) { 1006 if (FLAG_debug_code) {
1007 __ SmiTst(kInterpreterBytecodeArrayRegister); 1007 __ SmiTst(kInterpreterBytecodeArrayRegister);
1008 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 1008 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
1009 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r0, no_reg, 1009 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r0, no_reg,
1010 BYTECODE_ARRAY_TYPE); 1010 BYTECODE_ARRAY_TYPE);
1011 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 1011 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
1012 } 1012 }
1013 1013
1014 // Push new.target, bytecode array and zero for bytecode array offset. 1014 // Load the initial bytecode offset.
1015 __ mov(r0, Operand(0)); 1015 __ mov(kInterpreterBytecodeOffsetRegister,
1016 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
1017
1018 // Push new.target, bytecode array and Smi tagged bytecode array offset.
1019 __ SmiTag(r0, kInterpreterBytecodeOffsetRegister);
1016 __ Push(r3, kInterpreterBytecodeArrayRegister, r0); 1020 __ Push(r3, kInterpreterBytecodeArrayRegister, r0);
1017 1021
1018 // Allocate the local and temporary register file on the stack. 1022 // Allocate the local and temporary register file on the stack.
1019 { 1023 {
1020 // Load frame size from the BytecodeArray object. 1024 // Load frame size from the BytecodeArray object.
1021 __ ldr(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister, 1025 __ ldr(r4, FieldMemOperand(kInterpreterBytecodeArrayRegister,
1022 BytecodeArray::kFrameSizeOffset)); 1026 BytecodeArray::kFrameSizeOffset));
1023 1027
1024 // Do a stack check to ensure we don't go over the limit. 1028 // Do a stack check to ensure we don't go over the limit.
1025 Label ok; 1029 Label ok;
(...skipping 11 matching lines...) Expand all
1037 __ b(&loop_check, al); 1041 __ b(&loop_check, al);
1038 __ bind(&loop_header); 1042 __ bind(&loop_header);
1039 // TODO(rmcilroy): Consider doing more than one push per loop iteration. 1043 // TODO(rmcilroy): Consider doing more than one push per loop iteration.
1040 __ push(r9); 1044 __ push(r9);
1041 // Continue loop if not done. 1045 // Continue loop if not done.
1042 __ bind(&loop_check); 1046 __ bind(&loop_check);
1043 __ sub(r4, r4, Operand(kPointerSize), SetCC); 1047 __ sub(r4, r4, Operand(kPointerSize), SetCC);
1044 __ b(&loop_header, ge); 1048 __ b(&loop_header, ge);
1045 } 1049 }
1046 1050
1047 // Load accumulator, register file, bytecode offset, dispatch table into 1051 // Load accumulator and dispatch table into registers.
1048 // registers.
1049 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 1052 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
1050 __ add(r4, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp));
1051 __ mov(kInterpreterBytecodeOffsetRegister,
1052 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
1053 __ mov(kInterpreterDispatchTableRegister, 1053 __ mov(kInterpreterDispatchTableRegister,
1054 Operand(ExternalReference::interpreter_dispatch_table_address( 1054 Operand(ExternalReference::interpreter_dispatch_table_address(
1055 masm->isolate()))); 1055 masm->isolate())));
1056 1056
1057 // Dispatch to the first bytecode handler for the function. 1057 // Dispatch to the first bytecode handler for the function.
1058 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister, 1058 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister,
1059 kInterpreterBytecodeOffsetRegister)); 1059 kInterpreterBytecodeOffsetRegister));
1060 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL, 1060 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL,
1061 kPointerSizeLog2)); 1061 kPointerSizeLog2));
1062 __ Call(ip); 1062 __ Call(ip);
(...skipping 1757 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 } 2820 }
2821 } 2821 }
2822 2822
2823 2823
2824 #undef __ 2824 #undef __
2825 2825
2826 } // namespace internal 2826 } // namespace internal
2827 } // namespace v8 2827 } // namespace v8
2828 2828
2829 #endif // V8_TARGET_ARCH_ARM 2829 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/builtins-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698