ARM: replace RegExpCEntryStub with DirectCEntryStub.

RegExpCEntryStub is therefore removed.

BUG=none
TEST=none
R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/23468015

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16618 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7bb32008
...@@ -6143,6 +6143,11 @@ void ICCompareStub::GenerateMiss(MacroAssembler* masm) { ...@@ -6143,6 +6143,11 @@ void ICCompareStub::GenerateMiss(MacroAssembler* masm) {
void DirectCEntryStub::Generate(MacroAssembler* masm) { void DirectCEntryStub::Generate(MacroAssembler* masm) {
// Place the return address on the stack, making the call
// GC safe. The RegExp backend also relies on this.
__ str(lr, MemOperand(sp, 0));
__ blx(ip); // Call the C++ function.
__ VFPEnsureFPSCRState(r2);
__ ldr(pc, MemOperand(sp, 0)); __ ldr(pc, MemOperand(sp, 0));
} }
...@@ -6151,21 +6156,9 @@ void DirectCEntryStub::GenerateCall(MacroAssembler* masm, ...@@ -6151,21 +6156,9 @@ void DirectCEntryStub::GenerateCall(MacroAssembler* masm,
Register target) { Register target) {
intptr_t code = intptr_t code =
reinterpret_cast<intptr_t>(GetCode(masm->isolate()).location()); reinterpret_cast<intptr_t>(GetCode(masm->isolate()).location());
__ Move(ip, target);
__ mov(lr, Operand(code, RelocInfo::CODE_TARGET)); __ mov(lr, Operand(code, RelocInfo::CODE_TARGET));
__ blx(lr); // Call the stub.
// Prevent literal pool emission during calculation of return address.
Assembler::BlockConstPoolScope block_const_pool(masm);
// Push return address (accessible to GC through exit frame pc).
// Note that using pc with str is deprecated.
Label start;
__ bind(&start);
__ add(ip, pc, Operand(Assembler::kInstrSize));
__ str(ip, MemOperand(sp, 0));
__ Jump(target); // Call the C++ function.
ASSERT_EQ(Assembler::kInstrSize + Assembler::kPcLoadDelta,
masm->SizeOfCodeGeneratedSince(&start));
__ VFPEnsureFPSCRState(r2);
} }
......
...@@ -465,23 +465,6 @@ class RecordWriteStub: public PlatformCodeStub { ...@@ -465,23 +465,6 @@ class RecordWriteStub: public PlatformCodeStub {
}; };
// Enter C code from generated RegExp code in a way that allows
// the C code to fix the return address in case of a GC.
// Currently only needed on ARM.
class RegExpCEntryStub: public PlatformCodeStub {
public:
RegExpCEntryStub() {}
virtual ~RegExpCEntryStub() {}
void Generate(MacroAssembler* masm);
private:
Major MajorKey() { return RegExpCEntry; }
int MinorKey() { return 0; }
bool NeedsImmovableCode() { return true; }
};
// Trampoline stub to call into native code. To call safely into native code // Trampoline stub to call into native code. To call safely into native code
// in the presence of compacting GC (which can move code objects) we need to // in the presence of compacting GC (which can move code objects) we need to
// keep the code which called into native pinned in the memory. Currently the // keep the code which called into native pinned in the memory. Currently the
......
...@@ -1055,16 +1055,34 @@ void RegExpMacroAssemblerARM::WriteStackPointerToRegister(int reg) { ...@@ -1055,16 +1055,34 @@ void RegExpMacroAssemblerARM::WriteStackPointerToRegister(int reg) {
// Private methods: // Private methods:
void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) { void RegExpMacroAssemblerARM::CallCheckStackGuardState(Register scratch) {
static const int num_arguments = 3; __ PrepareCallCFunction(3, scratch);
__ PrepareCallCFunction(num_arguments, scratch);
// RegExp code frame pointer. // RegExp code frame pointer.
__ mov(r2, frame_pointer()); __ mov(r2, frame_pointer());
// Code* of self. // Code* of self.
__ mov(r1, Operand(masm_->CodeObject())); __ mov(r1, Operand(masm_->CodeObject()));
// r0 becomes return address pointer.
// We need to make room for the return address on the stack.
int stack_alignment = OS::ActivationFrameAlignment();
ASSERT(IsAligned(stack_alignment, kPointerSize));
__ sub(sp, sp, Operand(stack_alignment));
// r0 will point to the return address, placed by DirectCEntry.
__ mov(r0, sp);
ExternalReference stack_guard_check = ExternalReference stack_guard_check =
ExternalReference::re_check_stack_guard_state(isolate()); ExternalReference::re_check_stack_guard_state(isolate());
CallCFunctionUsingStub(stack_guard_check, num_arguments); __ mov(ip, Operand(stack_guard_check));
DirectCEntryStub stub;
stub.GenerateCall(masm_, ip);
// Drop the return address from the stack.
__ add(sp, sp, Operand(stack_alignment));
ASSERT(stack_alignment != 0);
__ ldr(sp, MemOperand(sp, 0));
__ mov(code_pointer(), Operand(masm_->CodeObject()));
} }
...@@ -1294,21 +1312,6 @@ int RegExpMacroAssemblerARM::GetBacktrackConstantPoolEntry() { ...@@ -1294,21 +1312,6 @@ int RegExpMacroAssemblerARM::GetBacktrackConstantPoolEntry() {
} }
void RegExpMacroAssemblerARM::CallCFunctionUsingStub(
ExternalReference function,
int num_arguments) {
// Must pass all arguments in registers. The stub pushes on the stack.
ASSERT(num_arguments <= 4);
__ mov(code_pointer(), Operand(function));
RegExpCEntryStub stub;
__ CallStub(&stub);
if (OS::ActivationFrameAlignment() != 0) {
__ ldr(sp, MemOperand(sp, 0));
}
__ mov(code_pointer(), Operand(masm_->CodeObject()));
}
bool RegExpMacroAssemblerARM::CanReadUnaligned() { bool RegExpMacroAssemblerARM::CanReadUnaligned() {
return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe(); return CpuFeatures::IsSupported(UNALIGNED_ACCESSES) && !slow_safe();
} }
...@@ -1351,17 +1354,6 @@ void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset, ...@@ -1351,17 +1354,6 @@ void RegExpMacroAssemblerARM::LoadCurrentCharacterUnchecked(int cp_offset,
} }
void RegExpCEntryStub::Generate(MacroAssembler* masm_) {
int stack_alignment = OS::ActivationFrameAlignment();
if (stack_alignment < kPointerSize) stack_alignment = kPointerSize;
// Stack is already aligned for call, so decrement by alignment
// to make room for storing the link register.
__ str(lr, MemOperand(sp, stack_alignment, NegPreIndex));
__ mov(r0, sp);
__ Call(r5);
__ ldr(pc, MemOperand(sp, stack_alignment, PostIndex));
}
#undef __ #undef __
#endif // V8_INTERPRETED_REGEXP #endif // V8_INTERPRETED_REGEXP
......
...@@ -212,14 +212,6 @@ class RegExpMacroAssemblerARM: public NativeRegExpMacroAssembler { ...@@ -212,14 +212,6 @@ class RegExpMacroAssemblerARM: public NativeRegExpMacroAssembler {
// and increments it by a word size. // and increments it by a word size.
inline void Pop(Register target); inline void Pop(Register target);
// Calls a C function and cleans up the frame alignment done by
// by FrameAlign. The called function *is* allowed to trigger a garbage
// collection, but may not take more than four arguments (no arguments
// passed on the stack), and the first argument will be a pointer to the
// return address.
inline void CallCFunctionUsingStub(ExternalReference function,
int num_arguments);
Isolate* isolate() const { return masm_->isolate(); } Isolate* isolate() const { return masm_->isolate(); }
MacroAssembler* masm_; MacroAssembler* masm_;
......
...@@ -102,7 +102,6 @@ namespace internal { ...@@ -102,7 +102,6 @@ namespace internal {
V(GetProperty) \ V(GetProperty) \
V(SetProperty) \ V(SetProperty) \
V(InvokeBuiltin) \ V(InvokeBuiltin) \
V(RegExpCEntry) \
V(DirectCEntry) V(DirectCEntry)
#else #else
#define CODE_STUB_LIST_ARM(V) #define CODE_STUB_LIST_ARM(V)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment