OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1048 void RegExpMacroAssemblerARM::WriteStackPointerToRegister(int reg) { | 1048 void RegExpMacroAssemblerARM::WriteStackPointerToRegister(int reg) { |
1049 __ ldr(r1, MemOperand(frame_pointer(), kStackHighEnd)); | 1049 __ ldr(r1, MemOperand(frame_pointer(), kStackHighEnd)); |
1050 __ sub(r0, backtrack_stackpointer(), r1); | 1050 __ sub(r0, backtrack_stackpointer(), r1); |
1051 __ str(r0, register_location(reg)); | 1051 __ str(r0, register_location(reg)); |
1052 } | 1052 } |
1053 | 1053 |
1054 | 1054 |
1055 // Private methods: | 1055 // Private methods: |
1056 | 1056 |
1057 void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) { | 1057 void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) { |
1058 static const int num_arguments = 3; | 1058 __ PrepareCallCFunction(3, scratch); |
1059 __ PrepareCallCFunction(num_arguments, scratch); | 1059 |
1060 // RegExp code frame pointer. | 1060 // RegExp code frame pointer. |
1061 __ mov(r2, frame_pointer()); | 1061 __ mov(r2, frame_pointer()); |
1062 // Code* of self. | 1062 // Code* of self. |
1063 __ mov(r1, Operand(masm_->CodeObject())); | 1063 __ mov(r1, Operand(masm_->CodeObject())); |
1064 // r0 becomes return address pointer. | 1064 |
1065 // We need to make room for the return address on the stack. | |
1066 int stack_alignment = OS::ActivationFrameAlignment(); | |
1067 if (stack_alignment < kPointerSize) stack_alignment = kPointerSize; | |
Benedikt Meurer
2013/09/10 11:07:06
Nit: I think we should simply ASSERT(IsAligned(sta
Rodolph Perfetta
2013/09/10 13:50:00
Done.
| |
1068 __ sub(sp, sp, Operand(stack_alignment)); | |
1069 | |
1070 // r0 will point to the return address, placed by DirectCEntry. | |
1071 __ mov(r0, sp); | |
1072 | |
1065 ExternalReference stack_guard_check = | 1073 ExternalReference stack_guard_check = |
1066 ExternalReference::re_check_stack_guard_state(isolate()); | 1074 ExternalReference::re_check_stack_guard_state(isolate()); |
1067 CallCFunctionUsingStub(stack_guard_check, num_arguments); | 1075 __ mov(ip, Operand(stack_guard_check)); |
1076 DirectCEntryStub stub; | |
1077 stub.GenerateCall(masm_, ip); | |
1078 | |
1079 // Drop the return address from the stack. | |
1080 __ add(sp, sp, Operand(stack_alignment)); | |
1081 | |
1082 if (OS::ActivationFrameAlignment() != 0) { | |
Benedikt Meurer
2013/09/10 11:07:06
Nit: We can also safely assert that the stack_alig
Rodolph Perfetta
2013/09/10 13:50:00
Done.
| |
1083 __ ldr(sp, MemOperand(sp, 0)); | |
1084 } | |
1085 __ mov(code_pointer(), Operand(masm_->CodeObject())); | |
1068 } | 1086 } |
1069 | 1087 |
1070 | 1088 |
1071 // Helper function for reading a value out of a stack frame. | 1089 // Helper function for reading a value out of a stack frame. |
1072 template <typename T> | 1090 template <typename T> |
1073 static T& frame_entry(Address re_frame, int frame_offset) { | 1091 static T& frame_entry(Address re_frame, int frame_offset) { |
1074 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); | 1092 return reinterpret_cast<T&>(Memory::int32_at(re_frame + frame_offset)); |
1075 } | 1093 } |
1076 | 1094 |
1077 | 1095 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1287 __ jmp(&new_pool_skip); | 1305 __ jmp(&new_pool_skip); |
1288 EmitBacktrackConstantPool(); | 1306 EmitBacktrackConstantPool(); |
1289 __ bind(&new_pool_skip); | 1307 __ bind(&new_pool_skip); |
1290 int offset = backtrack_constant_pool_offset_; | 1308 int offset = backtrack_constant_pool_offset_; |
1291 backtrack_constant_pool_offset_ += kPointerSize; | 1309 backtrack_constant_pool_offset_ += kPointerSize; |
1292 backtrack_constant_pool_capacity_--; | 1310 backtrack_constant_pool_capacity_--; |
1293 return offset; | 1311 return offset; |
1294 } | 1312 } |
1295 | 1313 |
1296 | 1314 |
1297 void RegExpMacroAssemblerARM::CallCFunctionUsingStub( | |
1298 ExternalReference function, | |
1299 int num_arguments) { | |
1300 // Must pass all arguments in registers. The stub pushes on the stack. | |
1301 ASSERT(num_arguments <= 4); | |
1302 __ mov(code_pointer(), Operand(function)); | |
1303 RegExpCEntryStub stub; | |
1304 __ CallStub(&stub); | |
1305 if (OS::ActivationFrameAlignment() != 0) { | |
1306 __ ldr(sp, MemOperand(sp, 0)); | |
1307 } | |
1308 __ mov(code_pointer(), Operand(masm_->CodeObject())); | |
1309 } | |
1310 | |
1311 | |
1312 bool RegExpMacroAssemblerARM::CanReadUnaligned() { | 1315 bool RegExpMacroAssemblerARM::CanReadUnaligned() { |
1313 return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe(); | 1316 return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe(); |
1314 } | 1317 } |
1315 | 1318 |
1316 | 1319 |
1317 void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset, | 1320 void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset, |
1318 int characters) { | 1321 int characters) { |
1319 Register offset = current_input_offset(); | 1322 Register offset = current_input_offset(); |
1320 if (cp_offset != 0) { | 1323 if (cp_offset != 0) { |
1321 // r4 is not being used to store the capture start index at this point. | 1324 // r4 is not being used to store the capture start index at this point. |
(...skipping 22 matching lines...) Expand all Loading... | |
1344 if (characters == 2) { | 1347 if (characters == 2) { |
1345 __ ldr(current_character(), MemOperand(end_of_input_address(), offset)); | 1348 __ ldr(current_character(), MemOperand(end_of_input_address(), offset)); |
1346 } else { | 1349 } else { |
1347 ASSERT(characters == 1); | 1350 ASSERT(characters == 1); |
1348 __ ldrh(current_character(), MemOperand(end_of_input_address(), offset)); | 1351 __ ldrh(current_character(), MemOperand(end_of_input_address(), offset)); |
1349 } | 1352 } |
1350 } | 1353 } |
1351 } | 1354 } |
1352 | 1355 |
1353 | 1356 |
1354 void RegExpCEntryStub::Generate(MacroAssembler* masm_) { | |
1355 int stack_alignment = OS::ActivationFrameAlignment(); | |
1356 if (stack_alignment < kPointerSize) stack_alignment = kPointerSize; | |
1357 // Stack is already aligned for call, so decrement by alignment | |
1358 // to make room for storing the link register. | |
1359 __ str(lr, MemOperand(sp, stack_alignment, NegPreIndex)); | |
1360 __ mov(r0, sp); | |
1361 __ Call(r5); | |
1362 __ ldr(pc, MemOperand(sp, stack_alignment, PostIndex)); | |
1363 } | |
1364 | |
1365 #undef __ | 1357 #undef __ |
1366 | 1358 |
1367 #endif // V8_INTERPRETED_REGEXP | 1359 #endif // V8_INTERPRETED_REGEXP |
1368 | 1360 |
1369 }} // namespace v8::internal | 1361 }} // namespace v8::internal |
1370 | 1362 |
1371 #endif // V8_TARGET_ARCH_ARM | 1363 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |