Reviewers: titzer,

Description:
Implement lowering of JSStoreProperty to ICs.

[email protected]

Please review this at https://codereview.chromium.org/434343005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+36, -2 lines):
  M src/compiler/js-generic-lowering.cc


Index: src/compiler/js-generic-lowering.cc
diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc index f87006f08b4c4a5d8267099cd10ad9efa0e36580..a5e1a53fc86905beaabef10eb0cc5dcdd2eee217 100644
--- a/src/compiler/js-generic-lowering.cc
+++ b/src/compiler/js-generic-lowering.cc
@@ -29,6 +29,40 @@ static CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate,
 }


+// TODO(mstarzinger): This is a temporary shim to be able to call an IC stub +// which doesn't have an interface descriptor yet. It mimics a hydrogen code
+// stub for the underlying IC stub code.
+class KeyedStoreICStubShim : public HydrogenCodeStub {
+ public:
+  KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode)
+      : HydrogenCodeStub(isolate), strict_mode_(strict_mode) {
+    i::compiler::GetInterfaceDescriptor(isolate, this);
+  }
+
+  virtual Handle<Code> GenerateCode() V8_OVERRIDE {
+    return strict_mode_ == SLOPPY
+               ? isolate()->builtins()->KeyedStoreIC_Initialize()
+               : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
+  }
+
+  virtual void InitializeInterfaceDescriptor(
+      CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
+    Register registers[] = { InterfaceDescriptor::ContextRegister(),
+                             KeyedStoreIC::ReceiverRegister(),
+                             KeyedStoreIC::NameRegister(),
+                             KeyedStoreIC::ValueRegister() };
+    descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
+  }
+
+ private:
+  virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
+  virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
+  virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
+
+  StrictMode strict_mode_;
+};
+
+
JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph,
                                      MachineOperatorBuilder* machine,
                                      SourcePositionTable* source_positions)
@@ -321,8 +355,8 @@ Node* JSGenericLowering::LowerJSStoreProperty(Node* node) {
   // TODO(mstarzinger): The strict_mode needs to be carried along in the
   // operator so that graphs are fully compositional for inlining.
   StrictMode strict_mode = info()->strict_mode();
-  PatchInsertInput(node, 3, SmiConstant(strict_mode));
-  ReplaceWithRuntimeCall(node, Runtime::kSetProperty, 4);
+  KeyedStoreICStubShim stub(isolate(), strict_mode);
+  ReplaceWithICStubCall(node, &stub);
   return node;
 }



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to