Revision: 24122
Author:   [email protected]
Date:     Mon Sep 22 13:56:03 2014 UTC
Log:      [turbofan] don't call out to c

[email protected]

BUG=

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

Modified:
 /branches/bleeding_edge/src/compiler/arm/code-generator-arm.cc
 /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc
 /branches/bleeding_edge/src/compiler/arm64/code-generator-arm64.cc
 /branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc
 /branches/bleeding_edge/src/compiler/ia32/code-generator-ia32.cc
 /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc
 /branches/bleeding_edge/src/compiler/instruction-codes.h
 /branches/bleeding_edge/src/compiler/raw-machine-assembler.h
 /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc
 /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc
 /branches/bleeding_edge/test/cctest/cctest.status
 /branches/bleeding_edge/test/cctest/compiler/test-run-machops.cc

=======================================
--- /branches/bleeding_edge/src/compiler/arm/code-generator-arm.cc Fri Sep 12 15:09:51 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm/code-generator-arm.cc Mon Sep 22 13:56:03 2014 UTC
@@ -136,12 +136,6 @@
   ArmOperandConverter i(this, instr);

   switch (ArchOpcodeField::decode(instr->opcode())) {
-    case kArchCallAddress: {
-      DirectCEntryStub stub(isolate());
-      stub.GenerateCall(masm(), i.InputRegister(0));
-      DCHECK_EQ(LeaveCC, i.OutputSBit());
-      break;
-    }
     case kArchCallCodeObject: {
       if (instr->InputAt(0)->IsImmediate()) {
         __ Call(Handle<Code>::cast(i.InputHeapObject(0)),
@@ -169,13 +163,6 @@
       DCHECK_EQ(LeaveCC, i.OutputSBit());
       break;
     }
-    case kArchDrop: {
-      int words = MiscField::decode(instr->opcode());
-      __ Drop(words);
-      DCHECK_LT(0, words);
-      DCHECK_EQ(LeaveCC, i.OutputSBit());
-      break;
-    }
     case kArchJmp:
       __ b(code_->GetLabel(i.InputBlock(0)));
       DCHECK_EQ(LeaveCC, i.OutputSBit());
=======================================
--- /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc Thu Sep 11 10:37:49 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc Mon Sep 22 13:56:03 2014 UTC
@@ -68,10 +68,8 @@
       case kArmStrh:
         return value >= -255 && value <= 255;

-      case kArchCallAddress:
       case kArchCallCodeObject:
       case kArchCallJSFunction:
-      case kArchDrop:
       case kArchJmp:
       case kArchNop:
       case kArchRet:
@@ -803,9 +801,6 @@
       opcode = kArchCallCodeObject;
       break;
     }
-    case CallDescriptor::kCallAddress:
-      opcode = kArchCallAddress;
-      break;
     case CallDescriptor::kCallJSFunction:
       opcode = kArchCallJSFunction;
       break;
@@ -825,13 +820,6 @@
     DCHECK(continuation != NULL);
     call_instr->MarkAsControl();
   }
-
-  // Caller clean up of stack for C-style calls.
-  if (descriptor->kind() == CallDescriptor::kCallAddress &&
-      !buffer.pushed_nodes.empty()) {
-    DCHECK(deoptimization == NULL && continuation == NULL);
-    Emit(kArchDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL);
-  }
 }


