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

Side by Side Diff: src/ppc/code-stubs-ppc.cc

Issue 1012103002: Delegate throwing in RegExpExecStub to CEntryStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to all the architectures. Created 5 years, 9 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/code-stubs-mips64.cc ('k') | src/runtime/runtime.h » ('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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_PPC 7 #if V8_TARGET_ARCH_PPC
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 isolate->set_fp_stubs_generated(true); 988 isolate->set_fp_stubs_generated(true);
989 } 989 }
990 990
991 991
992 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { 992 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) {
993 CEntryStub stub(isolate, 1, kDontSaveFPRegs); 993 CEntryStub stub(isolate, 1, kDontSaveFPRegs);
994 stub.GetCode(); 994 stub.GetCode();
995 } 995 }
996 996
997 997
998 static void ThrowPendingException(MacroAssembler* masm) {
999 Isolate* isolate = masm->isolate();
1000
1001 ExternalReference pending_handler_context_address(
1002 Isolate::kPendingHandlerContextAddress, isolate);
1003 ExternalReference pending_handler_code_address(
1004 Isolate::kPendingHandlerCodeAddress, isolate);
1005 ExternalReference pending_handler_offset_address(
1006 Isolate::kPendingHandlerOffsetAddress, isolate);
1007 ExternalReference pending_handler_fp_address(
1008 Isolate::kPendingHandlerFPAddress, isolate);
1009 ExternalReference pending_handler_sp_address(
1010 Isolate::kPendingHandlerSPAddress, isolate);
1011
1012 // Ask the runtime for help to determine the handler. This will set r3 to
1013 // contain the current pending exception, don't clobber it.
1014 ExternalReference find_handler(Runtime::kFindExceptionHandler, isolate);
1015 {
1016 FrameScope scope(masm, StackFrame::MANUAL);
1017 __ PrepareCallCFunction(3, 0, r3);
1018 __ li(r3, Operand::Zero());
1019 __ li(r4, Operand::Zero());
1020 __ mov(r5, Operand(ExternalReference::isolate_address(isolate)));
1021 __ CallCFunction(find_handler, 3);
1022 }
1023
1024 // Retrieve the handler context, SP and FP.
1025 __ mov(cp, Operand(pending_handler_context_address));
1026 __ LoadP(cp, MemOperand(cp));
1027 __ mov(sp, Operand(pending_handler_sp_address));
1028 __ LoadP(sp, MemOperand(sp));
1029 __ mov(fp, Operand(pending_handler_fp_address));
1030 __ LoadP(fp, MemOperand(fp));
1031
1032 // If the handler is a JS frame, restore the context to the frame.
1033 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp
1034 // or cp.
1035 Label skip;
1036 __ cmpi(cp, Operand::Zero());
1037 __ beq(&skip);
1038 __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1039 __ bind(&skip);
1040
1041 // Compute the handler entry address and jump to it.
1042 __ mov(r4, Operand(pending_handler_code_address));
1043 __ LoadP(r4, MemOperand(r4));
1044 __ mov(r5, Operand(pending_handler_offset_address));
1045 __ LoadP(r5, MemOperand(r5));
1046 __ addi(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start
1047 __ add(ip, r4, r5);
1048 __ Jump(ip);
1049 }
1050
1051
1052 void CEntryStub::Generate(MacroAssembler* masm) { 998 void CEntryStub::Generate(MacroAssembler* masm) {
1053 // Called from JavaScript; parameters are on stack as if calling JS function. 999 // Called from JavaScript; parameters are on stack as if calling JS function.
1054 // r3: number of arguments including receiver 1000 // r3: number of arguments including receiver
1055 // r4: pointer to builtin function 1001 // r4: pointer to builtin function
1056 // fp: frame pointer (restored after C call) 1002 // fp: frame pointer (restored after C call)
1057 // sp: stack pointer (restored as callee's sp after C call) 1003 // sp: stack pointer (restored as callee's sp after C call)
1058 // cp: current context (C callee-saved) 1004 // cp: current context (C callee-saved)
1059 1005
1060 ProfileEntryHookStub::MaybeCallEntryHook(masm); 1006 ProfileEntryHookStub::MaybeCallEntryHook(masm);
1061 1007
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 // r3:r4: result 1119 // r3:r4: result
1174 // sp: stack pointer 1120 // sp: stack pointer
1175 // fp: frame pointer 1121 // fp: frame pointer
1176 // r14: still holds argc (callee-saved). 1122 // r14: still holds argc (callee-saved).
1177 __ LeaveExitFrame(save_doubles(), r14, true); 1123 __ LeaveExitFrame(save_doubles(), r14, true);
1178 __ blr(); 1124 __ blr();
1179 1125
1180 // Handling of exception. 1126 // Handling of exception.
1181 __ bind(&exception_returned); 1127 __ bind(&exception_returned);
1182 1128
1183 ThrowPendingException(masm); 1129 ExternalReference pending_handler_context_address(
1130 Isolate::kPendingHandlerContextAddress, isolate());
1131 ExternalReference pending_handler_code_address(
1132 Isolate::kPendingHandlerCodeAddress, isolate());
1133 ExternalReference pending_handler_offset_address(
1134 Isolate::kPendingHandlerOffsetAddress, isolate());
1135 ExternalReference pending_handler_fp_address(
1136 Isolate::kPendingHandlerFPAddress, isolate());
1137 ExternalReference pending_handler_sp_address(
1138 Isolate::kPendingHandlerSPAddress, isolate());
1139
1140 // Ask the runtime for help to determine the handler. This will set r3 to
1141 // contain the current pending exception, don't clobber it.
1142 ExternalReference find_handler(Runtime::kFindExceptionHandler, isolate());
1143 {
1144 FrameScope scope(masm, StackFrame::MANUAL);
1145 __ PrepareCallCFunction(3, 0, r3);
1146 __ li(r3, Operand::Zero());
1147 __ li(r4, Operand::Zero());
1148 __ mov(r5, Operand(ExternalReference::isolate_address(isolate())));
1149 __ CallCFunction(find_handler, 3);
1150 }
1151
1152 // Retrieve the handler context, SP and FP.
1153 __ mov(cp, Operand(pending_handler_context_address));
1154 __ LoadP(cp, MemOperand(cp));
1155 __ mov(sp, Operand(pending_handler_sp_address));
1156 __ LoadP(sp, MemOperand(sp));
1157 __ mov(fp, Operand(pending_handler_fp_address));
1158 __ LoadP(fp, MemOperand(fp));
1159
1160 // If the handler is a JS frame, restore the context to the frame.
1161 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp
1162 // or cp.
1163 Label skip;
1164 __ cmpi(cp, Operand::Zero());
1165 __ beq(&skip);
1166 __ StoreP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
1167 __ bind(&skip);
1168
1169 // Compute the handler entry address and jump to it.
1170 __ mov(r4, Operand(pending_handler_code_address));
1171 __ LoadP(r4, MemOperand(r4));
1172 __ mov(r5, Operand(pending_handler_offset_address));
1173 __ LoadP(r5, MemOperand(r5));
1174 __ addi(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); // Code start
1175 __ add(ip, r4, r5);
1176 __ Jump(ip);
1184 } 1177 }
1185 1178
1186 1179
1187 void JSEntryStub::Generate(MacroAssembler* masm) { 1180 void JSEntryStub::Generate(MacroAssembler* masm) {
1188 // r3: code entry 1181 // r3: code entry
1189 // r4: function 1182 // r4: function
1190 // r5: receiver 1183 // r5: receiver
1191 // r6: argc 1184 // r6: argc
1192 // [sp+0]: argv 1185 // [sp+0]: argv
1193 1186
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 // haven't created the exception yet. Handle that in the runtime system. 2387 // haven't created the exception yet. Handle that in the runtime system.
2395 // TODO(592): Rerunning the RegExp to get the stack overflow exception. 2388 // TODO(592): Rerunning the RegExp to get the stack overflow exception.
2396 __ mov(r4, Operand(isolate()->factory()->the_hole_value())); 2389 __ mov(r4, Operand(isolate()->factory()->the_hole_value()));
2397 __ mov(r5, Operand(ExternalReference(Isolate::kPendingExceptionAddress, 2390 __ mov(r5, Operand(ExternalReference(Isolate::kPendingExceptionAddress,
2398 isolate()))); 2391 isolate())));
2399 __ LoadP(r3, MemOperand(r5, 0)); 2392 __ LoadP(r3, MemOperand(r5, 0));
2400 __ cmp(r3, r4); 2393 __ cmp(r3, r4);
2401 __ beq(&runtime); 2394 __ beq(&runtime);
2402 2395
2403 // For exception, throw the exception again. 2396 // For exception, throw the exception again.
2404 __ EnterExitFrame(false); 2397 __ TailCallRuntime(Runtime::kRegExpExecReThrow, 4, 1);
2405 ThrowPendingException(masm);
2406 2398
2407 __ bind(&failure); 2399 __ bind(&failure);
2408 // For failure and exception return null. 2400 // For failure and exception return null.
2409 __ mov(r3, Operand(isolate()->factory()->null_value())); 2401 __ mov(r3, Operand(isolate()->factory()->null_value()));
2410 __ addi(sp, sp, Operand(4 * kPointerSize)); 2402 __ addi(sp, sp, Operand(4 * kPointerSize));
2411 __ Ret(); 2403 __ Ret();
2412 2404
2413 // Process the result from the native regexp code. 2405 // Process the result from the native regexp code.
2414 __ bind(&success); 2406 __ bind(&success);
2415 __ LoadP(r4, 2407 __ LoadP(r4,
(...skipping 2926 matching lines...) Expand 10 before | Expand all | Expand 10 after
5342 kStackUnwindSpace, NULL, 5334 kStackUnwindSpace, NULL,
5343 MemOperand(fp, 6 * kPointerSize), NULL); 5335 MemOperand(fp, 6 * kPointerSize), NULL);
5344 } 5336 }
5345 5337
5346 5338
5347 #undef __ 5339 #undef __
5348 } 5340 }
5349 } // namespace v8::internal 5341 } // namespace v8::internal
5350 5342
5351 #endif // V8_TARGET_ARCH_PPC 5343 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/mips64/code-stubs-mips64.cc ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698