Revision: 6907
Author: [email protected]
Date: Wed Feb 23 02:10:47 2011
Log: x64: Implement delete property in lithium backend.

Review URL: http://codereview.chromium.org/6570005
http://code.google.com/p/v8/source/detail?r=6907

Modified:
 /branches/bleeding_edge/src/ia32/lithium-ia32.cc
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
 /branches/bleeding_edge/src/x64/lithium-codegen-x64.h
 /branches/bleeding_edge/src/x64/lithium-x64.cc

=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Fri Feb 18 06:34:17 2011 +++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Wed Feb 23 02:10:47 2011
@@ -1940,8 +1940,8 @@


 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
-  LDeleteProperty* result = new LDeleteProperty(Use(instr->object()),
- UseOrConstant(instr->key()));
+  LDeleteProperty* result =
+ new LDeleteProperty(Use(instr->object()), UseOrConstant(instr->key()));
   return MarkAsCall(DefineFixed(result, eax), instr);
 }

=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Feb 23 01:51:53 2011 +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Wed Feb 23 02:10:47 2011
@@ -2190,18 +2190,7 @@
 void LCodeGen::DoPushArgument(LPushArgument* instr) {
   LOperand* argument = instr->InputAt(0);
   if (argument->IsConstantOperand()) {
-    LConstantOperand* const_op = LConstantOperand::cast(argument);
-    Handle<Object> literal = chunk_->LookupLiteral(const_op);
-    Representation r = chunk_->LookupLiteralRepresentation(const_op);
-    if (r.IsInteger32()) {
-      ASSERT(literal->IsNumber());
-      __ push(Immediate(static_cast<int32_t>(literal->Number())));
-    } else if (r.IsDouble()) {
-      Abort("unsupported double immediate");
-    } else {
-      ASSERT(r.IsTagged());
-      __ Push(literal);
-    }
+    EmitPushConstantOperand(argument);
   } else if (argument->IsRegister()) {
     __ push(ToRegister(argument));
   } else {
@@ -3241,6 +3230,23 @@
   __ SmiCompare(Operand(temp, StandardFrameConstants::kMarkerOffset),
                 Smi::FromInt(StackFrame::CONSTRUCT));
 }
+
+
+void LCodeGen::EmitPushConstantOperand(LOperand* operand) {
+  ASSERT(operand->IsConstantOperand());
+  LConstantOperand* const_op = LConstantOperand::cast(operand);
+  Handle<Object> literal = chunk_->LookupLiteral(const_op);
+  Representation r = chunk_->LookupLiteralRepresentation(const_op);
+  if (r.IsInteger32()) {
+    ASSERT(literal->IsNumber());
+    __ push(Immediate(static_cast<int32_t>(literal->Number())));
+  } else if (r.IsDouble()) {
+    Abort("unsupported double immediate");
+  } else {
+    ASSERT(r.IsTagged());
+    __ Push(literal);
+  }
+}


 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) {
@@ -3335,7 +3341,36 @@


 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) {
-  Abort("Unimplemented: %s", "DoDeleteProperty");
+  LOperand* obj = instr->object();
+  LOperand* key = instr->key();
+  // Push object.
+  if (obj->IsRegister()) {
+    __ push(ToRegister(obj));
+  } else {
+    __ push(ToOperand(obj));
+  }
+  // Push key.
+  if (key->IsConstantOperand()) {
+    EmitPushConstantOperand(key);
+  } else if (key->IsRegister()) {
+    __ push(ToRegister(key));
+  } else {
+    __ push(ToOperand(key));
+  }
+  ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment());
+  LPointerMap* pointers = instr->pointer_map();
+  LEnvironment* env = instr->deoptimization_environment();
+  RecordPosition(pointers->position());
+  RegisterEnvironmentForDeoptimization(env);
+  // Create safepoint generator that will also ensure enough space in the
+  // reloc info for patching in deoptimization (since this is invoking a
+  // builtin)
+  SafepointGenerator safepoint_generator(this,
+                                         pointers,
+                                         env->deoptimization_index(),
+                                         true);
+  __ Push(Smi::FromInt(strict_mode_flag()));
+  __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator);
 }


=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.h Tue Feb 22 08:56:57 2011 +++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.h Wed Feb 23 02:10:47 2011
@@ -116,6 +116,10 @@
   bool is_generating() const { return status_ == GENERATING; }
   bool is_done() const { return status_ == DONE; }
   bool is_aborted() const { return status_ == ABORTED; }
+
+  int strict_mode_flag() const {
+    return info_->is_strict() ? kStrictMode : kNonStrictMode;
+  }

   LChunk* chunk() const { return chunk_; }
   Scope* scope() const { return scope_; }
@@ -226,6 +230,9 @@
   // Caller should branch on equal condition.
   void EmitIsConstructCall(Register temp);

+  // Emits code for pushing a constant operand.
+  void EmitPushConstantOperand(LOperand* operand);
+
   LChunk* const chunk_;
   MacroAssembler* const masm_;
   CompilationInfo* const info_;
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc      Wed Feb 23 01:51:53 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc      Wed Feb 23 02:10:47 2011
@@ -1883,8 +1883,9 @@


 LInstruction* LChunkBuilder::DoDeleteProperty(HDeleteProperty* instr) {
-  Abort("Unimplemented: %s", "DoDeleteProperty");
-  return NULL;
+  LDeleteProperty* result =
+ new LDeleteProperty(Use(instr->object()), UseOrConstant(instr->key()));
+  return MarkAsCall(DefineFixed(result, rax), instr);
 }


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

Reply via email to