=======================================
--- /branches/bleeding_edge/src/compiler/arm64/code-generator-arm64.cc Fri Sep 12 09:18:43 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm64/code-generator-arm64.cc Mon Sep 22 13:56:03 2014 UTC
@@ -131,11 +131,6 @@
   Arm64OperandConverter i(this, instr);
   InstructionCode opcode = instr->opcode();
   switch (ArchOpcodeField::decode(opcode)) {
-    case kArchCallAddress: {
-      DirectCEntryStub stub(isolate());
-      stub.GenerateCall(masm(), i.InputRegister(0));
-      break;
-    }
     case kArchCallCodeObject: {
       if (instr->InputAt(0)->IsImmediate()) {
         __ Call(Handle<Code>::cast(i.InputHeapObject(0)),
@@ -163,11 +158,6 @@
       AddSafepointAndDeopt(instr);
       break;
     }
-    case kArchDrop: {
-      int words = MiscField::decode(instr->opcode());
-      __ Drop(words);
-      break;
-    }
     case kArchJmp:
       __ B(code_->GetLabel(i.InputBlock(0)));
       break;
=======================================
--- /branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc Mon Sep 22 12:32:23 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc Mon Sep 22 13:56:03 2014 UTC
@@ -630,12 +630,8 @@
   InitializeCallBuffer(call, &buffer, true, false);

   // Push the arguments to the stack.
-  bool is_c_frame = descriptor->kind() == CallDescriptor::kCallAddress;
   bool pushed_count_uneven = buffer.pushed_nodes.size() & 1;
   int aligned_push_count = buffer.pushed_nodes.size();
-  if (is_c_frame && pushed_count_uneven) {
-    aligned_push_count++;
-  }
   // TODO(dcarney): claim and poke probably take small immediates,
   //                loop here or whatever.
   // Bump the stack pointer(s).
@@ -650,8 +646,7 @@
     // Emit the uneven pushes.
     if (pushed_count_uneven) {
       Node* input = buffer.pushed_nodes[slot];
-      ArchOpcode opcode = is_c_frame ? kArm64PokePairZero : kArm64Poke;
-      Emit(opcode | MiscField::encode(slot), NULL, g.UseRegister(input));
+ Emit(kArm64Poke | MiscField::encode(slot), NULL, g.UseRegister(input));
       slot--;
     }
     // Now all pushes can be done in pairs.
@@ -669,9 +664,6 @@
       opcode = kArchCallCodeObject;
       break;
     }
-    case CallDescriptor::kCallAddress:
-      opcode = kArchCallAddress;
-      break;
     case CallDescriptor::kCallJSFunction:
       opcode = kArchCallJSFunction;
       break;
@@ -691,12 +683,6 @@
     DCHECK(continuation != NULL);
     call_instr->MarkAsControl();
   }
-
-  // Caller clean up of stack for C-style calls.
-  if (is_c_frame && aligned_push_count > 0) {
-    DCHECK(deoptimization == NULL && continuation == NULL);
-    Emit(kArchDrop | MiscField::encode(aligned_push_count), NULL);
-  }
 }

 }  // namespace compiler
=======================================
--- /branches/bleeding_edge/src/compiler/ia32/code-generator-ia32.cc Fri Sep 19 14:25:13 2014 UTC +++ /branches/bleeding_edge/src/compiler/ia32/code-generator-ia32.cc Mon Sep 22 13:56:03 2014 UTC
@@ -111,15 +111,6 @@
   IA32OperandConverter i(this, instr);

   switch (ArchOpcodeField::decode(instr->opcode())) {
-    case kArchCallAddress:
-      if (HasImmediateInput(instr, 0)) {
- // TODO(dcarney): wire up EXTERNAL_REFERENCE instead of RUNTIME_ENTRY.
-        __ call(reinterpret_cast<byte*>(i.InputInt32(0)),
-                RelocInfo::RUNTIME_ENTRY);
-      } else {
-        __ call(i.InputRegister(0));
-      }
-      break;
     case kArchCallCodeObject: {
       if (HasImmediateInput(instr, 0)) {
         Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
@@ -142,11 +133,6 @@
       AddSafepointAndDeopt(instr);
       break;
     }
-    case kArchDrop: {
-      int words = MiscField::decode(instr->opcode());
-      __ add(esp, Immediate(kPointerSize * words));
-      break;
-    }
     case kArchJmp:
       __ jmp(code()->GetLabel(i.InputBlock(0)));
       break;
=======================================
--- /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc Fri Sep 19 14:25:13 2014 UTC +++ /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc Mon Sep 22 13:56:03 2014 UTC
@@ -531,9 +531,6 @@
       opcode = kArchCallCodeObject;
       break;
     }
-    case CallDescriptor::kCallAddress:
-      opcode = kArchCallAddress;
-      break;
     case CallDescriptor::kCallJSFunction:
       opcode = kArchCallJSFunction;
       break;
@@ -553,13 +550,6 @@
     DCHECK(continuation != NULL);
     call_instr->MarkAsControl();
   }
-
-  // Caller clean up of stack for C-style calls.
-  if (descriptor->kind() == CallDescriptor::kCallAddress &&
-      buffer.pushed_nodes.size() > 0) {
-    DCHECK(deoptimization == NULL && continuation == NULL);
-    Emit(kArchDrop | MiscField::encode(buffer.pushed_nodes.size()), NULL);
-  }
 }

 }  // namespace compiler
=======================================
--- /branches/bleeding_edge/src/compiler/instruction-codes.h Mon Sep 1 09:31:14 2014 UTC +++ /branches/bleeding_edge/src/compiler/instruction-codes.h Mon Sep 22 13:56:03 2014 UTC
@@ -29,10 +29,8 @@
 // Target-specific opcodes that specify which assembly sequence to emit.
 // Most opcodes specify a single instruction.
 #define ARCH_OPCODE_LIST(V) \
-  V(ArchCallAddress)        \
   V(ArchCallCodeObject)     \
   V(ArchCallJSFunction)     \
