Reviewers: danno, dstence, michael_dawson,

Description:
PPC: Unify "runtime-style" IC functions with Runtime intrinsics

Port bc8041dc2b4c8431c5c2476496acd3b7b8b3f61e

Original commit message:
    Previous to this CL, ICs used a slightly different code idiom
    to get to C++ code from generated code than runtime intrinsics,
    using an IC_Utility class that in essence provided exactly
    the same functionality as Runtime::FunctionForId, but in its
    own quirky way.

    This CL unifies the two mechanisms, folding IC_Utility
    away by making all IC entry points in C++ code, e.g. IC
    miss handlers, full-fledged runtime intrinsics. This makes
    it possible to eliminate a bunch of ad-hoc declarations and
    adapters that the IC system had to needlessly re-invent.

    As a bonus and the original reason for this yak-shave:
    IC-related C++ runtime functions are now callable from
    TurboFan.

[email protected], [email protected], [email protected]
BUG=

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+22, -45 lines):
  M src/ic/ppc/handler-compiler-ppc.cc
  M src/ic/ppc/ic-ppc.cc
  M src/ppc/code-stubs-ppc.cc
  M src/ppc/debug-ppc.cc


Index: src/ic/ppc/handler-compiler-ppc.cc
diff --git a/src/ic/ppc/handler-compiler-ppc.cc b/src/ic/ppc/handler-compiler-ppc.cc index 8988b08e2c1749265eb670564f24283d8f010f47..e2732955fe61ed14e3eaa1d6df6068ce2928242e 100644
--- a/src/ic/ppc/handler-compiler-ppc.cc
+++ b/src/ic/ppc/handler-compiler-ppc.cc
@@ -221,10 +221,9 @@ static void PushInterceptorArguments(MacroAssembler* masm, Register receiver,

 static void CompileCallLoadPropertyWithInterceptor(
MacroAssembler* masm, Register receiver, Register holder, Register name,
-    Handle<JSObject> holder_obj, IC::UtilityId id) {
+    Handle<JSObject> holder_obj, Runtime::FunctionId id) {
   PushInterceptorArguments(masm, receiver, holder, name, holder_obj);
- __ CallExternalReference(ExternalReference(IC_Utility(id), masm->isolate()), - NamedLoadHandlerCompiler::kInterceptorArgsLength);
+  __ CallRuntime(id, NamedLoadHandlerCompiler::kInterceptorArgsLength);
 }


@@ -314,9 +313,7 @@ void NamedStoreHandlerCompiler::GenerateSlow(MacroAssembler* masm) {

// The slow case calls into the runtime to complete the store without causing // an IC miss that would otherwise cause a transition to the generic stub.
-  ExternalReference ref =
-      ExternalReference(IC_Utility(IC::kStoreIC_Slow), masm->isolate());
-  __ TailCallExternalReference(ref, 3, 1);
+  __ TailCallRuntime(Runtime::kStoreIC_Slow, 3, 1);
 }


@@ -327,9 +324,7 @@ void ElementHandlerCompiler::GenerateStoreSlow(MacroAssembler* masm) {

// The slow case calls into the runtime to complete the store without causing // an IC miss that would otherwise cause a transition to the generic stub.
-  ExternalReference ref =
- ExternalReference(IC_Utility(IC::kKeyedStoreIC_Slow), masm->isolate());
-  __ TailCallExternalReference(ref, 3, 1);
+  __ TailCallRuntime(Runtime::kKeyedStoreIC_Slow, 3, 1);
 }


@@ -661,7 +656,7 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptorWithFollowup(
     // of this method.)
     CompileCallLoadPropertyWithInterceptor(
         masm(), receiver(), holder_reg, this->name(), holder(),
-        IC::kLoadPropertyWithInterceptorOnly);
+        Runtime::kLoadPropertyWithInterceptorOnly);

     // Check if interceptor provided a value for property.  If it's
     // the case, return immediately.
@@ -693,10 +688,8 @@ void NamedLoadHandlerCompiler::GenerateLoadInterceptor(Register holder_reg) {
   PushInterceptorArguments(masm(), receiver(), holder_reg, this->name(),
                            holder());

-  ExternalReference ref = ExternalReference(
-      IC_Utility(IC::kLoadPropertyWithInterceptor), isolate());
-  __ TailCallExternalReference(
-      ref, NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
+  __ TailCallRuntime(Runtime::kLoadPropertyWithInterceptor,
+                     NamedLoadHandlerCompiler::kInterceptorArgsLength, 1);
 }


@@ -720,9 +713,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreCallback(
   __ Push(ip, value());

   // Do tail-call to the runtime system.
-  ExternalReference store_callback_property =
-      ExternalReference(IC_Utility(IC::kStoreCallbackProperty), isolate());
-  __ TailCallExternalReference(store_callback_property, 5, 1);
+  __ TailCallRuntime(Runtime::kStoreCallbackProperty, 5, 1);

   // Return the generated code.
   return GetCode(kind(), Code::FAST, name);
@@ -734,9 +725,7 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreInterceptor(
   __ Push(receiver(), this->name(), value());

   // Do tail-call to the runtime system.
-  ExternalReference store_ic_property = ExternalReference(
-      IC_Utility(IC::kStorePropertyWithInterceptor), isolate());
-  __ TailCallExternalReference(store_ic_property, 3, 1);
+  __ TailCallRuntime(Runtime::kStorePropertyWithInterceptor, 3, 1);

   // Return the generated code.
   return GetCode(kind(), Code::FAST, name);
Index: src/ic/ppc/ic-ppc.cc
diff --git a/src/ic/ppc/ic-ppc.cc b/src/ic/ppc/ic-ppc.cc
index db56fbaf669903a1271af0474de0d770031ebf1a..102dde4944af106ebcdbf35e5f63c17a7a68c319 100644
--- a/src/ic/ppc/ic-ppc.cc
+++ b/src/ic/ppc/ic-ppc.cc
@@ -323,9 +323,8 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) {
   LoadIC_PushArgs(masm);

   // Perform tail call to the entry.
- ExternalReference ref = ExternalReference(IC_Utility(kLoadIC_Miss), isolate);
   int arg_count = 4;
-  __ TailCallExternalReference(ref, arg_count, 1);
+  __ TailCallRuntime(Runtime::kLoadIC_Miss, arg_count, 1);
 }


@@ -354,10 +353,8 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) {
   LoadIC_PushArgs(masm);

   // Perform tail call to the entry.
-  ExternalReference ref =
-      ExternalReference(IC_Utility(kKeyedLoadIC_Miss), isolate);
   int arg_count = 4;
-  __ TailCallExternalReference(ref, arg_count, 1);
+  __ TailCallRuntime(Runtime::kKeyedLoadIC_Miss, arg_count, 1);
 }


@@ -482,9 +479,7 @@ void KeyedStoreIC::GenerateMiss(MacroAssembler* masm) {
__ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
           StoreDescriptor::ValueRegister());

-  ExternalReference ref =
-      ExternalReference(IC_Utility(kKeyedStoreIC_Miss), masm->isolate());
-  __ TailCallExternalReference(ref, 3, 1);
+  __ TailCallRuntime(Runtime::kKeyedStoreIC_Miss, 3, 1);
 }


@@ -790,9 +785,7 @@ void StoreIC::GenerateMiss(MacroAssembler* masm) {
           StoreDescriptor::ValueRegister());

   // Perform tail call to the entry.
-  ExternalReference ref =
-      ExternalReference(IC_Utility(kStoreIC_Miss), masm->isolate());
-  __ TailCallExternalReference(ref, 3, 1);
+  __ TailCallRuntime(Runtime::kStoreIC_Miss, 3, 1);
 }


