Index: src/full-codegen/arm/full-codegen-arm.cc |
diff --git a/src/full-codegen/arm/full-codegen-arm.cc b/src/full-codegen/arm/full-codegen-arm.cc |
index 0b56202d032fb7bee2cb5bf065f20deaee68a71e..637eb2bcdabdba81a93fc3ab136b07a2b10586bf 100644 |
--- a/src/full-codegen/arm/full-codegen-arm.cc |
+++ b/src/full-codegen/arm/full-codegen-arm.cc |
@@ -1461,49 +1461,12 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, |
void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
Comment cmnt(masm_, "[ RegExpLiteral"); |
- Label materialized; |
- // Registers will be used as follows: |
- // r5 = materialized value (RegExp literal) |
- // r4 = JS function, literals array |
- // r3 = literal index |
- // r2 = RegExp pattern |
- // r1 = RegExp flags |
- // r0 = RegExp literal clone |
- __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
- __ ldr(r4, FieldMemOperand(r0, JSFunction::kLiteralsOffset)); |
- int literal_offset = LiteralsArray::OffsetOfLiteralAt(expr->literal_index()); |
- __ ldr(r5, FieldMemOperand(r4, literal_offset)); |
- __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); |
- __ cmp(r5, ip); |
- __ b(ne, &materialized); |
- |
- // Create regexp literal using runtime function. |
- // Result will be in r0. |
- __ mov(r3, Operand(Smi::FromInt(expr->literal_index()))); |
- __ mov(r2, Operand(expr->pattern())); |
- __ mov(r1, Operand(expr->flags())); |
- __ Push(r4, r3, r2, r1); |
- __ CallRuntime(Runtime::kMaterializeRegExpLiteral, 4); |
- __ mov(r5, r0); |
- |
- __ bind(&materialized); |
- int size = JSRegExp::kSize + JSRegExp::kInObjectFieldCount * kPointerSize; |
- Label allocated, runtime_allocate; |
- __ Allocate(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); |
- __ jmp(&allocated); |
- |
- __ bind(&runtime_allocate); |
- __ mov(r0, Operand(Smi::FromInt(size))); |
- __ Push(r5, r0); |
- __ CallRuntime(Runtime::kAllocateInNewSpace, 1); |
- __ pop(r5); |
- |
- __ bind(&allocated); |
- // After this, registers are used as follows: |
- // r0: Newly allocated regexp. |
- // r5: Materialized regexp. |
- // r2: temp. |
- __ CopyFields(r0, r5, d0, size / kPointerSize); |
+ __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
+ __ mov(r1, Operand(expr->pattern())); |
+ __ mov(r0, Operand(expr->flags())); |
+ FastCloneRegExpStub stub(isolate()); |
+ __ CallStub(&stub); |
context()->Plug(r0); |
} |