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

Side by Side Diff: src/ppc/builtins-ppc.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/mips64/builtins-mips64.cc ('k') | src/s390/builtins-s390.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 5 #if V8_TARGET_ARCH_PPC
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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 __ beq(&bytecode_array_not_present); 1018 __ beq(&bytecode_array_not_present);
1019 1019
1020 if (FLAG_debug_code) { 1020 if (FLAG_debug_code) {
1021 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); 1021 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0);
1022 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 1022 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
1023 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg, 1023 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg,
1024 BYTECODE_ARRAY_TYPE); 1024 BYTECODE_ARRAY_TYPE);
1025 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 1025 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
1026 } 1026 }
1027 1027
1028 // Push new.target, bytecode array and zero for bytecode array offset. 1028 // Load initial bytecode offset.
1029 __ li(r3, Operand::Zero()); 1029 __ mov(kInterpreterBytecodeOffsetRegister,
1030 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
1031
1032 // Push new.target, bytecode array and Smi tagged bytecode array offset.
1033 __ SmiTag(r3, kInterpreterBytecodeOffsetRegister);
1030 __ Push(r6, kInterpreterBytecodeArrayRegister, r3); 1034 __ Push(r6, kInterpreterBytecodeArrayRegister, r3);
1031 1035
1032 // Allocate the local and temporary register file on the stack. 1036 // Allocate the local and temporary register file on the stack.
1033 { 1037 {
1034 // Load frame size (word) from the BytecodeArray object. 1038 // Load frame size (word) from the BytecodeArray object.
1035 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister, 1039 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister,
1036 BytecodeArray::kFrameSizeOffset)); 1040 BytecodeArray::kFrameSizeOffset));
1037 1041
1038 // Do a stack check to ensure we don't go over the limit. 1042 // Do a stack check to ensure we don't go over the limit.
1039 Label ok; 1043 Label ok;
(...skipping 10 matching lines...) Expand all
1050 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); 1054 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
1051 __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2), SetRC); 1055 __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2), SetRC);
1052 __ beq(&no_args, cr0); 1056 __ beq(&no_args, cr0);
1053 __ mtctr(r5); 1057 __ mtctr(r5);
1054 __ bind(&loop); 1058 __ bind(&loop);
1055 __ push(r6); 1059 __ push(r6);
1056 __ bdnz(&loop); 1060 __ bdnz(&loop);
1057 __ bind(&no_args); 1061 __ bind(&no_args);
1058 } 1062 }
1059 1063
1060 // Load accumulator, register file, bytecode offset, dispatch table into 1064 // Load accumulator and dispatch table into registers.
1061 // registers.
1062 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); 1065 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
1063 __ addi(r7, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp));
1064 __ mov(kInterpreterBytecodeOffsetRegister,
1065 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
1066 __ mov(kInterpreterDispatchTableRegister, 1066 __ mov(kInterpreterDispatchTableRegister,
1067 Operand(ExternalReference::interpreter_dispatch_table_address( 1067 Operand(ExternalReference::interpreter_dispatch_table_address(
1068 masm->isolate()))); 1068 masm->isolate())));
1069 1069
1070 // Dispatch to the first bytecode handler for the function. 1070 // Dispatch to the first bytecode handler for the function.
1071 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, 1071 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister,
1072 kInterpreterBytecodeOffsetRegister)); 1072 kInterpreterBytecodeOffsetRegister));
1073 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); 1073 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2));
1074 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); 1074 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip));
1075 __ Call(ip); 1075 __ Call(ip);
(...skipping 1825 matching lines...) Expand 10 before | Expand all | Expand 10 after
2901 __ bkpt(0); 2901 __ bkpt(0);
2902 } 2902 }
2903 } 2903 }
2904 2904
2905 2905
2906 #undef __ 2906 #undef __
2907 } // namespace internal 2907 } // namespace internal
2908 } // namespace v8 2908 } // namespace v8
2909 2909
2910 #endif // V8_TARGET_ARCH_PPC 2910 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/mips64/builtins-mips64.cc ('k') | src/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698