| Index: src/arm/codegen-arm.cc
|
| ===================================================================
|
| --- src/arm/codegen-arm.cc (revision 4717)
|
| +++ src/arm/codegen-arm.cc (working copy)
|
| @@ -2726,7 +2726,6 @@
|
| #ifdef DEBUG
|
| int original_height = frame_->height();
|
| #endif
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| Comment cmnt(masm_, "[ FunctionLiteral");
|
|
|
| // Build the function info and instantiate it.
|
| @@ -2747,7 +2746,6 @@
|
| #ifdef DEBUG
|
| int original_height = frame_->height();
|
| #endif
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| Comment cmnt(masm_, "[ SharedFunctionInfoLiteral");
|
| InstantiateFunction(node->shared_function_info());
|
| ASSERT_EQ(original_height + 1, frame_->height());
|
| @@ -4041,37 +4039,35 @@
|
|
|
|
|
| void CodeGenerator::GenerateIsSmi(ZoneList<Expression*>* args) {
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| ASSERT(args->length() == 1);
|
| - LoadAndSpill(args->at(0));
|
| - frame_->EmitPop(r0);
|
| - __ tst(r0, Operand(kSmiTagMask));
|
| + Load(args->at(0));
|
| + Register reg = frame_->PopToRegister();
|
| + __ tst(reg, Operand(kSmiTagMask));
|
| cc_reg_ = eq;
|
| }
|
|
|
|
|
| void CodeGenerator::GenerateLog(ZoneList<Expression*>* args) {
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| // See comment in CodeGenerator::GenerateLog in codegen-ia32.cc.
|
| ASSERT_EQ(args->length(), 3);
|
| #ifdef ENABLE_LOGGING_AND_PROFILING
|
| if (ShouldGenerateLog(args->at(0))) {
|
| - LoadAndSpill(args->at(1));
|
| - LoadAndSpill(args->at(2));
|
| + Load(args->at(1));
|
| + Load(args->at(2));
|
| + frame_->SpillAll();
|
| + VirtualFrame::SpilledScope spilled_scope(frame_);
|
| __ CallRuntime(Runtime::kLog, 2);
|
| }
|
| #endif
|
| - __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
|
| - frame_->EmitPush(r0);
|
| + frame_->EmitPushRoot(Heap::kUndefinedValueRootIndex);
|
| }
|
|
|
|
|
| void CodeGenerator::GenerateIsNonNegativeSmi(ZoneList<Expression*>* args) {
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| ASSERT(args->length() == 1);
|
| - LoadAndSpill(args->at(0));
|
| - frame_->EmitPop(r0);
|
| - __ tst(r0, Operand(kSmiTagMask | 0x80000000u));
|
| + Load(args->at(0));
|
| + Register reg = frame_->PopToRegister();
|
| + __ tst(reg, Operand(kSmiTagMask | 0x80000000u));
|
| cc_reg_ = eq;
|
| }
|
|
|
| @@ -4102,22 +4098,23 @@
|
| // flatten the string, which will ensure that the answer is in the left hand
|
| // side the next time around.
|
| void CodeGenerator::GenerateFastCharCodeAt(ZoneList<Expression*>* args) {
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| ASSERT(args->length() == 2);
|
| Comment(masm_, "[ GenerateFastCharCodeAt");
|
|
|
| - LoadAndSpill(args->at(0));
|
| - LoadAndSpill(args->at(1));
|
| - frame_->EmitPop(r1); // Index.
|
| - frame_->EmitPop(r2); // String.
|
| + Load(args->at(0));
|
| + Load(args->at(1));
|
| + Register index = frame_->PopToRegister(); // Index.
|
| + Register string = frame_->PopToRegister(index); // String.
|
| + Register result = VirtualFrame::scratch0();
|
| + Register scratch = VirtualFrame::scratch1();
|
|
|
| Label slow_case;
|
| Label exit;
|
| StringHelper::GenerateFastCharCodeAt(masm_,
|
| - r2,
|
| - r1,
|
| - r3,
|
| - r0,
|
| + string,
|
| + index,
|
| + scratch,
|
| + result,
|
| &slow_case,
|
| &slow_case,
|
| &slow_case,
|
| @@ -4127,10 +4124,10 @@
|
| __ bind(&slow_case);
|
| // Move the undefined value into the result register, which will
|
| // trigger the slow case.
|
| - __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
|
| + __ LoadRoot(result, Heap::kUndefinedValueRootIndex);
|
|
|
| __ bind(&exit);
|
| - frame_->EmitPush(r0);
|
| + frame_->EmitPush(result);
|
| }
|
|
|
|
|
| @@ -4251,48 +4248,52 @@
|
|
|
|
|
| void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| ASSERT(args->length() == 0);
|
|
|
| + Register scratch0 = VirtualFrame::scratch0();
|
| + Register scratch1 = VirtualFrame::scratch1();
|
| // Get the frame pointer for the calling frame.
|
| - __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
| + __ ldr(scratch0, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
|
|
| // Skip the arguments adaptor frame if it exists.
|
| - Label check_frame_marker;
|
| - __ ldr(r1, MemOperand(r2, StandardFrameConstants::kContextOffset));
|
| - __ cmp(r1, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
| - __ b(ne, &check_frame_marker);
|
| - __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset));
|
| + __ ldr(scratch1,
|
| + MemOperand(scratch0, StandardFrameConstants::kContextOffset));
|
| + __ cmp(scratch1, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
| + __ ldr(scratch0,
|
| + MemOperand(scratch0, StandardFrameConstants::kCallerFPOffset), eq);
|
|
|
| // Check the marker in the calling frame.
|
| - __ bind(&check_frame_marker);
|
| - __ ldr(r1, MemOperand(r2, StandardFrameConstants::kMarkerOffset));
|
| - __ cmp(r1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
|
| + __ ldr(scratch1,
|
| + MemOperand(scratch0, StandardFrameConstants::kMarkerOffset));
|
| + __ cmp(scratch1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
|
| cc_reg_ = eq;
|
| }
|
|
|
|
|
| void CodeGenerator::GenerateArgumentsLength(ZoneList<Expression*>* args) {
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| ASSERT(args->length() == 0);
|
|
|
| - Label exit;
|
| + Register tos = frame_->GetTOSRegister();
|
| + Register scratch0 = VirtualFrame::scratch0();
|
| + Register scratch1 = VirtualFrame::scratch1();
|
|
|
| - // Get the number of formal parameters.
|
| - __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters())));
|
| -
|
| // Check if the calling frame is an arguments adaptor frame.
|
| - __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
| - __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
|
| - __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
| - __ b(ne, &exit);
|
| + __ ldr(scratch0,
|
| + MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
|
| + __ ldr(scratch1,
|
| + MemOperand(scratch0, StandardFrameConstants::kContextOffset));
|
| + __ cmp(scratch1, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
|
|
|
| + // Get the number of formal parameters.
|
| + __ mov(tos, Operand(Smi::FromInt(scope()->num_parameters())), LeaveCC, ne);
|
| +
|
| // Arguments adaptor case: Read the arguments length from the
|
| // adaptor frame.
|
| - __ ldr(r0, MemOperand(r2, ArgumentsAdaptorFrameConstants::kLengthOffset));
|
| + __ ldr(tos,
|
| + MemOperand(scratch0, ArgumentsAdaptorFrameConstants::kLengthOffset),
|
| + eq);
|
|
|
| - __ bind(&exit);
|
| - frame_->EmitPush(r0);
|
| + frame_->EmitPush(tos);
|
| }
|
|
|
|
|
| @@ -4731,15 +4732,14 @@
|
|
|
|
|
| void CodeGenerator::GenerateObjectEquals(ZoneList<Expression*>* args) {
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| ASSERT(args->length() == 2);
|
|
|
| // Load the two objects into registers and perform the comparison.
|
| - LoadAndSpill(args->at(0));
|
| - LoadAndSpill(args->at(1));
|
| - frame_->EmitPop(r0);
|
| - frame_->EmitPop(r1);
|
| - __ cmp(r0, r1);
|
| + Load(args->at(0));
|
| + Load(args->at(1));
|
| + Register lhs = frame_->PopToRegister();
|
| + Register rhs = frame_->PopToRegister(lhs);
|
| + __ cmp(lhs, rhs);
|
| cc_reg_ = eq;
|
| }
|
|
|
| @@ -5038,6 +5038,7 @@
|
| // after evaluating the left hand side (due to the shortcut
|
| // semantics), but the compiler must (statically) know if the result
|
| // of compiling the binary operation is materialized or not.
|
| + VirtualFrame::SpilledScope spilled_scope(frame_);
|
| if (node->op() == Token::AND) {
|
| JumpTarget is_true;
|
| LoadConditionAndSpill(node->left(),
|
| @@ -5049,8 +5050,7 @@
|
| JumpTarget pop_and_continue;
|
| JumpTarget exit;
|
|
|
| - __ ldr(r0, frame_->Top()); // Duplicate the stack top.
|
| - frame_->EmitPush(r0);
|
| + frame_->Dup();
|
| // Avoid popping the result if it converts to 'false' using the
|
| // standard ToBoolean() conversion as described in ECMA-262,
|
| // section 9.2, page 30.
|
| @@ -5059,7 +5059,7 @@
|
|
|
| // Pop the result of evaluating the first part.
|
| pop_and_continue.Bind();
|
| - frame_->EmitPop(r0);
|
| + frame_->Pop();
|
|
|
| // Evaluate right side expression.
|
| is_true.Bind();
|
| @@ -5096,8 +5096,7 @@
|
| JumpTarget pop_and_continue;
|
| JumpTarget exit;
|
|
|
| - __ ldr(r0, frame_->Top());
|
| - frame_->EmitPush(r0);
|
| + frame_->Dup();
|
| // Avoid popping the result if it converts to 'true' using the
|
| // standard ToBoolean() conversion as described in ECMA-262,
|
| // section 9.2, page 30.
|
| @@ -5106,7 +5105,7 @@
|
|
|
| // Pop the result of evaluating the first part.
|
| pop_and_continue.Bind();
|
| - frame_->EmitPop(r0);
|
| + frame_->Pop();
|
|
|
| // Evaluate right side expression.
|
| is_false.Bind();
|
| @@ -5141,7 +5140,6 @@
|
| Comment cmnt(masm_, "[ BinaryOperation");
|
|
|
| if (node->op() == Token::AND || node->op() == Token::OR) {
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| GenerateLogicalBooleanOperation(node);
|
| } else {
|
| // Optimize for the case where (at least) one of the expressions
|
| @@ -5194,9 +5192,7 @@
|
| #ifdef DEBUG
|
| int original_height = frame_->height();
|
| #endif
|
| - VirtualFrame::SpilledScope spilled_scope(frame_);
|
| - __ ldr(r0, frame_->Function());
|
| - frame_->EmitPush(r0);
|
| + frame_->EmitPush(MemOperand(frame_->Function()));
|
| ASSERT_EQ(original_height + 1, frame_->height());
|
| }
|
|
|
|
|