-  V(ArchDrop)               \
   V(ArchJmp)                \
   V(ArchNop)                \
   V(ArchRet)                \
=======================================
--- /branches/bleeding_edge/src/compiler/raw-machine-assembler.h Fri Sep 12 11:59:26 2014 UTC +++ /branches/bleeding_edge/src/compiler/raw-machine-assembler.h Mon Sep 22 13:56:03 2014 UTC
@@ -5,12 +5,6 @@
 #ifndef V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_
 #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_

-#ifdef USE_SIMULATOR
-#define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 0
-#else
-#define MACHINE_ASSEMBLER_SUPPORTS_CALL_C 1
-#endif
-
 #include "src/v8.h"

 #include "src/compiler/common-operator.h"
@@ -374,21 +368,6 @@
   Node* TruncateInt64ToInt32(Node* a) {
     return NewNode(machine()->TruncateInt64ToInt32(), a);
   }
-
-#ifdef MACHINE_ASSEMBLER_SUPPORTS_CALL_C
-  // Call to C.
-  Node* CallC(Node* function_address, MachineType return_type,
-              MachineType* arg_types, Node** args, int n_args) {
-    CallDescriptor* descriptor =
-        Linkage::GetSimplifiedCDescriptor(zone(), machine_sig());
-    Node** passed_args = zone()->NewArray<Node*>(n_args + 1);
-    passed_args[0] = function_address;
-    for (int i = 0; i < n_args; ++i) {
-      passed_args[i + 1] = args[i];
-    }
-    return NewNode(common()->Call(descriptor), n_args + 1, passed_args);
-  }
-#endif

   // Parameters.
   Node* Parameter(size_t index);
=======================================
--- /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc Fri Sep 19 14:25:13 2014 UTC +++ /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc Mon Sep 22 13:56:03 2014 UTC
@@ -216,15 +216,6 @@
       AddSafepointAndDeopt(instr);
       break;
     }
-    case kArchCallAddress:
-      if (HasImmediateInput(instr, 0)) {
-        Immediate64 imm = i.InputImmediate64(0);
-        DCHECK_EQ(kImm64Value, imm.type);
-        __ Call(reinterpret_cast<byte*>(imm.value), RelocInfo::NONE64);
-      } else {
-        __ call(i.InputRegister(0));
-      }
-      break;
     case kArchCallJSFunction: {
       Register func = i.InputRegister(0);
       if (FLAG_debug_code) {
@@ -236,11 +227,6 @@
       AddSafepointAndDeopt(instr);
       break;
     }
-    case kArchDrop: {
-      int words = MiscField::decode(instr->opcode());
-      __ addq(rsp, Immediate(kPointerSize * words));
-      break;
-    }
     case kArchJmp:
       __ jmp(code_->GetLabel(i.InputBlock(0)));
       break;
=======================================
--- /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc Fri Sep 19 14:25:13 2014 UTC +++ /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc Mon Sep 22 13:56:03 2014 UTC
@@ -691,9 +691,6 @@
       opcode = kArchCallCodeObject;
       break;
     }
-    case CallDescriptor::kCallAddress:
-      opcode = kArchCallAddress;
-      break;
     case CallDescriptor::kCallJSFunction:
       opcode = kArchCallJSFunction;
       break;
@@ -713,15 +710,6 @@
     DCHECK(continuation != NULL);
     call_instr->MarkAsControl();
   }
-
-  // Caller clean up of stack for C-style calls.
-  if (descriptor->kind() == CallDescriptor::kCallAddress &&
-      !buffer.pushed_nodes.empty()) {
-    DCHECK(deoptimization == NULL && continuation == NULL);
-    Emit(kArchDrop |
- MiscField::encode(static_cast<int>(buffer.pushed_nodes.size())),
-         NULL);
-  }
 }

 }  // namespace compiler
=======================================
--- /branches/bleeding_edge/test/cctest/cctest.status Thu Sep 18 08:56:52 2014 UTC +++ /branches/bleeding_edge/test/cctest/cctest.status Mon Sep 22 13:56:03 2014 UTC
@@ -80,11 +80,6 @@
##############################################################################
   # TurboFan compiler failures.

-  # TODO(dcarney): C calls are broken all over the place.
-  'test-run-machops/RunCall*': [SKIP],
-  'test-run-machops/RunLoadImmIndex': [SKIP],
-  'test-run-machops/RunSpillLotsOfThingsWithCall': [SKIP],
-
   # TODO(sigurds): The schedule is borked with multiple inlinees,
   # and cannot handle free-floating loops yet
   'test-run-inlining/InlineTwiceDependentDiamond': [SKIP],
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-run-machops.cc Fri Sep 19 14:40:08 2014 UTC +++ /branches/bleeding_edge/test/cctest/compiler/test-run-machops.cc Mon Sep 22 13:56:03 2014 UTC
@@ -3565,82 +3565,6 @@

   CHECK_EQ(116, m.Call());
 }
-
-
-#if MACHINE_ASSEMBLER_SUPPORTS_CALL_C
-
-static int Seven() { return 7; }
-static int UnaryMinus(int a) { return -a; }
-static int APlusTwoB(int a, int b) { return a + 2 * b; }
-
-
-TEST(RunCallSeven) {
-  for (int i = 0; i < 2; i++) {
-    bool call_direct = i == 0;
-    void* function_address =
-        reinterpret_cast<void*>(reinterpret_cast<intptr_t>(&Seven));
-
-    RawMachineAssemblerTester<int32_t> m;
-    Node** args = NULL;
-    MachineType* arg_types = NULL;
-    Node* function = call_direct
-                         ? m.PointerConstant(function_address)
-                         : m.LoadFromPointer(&function_address, kMachPtr);
-    m.Return(m.CallC(function, kMachInt32, arg_types, args, 0));
-
-    CHECK_EQ(7, m.Call());
-  }
-}
-
-
-TEST(RunCallUnaryMinus) {
-  for (int i = 0; i < 2; i++) {
-    bool call_direct = i == 0;
-    void* function_address =
-        reinterpret_cast<void*>(reinterpret_cast<intptr_t>(&UnaryMinus));
-
-    RawMachineAssemblerTester<int32_t> m(kMachInt32);
-    Node* args[] = {m.Parameter(0)};
-    MachineType arg_types[] = {kMachInt32};
-    Node* function = call_direct
-                         ? m.PointerConstant(function_address)
-                         : m.LoadFromPointer(&function_address, kMachPtr);
-    m.Return(m.CallC(function, kMachInt32, arg_types, args, 1));
-
-    FOR_INT32_INPUTS(i) {
-      int a = *i;
-      CHECK_EQ(-a, m.Call(a));
-    }
-  }
-}
-
-
-TEST(RunCallAPlusTwoB) {
-  for (int i = 0; i < 2; i++) {
-    bool call_direct = i == 0;
-    void* function_address =
-        reinterpret_cast<void*>(reinterpret_cast<intptr_t>(&APlusTwoB));
-
-    RawMachineAssemblerTester<int32_t> m(kMachInt32, kMachInt32);
-    Node* args[] = {m.Parameter(0), m.Parameter(1)};
-    MachineType arg_types[] = {kMachInt32, kMachInt32};
-    Node* function = call_direct
-                         ? m.PointerConstant(function_address)
-                         : m.LoadFromPointer(&function_address, kMachPtr);
-    m.Return(m.CallC(function, kMachInt32, arg_types, args, 2));
-
-    FOR_INT32_INPUTS(i) {
-      FOR_INT32_INPUTS(j) {
-        int a = *i;
-        int b = *j;
-        int result = m.Call(a, b);
-        CHECK_EQ(a + 2 * b, result);
-      }
-    }
-  }
-}
-
-#endif  // MACHINE_ASSEMBLER_SUPPORTS_CALL_C


 static const int kFloat64CompareHelperTestCases = 15;
@@ -4028,39 +3952,6 @@
   CHECK_EQ(*false_val, m.Call(0));
   CHECK_EQ(*true_val, m.Call(1));
 }
-
-
-#if MACHINE_ASSEMBLER_SUPPORTS_CALL_C
-
-TEST(RunSpillLotsOfThingsWithCall) {
-  static const int kInputSize = 1000;
-  RawMachineAssemblerTester<void> m;
-  Node* accs[kInputSize];
-  int32_t outputs[kInputSize];
-  Node* one = m.Int32Constant(1);
-  Node* acc = one;
-  for (int i = 0; i < kInputSize; i++) {
-    acc = m.Int32Add(acc, one);
-    accs[i] = acc;
-  }
-  // If the spill slot computation is wrong, it might load from the c frame
-  {
- void* func = reinterpret_cast<void*>(reinterpret_cast<intptr_t>(&Seven));
-    Node** args = NULL;
-    MachineType* arg_types = NULL;
-    m.CallC(m.PointerConstant(func), kMachInt32, arg_types, args, 0);
-  }
-  for (int i = 0; i < kInputSize; i++) {
-    m.StoreToPointer(&outputs[i], kMachInt32, accs[i]);
-  }
-  m.Return(one);
-  m.Call();
-  for (int i = 0; i < kInputSize; i++) {
-    CHECK_EQ(outputs[i], i + 2);
-  }
-}
-
-#endif  // MACHINE_ASSEMBLER_SUPPORTS_CALL_C


 TEST(RunInt32AddWithOverflowP) {

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