Author: [email protected]
Date: Tue Jul  7 12:00:24 2009
New Revision: 2381

Modified:
    branches/bleeding_edge/src/arm/codegen-arm.cc
    branches/bleeding_edge/src/x64/codegen-x64.cc

Log:
Port IsConstructCall optimization to x64 and ARM.
Review URL: http://codereview.chromium.org/149266

Modified: branches/bleeding_edge/src/arm/codegen-arm.cc
==============================================================================
--- branches/bleeding_edge/src/arm/codegen-arm.cc       (original)
+++ branches/bleeding_edge/src/arm/codegen-arm.cc       Tue Jul  7 12:00:24 2009
@@ -3453,8 +3453,22 @@
  void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
    VirtualFrame::SpilledScope spilled_scope;
    ASSERT(args->length() == 0);
-  frame_->CallRuntime(Runtime::kIsConstructCall, 0);
-  frame_->EmitPush(r0);
+
+  // Get the frame pointer for the calling frame.
+  __ ldr(r2, 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(ArgumentsAdaptorFrame::SENTINEL));
+  __ b(ne, &check_frame_marker);
+  __ ldr(r2, MemOperand(r2, StandardFrameConstants::kCallerFPOffset));
+
+  // Check the marker in the calling frame.
+  __ bind(&check_frame_marker);
+  __ ldr(r1, MemOperand(r2, StandardFrameConstants::kMarkerOffset));
+  __ cmp(r1, Operand(Smi::FromInt(StackFrame::CONSTRUCT)));
+  cc_reg_ = eq;
  }



Modified: branches/bleeding_edge/src/x64/codegen-x64.cc
==============================================================================
--- branches/bleeding_edge/src/x64/codegen-x64.cc       (original)
+++ branches/bleeding_edge/src/x64/codegen-x64.cc       Tue Jul  7 12:00:24 2009
@@ -3235,10 +3235,25 @@


  void CodeGenerator::GenerateIsConstructCall(ZoneList<Expression*>* args) {
-  // TODO(X64): Optimize this like it's done on IA-32.
    ASSERT(args->length() == 0);
-  Result answer = frame_->CallRuntime(Runtime::kIsConstructCall, 0);
-  frame_->Push(&answer);
+
+  // Get the frame pointer for the calling frame.
+  Result fp = allocator()->Allocate();
+  __ movq(fp.reg(), Operand(rbp, StandardFrameConstants::kCallerFPOffset));
+
+  // Skip the arguments adaptor frame if it exists.
+  Label check_frame_marker;
+  __ cmpq(Operand(fp.reg(), StandardFrameConstants::kContextOffset),
+          Immediate(ArgumentsAdaptorFrame::SENTINEL));
+  __ j(not_equal, &check_frame_marker);
+  __ movq(fp.reg(), Operand(fp.reg(),  
StandardFrameConstants::kCallerFPOffset));
+
+  // Check the marker in the calling frame.
+  __ bind(&check_frame_marker);
+  __ cmpq(Operand(fp.reg(), StandardFrameConstants::kMarkerOffset),
+          Immediate(Smi::FromInt(StackFrame::CONSTRUCT)));
+  fp.Unuse();
+  destination()->Split(equal);
  }



--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to