Index: src/ppc/code-stubs-ppc.cc
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc
index c18f0f7d79365c4ab4c68284c3959191bd6e73cb..3bd5936752ddbacbfe983fa4ce61dde83bcf65dd 100644
--- a/src/ppc/code-stubs-ppc.cc
+++ b/src/ppc/code-stubs-ppc.cc
@@ -1973,10 +1973,7 @@ void LoadIndexedInterceptorStub::Generate(MacroAssembler* masm) {
   __ Push(receiver, key);  // Receiver, key.

   // Perform tail call to the entry.
-  __ TailCallExternalReference(
-      ExternalReference(IC_Utility(IC::kLoadElementWithInterceptor),
-                        masm->isolate()),
-      2, 1);
+  __ TailCallRuntime(Runtime::kLoadElementWithInterceptor, 2, 1);

   __ bind(&slow);
   PropertyAccessCompiler::TailCallBuiltin(
@@ -3087,11 +3084,10 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) {
   __ Push(r4, r5, r6);

   // Call the entry.
-  IC::UtilityId id = GetICState() == DEFAULT ? IC::kCallIC_Miss
- : IC::kCallIC_Customization_Miss;
-
- ExternalReference miss = ExternalReference(IC_Utility(id), masm->isolate());
-  __ CallExternalReference(miss, 3);
+  Runtime::FunctionId id = GetICState() == DEFAULT
+                               ? Runtime::kCallIC_Miss
+                               : Runtime::kCallIC_Customization_Miss;
+  __ CallRuntime(id, 3);

   // Move result to r4 and exit the internal frame.
   __ mr(r4, r3);
@@ -4046,15 +4042,12 @@ void CompareICStub::GenerateKnownObjects(MacroAssembler* masm) {
 void CompareICStub::GenerateMiss(MacroAssembler* masm) {
   {
     // Call the runtime system in a fresh internal frame.
-    ExternalReference miss =
-        ExternalReference(IC_Utility(IC::kCompareIC_Miss), isolate());
-
     FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
     __ Push(r4, r3);
     __ Push(r4, r3);
     __ LoadSmiLiteral(r0, Smi::FromInt(op()));
     __ push(r0);
-    __ CallExternalReference(miss, 3);
+    __ CallRuntime(Runtime::kCompareIC_Miss, 3);
     // Compute the entry point of the rewritten stub.
     __ addi(r5, r3, Operand(Code::kHeaderSize - kHeapObjectTag));
     // Restore registers.
Index: src/ppc/debug-ppc.cc
diff --git a/src/ppc/debug-ppc.cc b/src/ppc/debug-ppc.cc
index d4c41f3bb7c3f2d37c4fb00c80ac50c64772facb..fbc1629efa0dfc35ac9fc074737cb4ed4cffbe3e 100644
--- a/src/ppc/debug-ppc.cc
+++ b/src/ppc/debug-ppc.cc
@@ -84,7 +84,9 @@ void DebugCodegen::GenerateDebugBreakStub(MacroAssembler* masm,
     if (mode == SAVE_RESULT_REGISTER) __ push(r3);

     __ mov(r3, Operand::Zero());  // no arguments
-    __ mov(r4, Operand(ExternalReference::debug_break(masm->isolate())));
+    __ mov(r4,
+           Operand(ExternalReference(
+ Runtime::FunctionForId(Runtime::kDebugBreak), masm->isolate())));

     CEntryStub ceb(masm->isolate(), 1);
     __ CallStub(&ceb);


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