Revision: 23405
Author:   [email protected]
Date:     Tue Aug 26 14:12:47 2014 UTC
Log:      Added vector-based loadic hydrogen stubs. Not yet callable.

The next step is to integrate the use of vector[slot] into the IC
infrastructure so it can do the right thing for a vector-based ic.
Then these stubs can be installed. For now, they immediately bail out
to the miss handler.

[email protected]

Review URL: https://codereview.chromium.org/499343002
https://code.google.com/p/v8/source/detail?r=23405

Modified:
 /branches/bleeding_edge/src/arm/code-stubs-arm.cc
 /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc
 /branches/bleeding_edge/src/code-stubs-hydrogen.cc
 /branches/bleeding_edge/src/code-stubs.cc
 /branches/bleeding_edge/src/code-stubs.h
 /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
 /branches/bleeding_edge/src/ic/ic.cc
 /branches/bleeding_edge/src/ic/ic.h
 /branches/bleeding_edge/src/x64/code-stubs-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Aug 26 13:10:01 2014 UTC +++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Aug 26 14:12:47 2014 UTC
@@ -4590,6 +4590,20 @@
   __ add(sp, sp, r1);
   __ Ret();
 }
+
+
+void LoadICTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister());
+  VectorLoadStub stub(isolate(), state_);
+  __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
+}
+
+
+void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister());
+  VectorKeyedLoadStub stub(isolate());
+  __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
+}


 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
=======================================
--- /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Tue Aug 26 13:10:01 2014 UTC +++ /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Tue Aug 26 14:12:47 2014 UTC
@@ -4598,6 +4598,20 @@
   // Return to IC Miss stub, continuation still on stack.
   __ Ret();
 }
+
+
+void LoadICTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister());
+  VectorLoadStub stub(isolate(), state_);
+  __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
+}
+
+
+void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister());
+  VectorKeyedLoadStub stub(isolate());
+  __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET);
+}


 static unsigned int GetProfileEntryHookCallSize(MacroAssembler* masm) {
=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Tue Aug 26 09:50:09 2014 UTC +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Tue Aug 26 14:12:47 2014 UTC
@@ -1790,4 +1790,26 @@
 }


+template <>
+HValue* CodeStubGraphBuilder<VectorLoadStub>::BuildCodeStub() {
+ HValue* receiver = GetParameter(FullVectorLoadConvention::kReceiverIndex);
+  Add<HDeoptimize>("Always deopt", Deoptimizer::EAGER);
+  return receiver;
+}
+
+
+Handle<Code> VectorLoadStub::GenerateCode() { return DoGenerateCode(this); }
+
+
+template <>
+HValue* CodeStubGraphBuilder<VectorKeyedLoadStub>::BuildCodeStub() {
+ HValue* receiver = GetParameter(FullVectorLoadConvention::kReceiverIndex);
+  Add<HDeoptimize>("Always deopt", Deoptimizer::EAGER);
+  return receiver;
+}
+
+
+Handle<Code> VectorKeyedLoadStub::GenerateCode() {
+  return DoGenerateCode(this);
+}
 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/code-stubs.cc   Tue Aug 26 13:10:01 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.cc   Tue Aug 26 14:12:47 2014 UTC
@@ -662,6 +662,35 @@
                            InstanceofStub::right() };
   descriptor->Initialize(MajorKey(), arraysize(registers), registers);
 }
+
+
+static void InitializeVectorLoadStub(CodeStubInterfaceDescriptor* descriptor,
+                                     CodeStub::Major major,
+                                     Address deoptimization_handler) {
+  DCHECK(FLAG_vector_ics);
+  Register registers[] = {InterfaceDescriptor::ContextRegister(),
+                          FullVectorLoadConvention::ReceiverRegister(),
+                          FullVectorLoadConvention::NameRegister(),
+                          FullVectorLoadConvention::SlotRegister(),
+                          FullVectorLoadConvention::VectorRegister()};
+  descriptor->Initialize(major, arraysize(registers), registers,
+                         deoptimization_handler);
+}
+
+
+void VectorLoadStub::InitializeInterfaceDescriptor(
+    CodeStubInterfaceDescriptor* descriptor) {
+  InitializeVectorLoadStub(descriptor, MajorKey(),
+ FUNCTION_ADDR(VectorLoadIC_MissFromStubFailure));
+}
+
+
+void VectorKeyedLoadStub::InitializeInterfaceDescriptor(
+    CodeStubInterfaceDescriptor* descriptor) {
+  InitializeVectorLoadStub(
+      descriptor, MajorKey(),
+      FUNCTION_ADDR(VectorKeyedLoadIC_MissFromStubFailure));
+}


 void LoadDictionaryElementPlatformStub::Generate(MacroAssembler* masm) {
=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Tue Aug 26 13:10:01 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.h    Tue Aug 26 14:12:47 2014 UTC
@@ -76,6 +76,10 @@
   V(StoreGlobal)                            \
   V(CallApiFunction)                        \
   V(CallApiGetter)                          \
+  V(LoadICTrampoline)                       \
+  V(VectorLoad)                             \
+  V(KeyedLoadICTrampoline)                  \
+  V(VectorKeyedLoad)                        \
   /* IC Handler stubs */                    \
   V(LoadField)                              \
   V(StoreField)                             \
@@ -1937,6 +1941,106 @@
 };


+class LoadICTrampolineStub : public PlatformCodeStub {
+ public:
+  LoadICTrampolineStub(Isolate* isolate, const LoadIC::State& state)
+      : PlatformCodeStub(isolate), state_(state) {}
+
+ virtual Code::Kind GetCodeKind() const V8_OVERRIDE { return Code::LOAD_IC; }
+
+  virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE {
+    return GENERIC;
+  }
+
+  virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE {
+    return state_.GetExtraICState();
+  }
+
+ private:
+  Major MajorKey() const { return LoadICTrampoline; }
+  uint32_t MinorKey() const { return GetExtraICState(); }
+
+  virtual void Generate(MacroAssembler* masm);
+
+  const LoadIC::State state_;
+
+  DISALLOW_COPY_AND_ASSIGN(LoadICTrampolineStub);
+};
+
+
+class KeyedLoadICTrampolineStub : public LoadICTrampolineStub {
+ public:
+  explicit KeyedLoadICTrampolineStub(Isolate* isolate)
+      : LoadICTrampolineStub(isolate, LoadIC::State(0)) {}
+
+  virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
+    return Code::KEYED_LOAD_IC;
+  }
+
+ private:
+  Major MajorKey() const { return KeyedLoadICTrampoline; }
+
+  virtual void Generate(MacroAssembler* masm);
+
+  DISALLOW_COPY_AND_ASSIGN(KeyedLoadICTrampolineStub);
+};
+
+
+class VectorLoadStub : public HydrogenCodeStub {
+ public:
+  explicit VectorLoadStub(Isolate* isolate, const LoadIC::State& state)
+      : HydrogenCodeStub(isolate), state_(state) {}
+
+  virtual Handle<Code> GenerateCode() V8_OVERRIDE;
+
+  virtual void InitializeInterfaceDescriptor(
+      CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
+
+  static void InstallDescriptors(Isolate* isolate);
+
+ virtual Code::Kind GetCodeKind() const V8_OVERRIDE { return Code::LOAD_IC; }
+
+  virtual InlineCacheState GetICState() const V8_FINAL V8_OVERRIDE {
+    return GENERIC;
+  }
+
+  virtual ExtraICState GetExtraICState() const V8_FINAL V8_OVERRIDE {
+    return state_.GetExtraICState();
+  }
+
+ private:
+  Major MajorKey() const { return VectorLoad; }
+  int NotMissMinorKey() const { return state_.GetExtraICState(); }
+
+  const LoadIC::State state_;
+
+  DISALLOW_COPY_AND_ASSIGN(VectorLoadStub);
+};
+
+
+class VectorKeyedLoadStub : public VectorLoadStub {
+ public:
+  explicit VectorKeyedLoadStub(Isolate* isolate)
+      : VectorLoadStub(isolate, LoadIC::State(0)) {}
+
+  virtual Handle<Code> GenerateCode() V8_OVERRIDE;
+
+  virtual void InitializeInterfaceDescriptor(
+      CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
+
+  static void InstallDescriptors(Isolate* isolate);
+
+  virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
+    return Code::KEYED_LOAD_IC;
+  }
+
+ private:
+  Major MajorKey() const { return VectorKeyedLoad; }
+
+  DISALLOW_COPY_AND_ASSIGN(VectorKeyedLoadStub);
+};
+
+
 class DoubleToIStub : public PlatformCodeStub {
  public:
   DoubleToIStub(Isolate* isolate, Register source, Register destination,
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Aug 26 13:10:01 2014 UTC +++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Aug 26 14:12:47 2014 UTC
@@ -4498,6 +4498,20 @@
   __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset));
   __ jmp(ecx);  // Return to IC Miss stub, continuation still on stack.
 }
+
+
+void LoadICTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister());
+  VectorLoadStub stub(isolate(), state_);
+  __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
+}
+
+
+void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister());
+  VectorKeyedLoadStub stub(isolate());
+  __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
+}


 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
=======================================
--- /branches/bleeding_edge/src/ic/ic.cc        Mon Aug 25 11:34:43 2014 UTC
+++ /branches/bleeding_edge/src/ic/ic.cc        Tue Aug 26 14:12:47 2014 UTC
@@ -3187,6 +3187,20 @@
       JSObject::GetElementWithInterceptor(receiver, receiver, index));
   return *result;
 }
+
+
+RUNTIME_FUNCTION(VectorLoadIC_MissFromStubFailure) {
+  // TODO(mvstanton): To be enabled when ICs can accept a vector and slot
+  DCHECK(!"Not yet implemented");
+  return NULL;
+}
+
+
+RUNTIME_FUNCTION(VectorKeyedLoadIC_MissFromStubFailure) {
+  // TODO(mvstanton): To be enabled when ICs can accept a vector and slot
+  DCHECK(!"Not yet implemented");
+  return NULL;
+}


 static const Address IC_utilities[] = {
=======================================
--- /branches/bleeding_edge/src/ic/ic.h Tue Aug 26 09:50:09 2014 UTC
+++ /branches/bleeding_edge/src/ic/ic.h Tue Aug 26 14:12:47 2014 UTC
@@ -923,6 +923,8 @@
 DECLARE_RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite);
 DECLARE_RUNTIME_FUNCTION(CompareNilIC_Miss);
 DECLARE_RUNTIME_FUNCTION(ToBooleanIC_Miss);
+DECLARE_RUNTIME_FUNCTION(VectorLoadIC_MissFromStubFailure);
+DECLARE_RUNTIME_FUNCTION(VectorKeyedLoadIC_MissFromStubFailure);

 // Support functions for callbacks handlers.
 DECLARE_RUNTIME_FUNCTION(StoreCallbackProperty);
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Aug 26 13:10:01 2014 UTC +++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Aug 26 14:12:47 2014 UTC
@@ -4438,6 +4438,20 @@
__ leap(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset));
   __ jmp(rcx);  // Return to IC Miss stub, continuation still on stack.
 }
+
+
+void LoadICTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister());
+  VectorLoadStub stub(isolate(), state_);
+  __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
+}
+
+
+void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) {
+ EmitLoadTypeFeedbackVector(masm, FullVectorLoadConvention::VectorRegister());
+  VectorKeyedLoadStub stub(isolate());
+  __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET);
+}


 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {

--
--
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