OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 isolate->set_fp_stubs_generated(true); | 931 isolate->set_fp_stubs_generated(true); |
932 } | 932 } |
933 | 933 |
934 | 934 |
935 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { | 935 void CEntryStub::GenerateAheadOfTime(Isolate* isolate) { |
936 CEntryStub stub(isolate, 1, kDontSaveFPRegs); | 936 CEntryStub stub(isolate, 1, kDontSaveFPRegs); |
937 stub.GetCode(); | 937 stub.GetCode(); |
938 } | 938 } |
939 | 939 |
940 | 940 |
941 static void ThrowPendingException(MacroAssembler* masm) { | |
942 Isolate* isolate = masm->isolate(); | |
943 | |
944 ExternalReference pending_handler_context_address( | |
945 Isolate::kPendingHandlerContextAddress, isolate); | |
946 ExternalReference pending_handler_code_address( | |
947 Isolate::kPendingHandlerCodeAddress, isolate); | |
948 ExternalReference pending_handler_offset_address( | |
949 Isolate::kPendingHandlerOffsetAddress, isolate); | |
950 ExternalReference pending_handler_fp_address( | |
951 Isolate::kPendingHandlerFPAddress, isolate); | |
952 ExternalReference pending_handler_sp_address( | |
953 Isolate::kPendingHandlerSPAddress, isolate); | |
954 | |
955 // Ask the runtime for help to determine the handler. This will set r0 to | |
956 // contain the current pending exception, don't clobber it. | |
957 ExternalReference find_handler(Runtime::kFindExceptionHandler, isolate); | |
958 { | |
959 FrameScope scope(masm, StackFrame::MANUAL); | |
960 __ PrepareCallCFunction(3, 0, r0); | |
961 __ mov(r0, Operand(0)); | |
962 __ mov(r1, Operand(0)); | |
963 __ mov(r2, Operand(ExternalReference::isolate_address(isolate))); | |
964 __ CallCFunction(find_handler, 3); | |
965 } | |
966 | |
967 // Retrieve the handler context, SP and FP. | |
968 __ mov(cp, Operand(pending_handler_context_address)); | |
969 __ ldr(cp, MemOperand(cp)); | |
970 __ mov(sp, Operand(pending_handler_sp_address)); | |
971 __ ldr(sp, MemOperand(sp)); | |
972 __ mov(fp, Operand(pending_handler_fp_address)); | |
973 __ ldr(fp, MemOperand(fp)); | |
974 | |
975 // If the handler is a JS frame, restore the context to the frame. | |
976 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp | |
977 // or cp. | |
978 __ cmp(cp, Operand(0)); | |
979 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); | |
980 | |
981 // Compute the handler entry address and jump to it. | |
982 ConstantPoolUnavailableScope constant_pool_unavailable(masm); | |
983 __ mov(r1, Operand(pending_handler_code_address)); | |
984 __ ldr(r1, MemOperand(r1)); | |
985 __ mov(r2, Operand(pending_handler_offset_address)); | |
986 __ ldr(r2, MemOperand(r2)); | |
987 if (FLAG_enable_ool_constant_pool) { | |
988 __ ldr(pp, FieldMemOperand(r1, Code::kConstantPoolOffset)); | |
989 } | |
990 __ add(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag)); | |
991 __ add(pc, r1, r2); | |
992 } | |
993 | |
994 | |
995 void CEntryStub::Generate(MacroAssembler* masm) { | 941 void CEntryStub::Generate(MacroAssembler* masm) { |
996 // Called from JavaScript; parameters are on stack as if calling JS function. | 942 // Called from JavaScript; parameters are on stack as if calling JS function. |
997 // r0: number of arguments including receiver | 943 // r0: number of arguments including receiver |
998 // r1: pointer to builtin function | 944 // r1: pointer to builtin function |
999 // fp: frame pointer (restored after C call) | 945 // fp: frame pointer (restored after C call) |
1000 // sp: stack pointer (restored as callee's sp after C call) | 946 // sp: stack pointer (restored as callee's sp after C call) |
1001 // cp: current context (C callee-saved) | 947 // cp: current context (C callee-saved) |
1002 | 948 |
1003 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 949 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
1004 | 950 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 // Exit C frame and return. | 1037 // Exit C frame and return. |
1092 // r0:r1: result | 1038 // r0:r1: result |
1093 // sp: stack pointer | 1039 // sp: stack pointer |
1094 // fp: frame pointer | 1040 // fp: frame pointer |
1095 // Callee-saved register r4 still holds argc. | 1041 // Callee-saved register r4 still holds argc. |
1096 __ LeaveExitFrame(save_doubles(), r4, true); | 1042 __ LeaveExitFrame(save_doubles(), r4, true); |
1097 __ mov(pc, lr); | 1043 __ mov(pc, lr); |
1098 | 1044 |
1099 // Handling of exception. | 1045 // Handling of exception. |
1100 __ bind(&exception_returned); | 1046 __ bind(&exception_returned); |
1101 ThrowPendingException(masm); | 1047 |
| 1048 ExternalReference pending_handler_context_address( |
| 1049 Isolate::kPendingHandlerContextAddress, isolate()); |
| 1050 ExternalReference pending_handler_code_address( |
| 1051 Isolate::kPendingHandlerCodeAddress, isolate()); |
| 1052 ExternalReference pending_handler_offset_address( |
| 1053 Isolate::kPendingHandlerOffsetAddress, isolate()); |
| 1054 ExternalReference pending_handler_fp_address( |
| 1055 Isolate::kPendingHandlerFPAddress, isolate()); |
| 1056 ExternalReference pending_handler_sp_address( |
| 1057 Isolate::kPendingHandlerSPAddress, isolate()); |
| 1058 |
| 1059 // Ask the runtime for help to determine the handler. This will set r0 to |
| 1060 // contain the current pending exception, don't clobber it. |
| 1061 ExternalReference find_handler(Runtime::kFindExceptionHandler, isolate()); |
| 1062 { |
| 1063 FrameScope scope(masm, StackFrame::MANUAL); |
| 1064 __ PrepareCallCFunction(3, 0, r0); |
| 1065 __ mov(r0, Operand(0)); |
| 1066 __ mov(r1, Operand(0)); |
| 1067 __ mov(r2, Operand(ExternalReference::isolate_address(isolate()))); |
| 1068 __ CallCFunction(find_handler, 3); |
| 1069 } |
| 1070 |
| 1071 // Retrieve the handler context, SP and FP. |
| 1072 __ mov(cp, Operand(pending_handler_context_address)); |
| 1073 __ ldr(cp, MemOperand(cp)); |
| 1074 __ mov(sp, Operand(pending_handler_sp_address)); |
| 1075 __ ldr(sp, MemOperand(sp)); |
| 1076 __ mov(fp, Operand(pending_handler_fp_address)); |
| 1077 __ ldr(fp, MemOperand(fp)); |
| 1078 |
| 1079 // If the handler is a JS frame, restore the context to the frame. |
| 1080 // (kind == ENTRY) == (fp == 0) == (cp == 0), so we could test either fp |
| 1081 // or cp. |
| 1082 __ cmp(cp, Operand(0)); |
| 1083 __ str(cp, MemOperand(fp, StandardFrameConstants::kContextOffset), ne); |
| 1084 |
| 1085 // Compute the handler entry address and jump to it. |
| 1086 ConstantPoolUnavailableScope constant_pool_unavailable(masm); |
| 1087 __ mov(r1, Operand(pending_handler_code_address)); |
| 1088 __ ldr(r1, MemOperand(r1)); |
| 1089 __ mov(r2, Operand(pending_handler_offset_address)); |
| 1090 __ ldr(r2, MemOperand(r2)); |
| 1091 if (FLAG_enable_ool_constant_pool) { |
| 1092 __ ldr(pp, FieldMemOperand(r1, Code::kConstantPoolOffset)); |
| 1093 } |
| 1094 __ add(r1, r1, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1095 __ add(pc, r1, r2); |
1102 } | 1096 } |
1103 | 1097 |
1104 | 1098 |
1105 void JSEntryStub::Generate(MacroAssembler* masm) { | 1099 void JSEntryStub::Generate(MacroAssembler* masm) { |
1106 // r0: code entry | 1100 // r0: code entry |
1107 // r1: function | 1101 // r1: function |
1108 // r2: receiver | 1102 // r2: receiver |
1109 // r3: argc | 1103 // r3: argc |
1110 // [sp+0]: argv | 1104 // [sp+0]: argv |
1111 | 1105 |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2229 // haven't created the exception yet. Handle that in the runtime system. | 2223 // haven't created the exception yet. Handle that in the runtime system. |
2230 // TODO(592): Rerunning the RegExp to get the stack overflow exception. | 2224 // TODO(592): Rerunning the RegExp to get the stack overflow exception. |
2231 __ mov(r1, Operand(isolate()->factory()->the_hole_value())); | 2225 __ mov(r1, Operand(isolate()->factory()->the_hole_value())); |
2232 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, | 2226 __ mov(r2, Operand(ExternalReference(Isolate::kPendingExceptionAddress, |
2233 isolate()))); | 2227 isolate()))); |
2234 __ ldr(r0, MemOperand(r2, 0)); | 2228 __ ldr(r0, MemOperand(r2, 0)); |
2235 __ cmp(r0, r1); | 2229 __ cmp(r0, r1); |
2236 __ b(eq, &runtime); | 2230 __ b(eq, &runtime); |
2237 | 2231 |
2238 // For exception, throw the exception again. | 2232 // For exception, throw the exception again. |
2239 __ EnterExitFrame(false); | 2233 __ TailCallRuntime(Runtime::kRegExpExecReThrow, 4, 1); |
2240 ThrowPendingException(masm); | |
2241 | 2234 |
2242 __ bind(&failure); | 2235 __ bind(&failure); |
2243 // For failure and exception return null. | 2236 // For failure and exception return null. |
2244 __ mov(r0, Operand(isolate()->factory()->null_value())); | 2237 __ mov(r0, Operand(isolate()->factory()->null_value())); |
2245 __ add(sp, sp, Operand(4 * kPointerSize)); | 2238 __ add(sp, sp, Operand(4 * kPointerSize)); |
2246 __ Ret(); | 2239 __ Ret(); |
2247 | 2240 |
2248 // Process the result from the native regexp code. | 2241 // Process the result from the native regexp code. |
2249 __ bind(&success); | 2242 __ bind(&success); |
2250 __ ldr(r1, | 2243 __ ldr(r1, |
(...skipping 3033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5284 kStackUnwindSpace, NULL, | 5277 kStackUnwindSpace, NULL, |
5285 MemOperand(fp, 6 * kPointerSize), NULL); | 5278 MemOperand(fp, 6 * kPointerSize), NULL); |
5286 } | 5279 } |
5287 | 5280 |
5288 | 5281 |
5289 #undef __ | 5282 #undef __ |
5290 | 5283 |
5291 } } // namespace v8::internal | 5284 } } // namespace v8::internal |
5292 | 5285 |
5293 #endif // V8_TARGET_ARCH_ARM | 5286 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |