Revision: 23506
Author:   [email protected]
Date:     Fri Aug 29 05:00:55 2014 UTC
Log:      [turbofan] Explicitly mark call sites as patchable.

TEST=cctest,mjsunit
[email protected]

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

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/arm/linkage-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/arm64/linkage-arm64.cc
 /branches/bleeding_edge/src/compiler/code-generator.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/ia32/linkage-ia32.cc
 /branches/bleeding_edge/src/compiler/js-generic-lowering.cc
 /branches/bleeding_edge/src/compiler/js-generic-lowering.h
 /branches/bleeding_edge/src/compiler/linkage-impl.h
 /branches/bleeding_edge/src/compiler/linkage.cc
 /branches/bleeding_edge/src/compiler/linkage.h
 /branches/bleeding_edge/src/compiler/raw-machine-assembler.cc
 /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc
 /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc
 /branches/bleeding_edge/src/compiler/x64/linkage-x64.cc

=======================================
--- /branches/bleeding_edge/src/compiler/arm/code-generator-arm.cc Wed Aug 27 15:56:11 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm/code-generator-arm.cc Fri Aug 29 05:00:55 2014 UTC
@@ -841,10 +841,10 @@

 void CodeGenerator::AddNopForSmiCodeInlining() {
   // On 32-bit ARM we do not insert nops for inlined Smi code.
-  UNREACHABLE();
 }

 #undef __
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc Wed Aug 27 06:25:02 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm/instruction-selector-arm.cc Fri Aug 29 05:00:55 2014 UTC
@@ -821,7 +821,7 @@
       UNREACHABLE();
       return;
   }
-  opcode |= MiscField::encode(descriptor->deoptimization_support());
+  opcode |= MiscField::encode(descriptor->flags());

   // Emit the call instruction.
   Instruction* call_instr =
=======================================
--- /branches/bleeding_edge/src/compiler/arm/linkage-arm.cc Mon Aug 11 15:55:28 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm/linkage-arm.cc Fri Aug 29 05:00:55 2014 UTC
@@ -39,20 +39,21 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
-    Runtime::FunctionId function, int parameter_count,
-    Operator::Property properties,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
+                                                  int parameter_count,
+ Operator::Property properties, + CallDescriptor::Flags flags,
+                                                  Zone* zone) {
   return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>(
-      zone, function, parameter_count, properties, can_deoptimize);
+      zone, function, parameter_count, properties, flags);
 }


 CallDescriptor* Linkage::GetStubCallDescriptor(
     CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+    CallDescriptor::Flags flags, Zone* zone) {
   return LinkageHelper::GetStubCallDescriptor<LinkageHelperTraits>(
-      zone, descriptor, stack_parameter_count, can_deoptimize);
+      zone, descriptor, stack_parameter_count, flags);
 }


=======================================
--- /branches/bleeding_edge/src/compiler/arm64/code-generator-arm64.cc Wed Aug 27 15:56:11 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm64/code-generator-arm64.cc Fri Aug 29 05:00:55 2014 UTC
@@ -146,8 +146,6 @@
         __ Call(target);
       }
       AddSafepointAndDeopt(instr);
-      // Meaningless instruction for ICs to overwrite.
-      AddNopForSmiCodeInlining();
       break;
     }
     case kArchCallJSFunction: {
=======================================
--- /branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc Wed Aug 27 06:25:02 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm64/instruction-selector-arm64.cc Fri Aug 29 05:00:55 2014 UTC
@@ -651,7 +651,7 @@
       UNREACHABLE();
       return;
   }
-  opcode |= MiscField::encode(descriptor->deoptimization_support());
+  opcode |= MiscField::encode(descriptor->flags());

   // Emit the call instruction.
   Instruction* call_instr =
=======================================
--- /branches/bleeding_edge/src/compiler/arm64/linkage-arm64.cc Mon Aug 11 15:55:28 2014 UTC +++ /branches/bleeding_edge/src/compiler/arm64/linkage-arm64.cc Fri Aug 29 05:00:55 2014 UTC
@@ -39,20 +39,21 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
-    Runtime::FunctionId function, int parameter_count,
-    Operator::Property properties,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
+                                                  int parameter_count,
+ Operator::Property properties, + CallDescriptor::Flags flags,
+                                                  Zone* zone) {
   return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>(
-      zone, function, parameter_count, properties, can_deoptimize);
+      zone, function, parameter_count, properties, flags);
 }


 CallDescriptor* Linkage::GetStubCallDescriptor(
     CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+    CallDescriptor::Flags flags, Zone* zone) {
   return LinkageHelper::GetStubCallDescriptor<LinkageHelperTraits>(
-      zone, descriptor, stack_parameter_count, can_deoptimize);
+      zone, descriptor, stack_parameter_count, flags);
 }


=======================================
--- /branches/bleeding_edge/src/compiler/code-generator.cc Wed Aug 27 15:56:11 2014 UTC +++ /branches/bleeding_edge/src/compiler/code-generator.cc Fri Aug 29 05:00:55 2014 UTC
@@ -240,17 +240,15 @@


 void CodeGenerator::AddSafepointAndDeopt(Instruction* instr) {
-  CallDescriptor::DeoptimizationSupport deopt =
-      static_cast<CallDescriptor::DeoptimizationSupport>(
-          MiscField::decode(instr->opcode()));
+  CallDescriptor::Flags flags(MiscField::decode(instr->opcode()));

-  bool needs_frame_state = (deopt & CallDescriptor::kNeedsFrameState) != 0;
+  bool needs_frame_state = (flags & CallDescriptor::kNeedsFrameState);

   Safepoint::Id safepoint_id = RecordSafepoint(
       instr->pointer_map(), Safepoint::kSimple, 0,
       needs_frame_state ? Safepoint::kLazyDeopt : Safepoint::kNoLazyDeopt);

-  if ((deopt & CallDescriptor::kLazyDeoptimization) != 0) {
+  if (flags & CallDescriptor::kLazyDeoptimization) {
     RecordLazyDeoptimizationEntry(instr, safepoint_id);
   }

@@ -274,6 +272,10 @@
 #endif
     safepoints()->RecordLazyDeoptimizationIndex(deoptimization_id);
   }
+
+  if (flags & CallDescriptor::kNeedsNopAfterCall) {
+    AddNopForSmiCodeInlining();
+  }
 }


=======================================
--- /branches/bleeding_edge/src/compiler/ia32/code-generator-ia32.cc Wed Aug 27 15:56:11 2014 UTC +++ /branches/bleeding_edge/src/compiler/ia32/code-generator-ia32.cc Fri Aug 29 05:00:55 2014 UTC
@@ -129,7 +129,6 @@
         __ call(Operand(reg, Code::kHeaderSize - kHeapObjectTag));
       }
       AddSafepointAndDeopt(instr);
-      AddNopForSmiCodeInlining();
       break;
     }
     case kArchCallJSFunction: {
@@ -947,6 +946,6 @@

 #undef __

-}
-}
-}  // namespace v8::internal::compiler
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc Wed Aug 27 06:25:02 2014 UTC +++ /branches/bleeding_edge/src/compiler/ia32/instruction-selector-ia32.cc Fri Aug 29 05:00:55 2014 UTC
@@ -543,7 +543,7 @@
       UNREACHABLE();
       return;
   }
-  opcode |= MiscField::encode(descriptor->deoptimization_support());
+  opcode |= MiscField::encode(descriptor->flags());

   // Emit the call instruction.
   Instruction* call_instr =
=======================================
--- /branches/bleeding_edge/src/compiler/ia32/linkage-ia32.cc Mon Aug 11 15:55:28 2014 UTC +++ /branches/bleeding_edge/src/compiler/ia32/linkage-ia32.cc Fri Aug 29 05:00:55 2014 UTC
@@ -35,20 +35,21 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
-    Runtime::FunctionId function, int parameter_count,
-    Operator::Property properties,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
+                                                  int parameter_count,
+ Operator::Property properties, + CallDescriptor::Flags flags,
+                                                  Zone* zone) {
   return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>(
-      zone, function, parameter_count, properties, can_deoptimize);
+      zone, function, parameter_count, properties, flags);
 }


 CallDescriptor* Linkage::GetStubCallDescriptor(
     CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+    CallDescriptor::Flags flags, Zone* zone) {
   return LinkageHelper::GetStubCallDescriptor<LinkageHelperTraits>(
-      zone, descriptor, stack_parameter_count, can_deoptimize);
+      zone, descriptor, stack_parameter_count, flags);
 }


@@ -58,6 +59,7 @@
   return LinkageHelper::GetSimplifiedCDescriptor<LinkageHelperTraits>(
       zone, num_params, return_type, param_types);
 }
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Thu Aug 28 08:39:24 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Fri Aug 29 05:00:55 2014 UTC
@@ -17,7 +17,7 @@


// TODO(mstarzinger): This is a temporary workaround for non-hydrogen stubs for -// which we don't have an interface descriptor yet. Use ReplaceWithICStubCall
+// which we don't have an interface descriptor yet. Use ReplaceWithStubCall
 // once these stub have been made into a HydrogenCodeStub.
 template <typename T>
static CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate,
@@ -218,28 +218,35 @@
 }


-#define REPLACE_IC_STUB_CALL(op, StubDeclaration)  \
-  Node* JSGenericLowering::Lower##op(Node* node) { \
-    StubDeclaration;                               \
-    ReplaceWithICStubCall(node, &stub);            \
-    return node;                                   \
+#define REPLACE_BINARY_OP_IC_CALL(op, token)                        \
+  Node* JSGenericLowering::Lower##op(Node* node) {                  \
+    BinaryOpICStub stub(isolate(), token);                          \
+    ReplaceWithStubCall(node, &stub,                                \
+                        CallDescriptor::kPatchableCallSiteWithNop); \
+    return node;                                                    \
+  }
+REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR)
+REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR)
+REPLACE_BINARY_OP_IC_CALL(JSBitwiseAnd, Token::BIT_AND)
+REPLACE_BINARY_OP_IC_CALL(JSShiftLeft, Token::SHL)
+REPLACE_BINARY_OP_IC_CALL(JSShiftRight, Token::SAR)
+REPLACE_BINARY_OP_IC_CALL(JSShiftRightLogical, Token::SHR)
+REPLACE_BINARY_OP_IC_CALL(JSAdd, Token::ADD)
+REPLACE_BINARY_OP_IC_CALL(JSSubtract, Token::SUB)
+REPLACE_BINARY_OP_IC_CALL(JSMultiply, Token::MUL)
+REPLACE_BINARY_OP_IC_CALL(JSDivide, Token::DIV)
+REPLACE_BINARY_OP_IC_CALL(JSModulus, Token::MOD)
+#undef REPLACE_BINARY_OP_IC_CALL
+
+
+#define REPLACE_STUB_CALL(op, StubDeclaration)                  \
+  Node* JSGenericLowering::Lower##op(Node* node) {              \
+    StubDeclaration;                                            \
+    ReplaceWithStubCall(node, &stub, CallDescriptor::kNoFlags); \
+    return node;                                                \
   }
-REPLACE_IC_STUB_CALL(JSBitwiseOr, BinaryOpICStub stub(isolate(), Token::BIT_OR))
-REPLACE_IC_STUB_CALL(JSBitwiseXor,
-                     BinaryOpICStub stub(isolate(), Token::BIT_XOR))
-REPLACE_IC_STUB_CALL(JSBitwiseAnd,
-                     BinaryOpICStub stub(isolate(), Token::BIT_AND))
-REPLACE_IC_STUB_CALL(JSShiftLeft, BinaryOpICStub stub(isolate(), Token::SHL)) -REPLACE_IC_STUB_CALL(JSShiftRight, BinaryOpICStub stub(isolate(), Token::SAR))
-REPLACE_IC_STUB_CALL(JSShiftRightLogical,
-                     BinaryOpICStub stub(isolate(), Token::SHR))
-REPLACE_IC_STUB_CALL(JSAdd, BinaryOpICStub stub(isolate(), Token::ADD))
-REPLACE_IC_STUB_CALL(JSSubtract, BinaryOpICStub stub(isolate(), Token::SUB)) -REPLACE_IC_STUB_CALL(JSMultiply, BinaryOpICStub stub(isolate(), Token::MUL))
-REPLACE_IC_STUB_CALL(JSDivide, BinaryOpICStub stub(isolate(), Token::DIV))
-REPLACE_IC_STUB_CALL(JSModulus, BinaryOpICStub stub(isolate(), Token::MOD))
-REPLACE_IC_STUB_CALL(JSToNumber, ToNumberStub stub(isolate()))
-#undef REPLACE_IC_STUB_CALL
+REPLACE_STUB_CALL(JSToNumber, ToNumberStub stub(isolate()))
+#undef REPLACE_STUB_CALL


 #define REPLACE_COMPARE_IC_CALL(op, token, pure)   \
@@ -286,16 +293,15 @@
 #undef REPLACE_UNIMPLEMENTED


-static CallDescriptor::DeoptimizationSupport DeoptimizationSupportForNode(
-    Node* node) {
-  int result = CallDescriptor::kNoDeoptimization;
+static CallDescriptor::Flags FlagsForNode(Node* node) {
+  CallDescriptor::Flags result = CallDescriptor::kNoFlags;
   if (OperatorProperties::CanLazilyDeoptimize(node->op())) {
     result |= CallDescriptor::kLazyDeoptimization;
   }
   if (OperatorProperties::HasFrameStateInput(node->op())) {
     result |= CallDescriptor::kNeedsFrameState;
   }
-  return static_cast<CallDescriptor::DeoptimizationSupport>(result);
+  return result;
 }


@@ -303,7 +309,8 @@
                                              bool pure) {
   BinaryOpICStub stub(isolate(), Token::ADD);  // TODO(mstarzinger): Hack.
   CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor();
-  CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(d);
+  CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(
+      d, 0, CallDescriptor::kPatchableCallSiteWithNop);
   Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token);
   Node* compare;
   if (pure) {
@@ -328,11 +335,11 @@
 }


-void JSGenericLowering::ReplaceWithICStubCall(Node* node,
-                                              HydrogenCodeStub* stub) {
+void JSGenericLowering::ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub,
+                                            CallDescriptor::Flags flags) {
   CodeStubInterfaceDescriptor* d = stub->GetInterfaceDescriptor();
-  CallDescriptor* desc = linkage()->GetStubCallDescriptor(
-      d, 0, DeoptimizationSupportForNode(node));
+  CallDescriptor* desc =
+      linkage()->GetStubCallDescriptor(d, 0, flags | FlagsForNode(node));
   Node* stub_code = CodeConstant(stub->GetCode());
   PatchInsertInput(node, 0, stub_code);
   PatchOperator(node, common()->Call(desc));
@@ -363,8 +370,8 @@
   Operator::Property props = node->op()->properties();
   const Runtime::Function* fun = Runtime::FunctionForId(f);
   int nargs = (nargs_override < 0) ? fun->nargs : nargs_override;
-  CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor(
-      f, nargs, props, DeoptimizationSupportForNode(node));
+  CallDescriptor* desc =
+ linkage()->GetRuntimeCallDescriptor(f, nargs, props, FlagsForNode(node));
   Node* ref = ExternalConstant(ExternalReference(f, isolate()));
   Node* arity = Int32Constant(nargs);
   if (!centrystub_constant_.is_set()) {
@@ -387,14 +394,14 @@

 Node* JSGenericLowering::LowerJSUnaryNot(Node* node) {
   ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_INVERSE_ODDBALL);
-  ReplaceWithICStubCall(node, &stub);
+  ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
   return node;
 }


 Node* JSGenericLowering::LowerJSToBoolean(Node* node) {
   ToBooleanStub stub(isolate(), ToBooleanStub::RESULT_AS_ODDBALL);
-  ReplaceWithICStubCall(node, &stub);
+  ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
   return node;
 }

@@ -407,7 +414,7 @@

 Node* JSGenericLowering::LowerJSLoadProperty(Node* node) {
   KeyedLoadICStubShim stub(isolate());
-  ReplaceWithICStubCall(node, &stub);
+  ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
   return node;
 }

@@ -416,7 +423,7 @@
   LoadNamedParameters p = OpParameter<LoadNamedParameters>(node);
   LoadICStubShim stub(isolate(), p.contextual_mode);
   PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name));
-  ReplaceWithICStubCall(node, &stub);
+  ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
   return node;
 }

@@ -424,7 +431,7 @@
 Node* JSGenericLowering::LowerJSStoreProperty(Node* node) {
   StrictMode strict_mode = OpParameter<StrictMode>(node);
   KeyedStoreICStubShim stub(isolate(), strict_mode);
-  ReplaceWithICStubCall(node, &stub);
+  ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
   return node;
 }

@@ -433,7 +440,7 @@
   StoreNamedParameters params = OpParameter<StoreNamedParameters>(node);
   StoreICStubShim stub(isolate(), params.strict_mode);
   PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name));
-  ReplaceWithICStubCall(node, &stub);
+  ReplaceWithStubCall(node, &stub, CallDescriptor::kPatchableCallSite);
   return node;
 }

@@ -507,8 +514,8 @@
   int arity = OpParameter<int>(node);
   CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS);
CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
-  CallDescriptor* desc = linkage()->GetStubCallDescriptor(
-      d, arity, DeoptimizationSupportForNode(node));
+  CallDescriptor* desc =
+      linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node));
   Node* stub_code = CodeConstant(stub.GetCode());
   Node* construct = NodeProperties::GetValueInput(node, 0);
   PatchInsertInput(node, 0, stub_code);
@@ -524,8 +531,8 @@
   CallParameters p = OpParameter<CallParameters>(node);
   CallFunctionStub stub(isolate(), p.arity - 2, p.flags);
CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
-  CallDescriptor* desc = linkage()->GetStubCallDescriptor(
-      d, p.arity - 1, DeoptimizationSupportForNode(node));
+  CallDescriptor* desc =
+      linkage()->GetStubCallDescriptor(d, p.arity - 1, FlagsForNode(node));
   Node* stub_code = CodeConstant(stub.GetCode());
   PatchInsertInput(node, 0, stub_code);
   PatchOperator(node, common()->Call(desc));
@@ -539,6 +546,7 @@
   ReplaceWithRuntimeCall(node, function, arity);
   return node;
 }
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8
=======================================
--- /branches/bleeding_edge/src/compiler/js-generic-lowering.h Thu Aug 14 12:24:37 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-generic-lowering.h Fri Aug 29 05:00:55 2014 UTC
@@ -55,7 +55,8 @@

   // Helpers to replace existing nodes with a generic call.
   void ReplaceWithCompareIC(Node* node, Token::Value token, bool pure);
-  void ReplaceWithICStubCall(Node* node, HydrogenCodeStub* stub);
+  void ReplaceWithStubCall(Node* node, HydrogenCodeStub* stub,
+                           CallDescriptor::Flags flags);
void ReplaceWithBuiltinCall(Node* node, Builtins::JavaScript id, int args); void ReplaceWithRuntimeCall(Node* node, Runtime::FunctionId f, int args = -1);

@@ -75,8 +76,9 @@
   MachineOperatorBuilder* machine_;
   SetOncePointer<Node> centrystub_constant_;
 };
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_JS_GENERIC_LOWERING_H_
=======================================
--- /branches/bleeding_edge/src/compiler/linkage-impl.h Thu Aug 28 13:17:38 2014 UTC +++ /branches/bleeding_edge/src/compiler/linkage-impl.h Fri Aug 29 05:00:55 2014 UTC
@@ -63,7 +63,7 @@
                        locations,                        // locations
                        Operator::kNoProperties,          // properties
                        kNoCalleeSaved,  // callee-saved registers
- CallDescriptor::kLazyDeoptimization); // deoptimization
+                       CallDescriptor::kLazyDeoptimization);  // flags
   }


@@ -71,8 +71,7 @@
   template <typename LinkageTraits>
   static CallDescriptor* GetRuntimeCallDescriptor(
       Zone* zone, Runtime::FunctionId function_id, int parameter_count,
-      Operator::Property properties,
-      CallDescriptor::DeoptimizationSupport can_deoptimize) {
+      Operator::Property properties, CallDescriptor::Flags flags) {
     const int code_count = 1;
     const int function_count = 1;
     const int num_args_count = 1;
@@ -118,7 +117,7 @@
                                      locations,        // locations
                                      properties,       // properties
kNoCalleeSaved, // callee-saved registers
-                                     can_deoptimize,   // deoptimization
+                                     flags,            // flags
                                      function->name);
   }

@@ -127,8 +126,7 @@
   template <typename LinkageTraits>
   static CallDescriptor* GetStubCallDescriptor(
       Zone* zone, CodeStubInterfaceDescriptor* descriptor,
-      int stack_parameter_count,
-      CallDescriptor::DeoptimizationSupport can_deoptimize) {
+      int stack_parameter_count, CallDescriptor::Flags flags) {
int register_parameter_count = descriptor->GetEnvironmentParameterCount();
     int parameter_count = register_parameter_count + stack_parameter_count;
     const int code_count = 1;
@@ -165,7 +163,7 @@
                        locations,                        // locations
                        Operator::kNoProperties,          // properties
                        kNoCalleeSaved,  // callee-saved registers
-                       can_deoptimize,  // deoptimization
+                       flags,           // flags
                        CodeStub::MajorName(descriptor->MajorKey(), false));
   }

@@ -194,11 +192,12 @@
     return new (zone) CallDescriptor(
CallDescriptor::kCallAddress, 1, num_params, num_params + 1, locations,
         Operator::kNoProperties, LinkageTraits::CCalleeSaveRegisters(),
- CallDescriptor::kNoDeoptimization); // TODO(jarin) should deoptimize!
+        CallDescriptor::kNoFlags);  // TODO(jarin) should deoptimize!
   }
 };
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_LINKAGE_IMPL_H_
=======================================
--- /branches/bleeding_edge/src/compiler/linkage.cc Thu Aug 21 11:56:46 2014 UTC +++ /branches/bleeding_edge/src/compiler/linkage.cc Fri Aug 29 05:00:55 2014 UTC
@@ -93,20 +93,20 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
-    Runtime::FunctionId function, int parameter_count,
-    Operator::Property properties,
-    CallDescriptor::DeoptimizationSupport can_deoptimize) {
-  return GetRuntimeCallDescriptor(function, parameter_count, properties,
-                                  can_deoptimize, this->info_->zone());
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
+                                                  int parameter_count,
+ Operator::Property properties, + CallDescriptor::Flags flags) { + return GetRuntimeCallDescriptor(function, parameter_count, properties, flags,
+                                  this->info_->zone());
 }


 CallDescriptor* Linkage::GetStubCallDescriptor(
     CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count,
-    CallDescriptor::DeoptimizationSupport can_deoptimize) {
-  return GetStubCallDescriptor(descriptor, stack_parameter_count,
-                               can_deoptimize, this->info_->zone());
+    CallDescriptor::Flags flags) {
+  return GetStubCallDescriptor(descriptor, stack_parameter_count, flags,
+                               this->info_->zone());
 }


@@ -120,10 +120,11 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
-    Runtime::FunctionId function, int parameter_count,
-    Operator::Property properties,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
+                                                  int parameter_count,
+ Operator::Property properties, + CallDescriptor::Flags flags,
+                                                  Zone* zone) {
   UNIMPLEMENTED();
   return NULL;
 }
@@ -131,7 +132,7 @@

 CallDescriptor* Linkage::GetStubCallDescriptor(
     CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+    CallDescriptor::Flags flags, Zone* zone) {
   UNIMPLEMENTED();
   return NULL;
 }
=======================================
--- /branches/bleeding_edge/src/compiler/linkage.h Thu Aug 28 13:17:38 2014 UTC +++ /branches/bleeding_edge/src/compiler/linkage.h Fri Aug 29 05:00:55 2014 UTC
@@ -5,8 +5,7 @@
 #ifndef V8_COMPILER_LINKAGE_H_
 #define V8_COMPILER_LINKAGE_H_

-#include "src/v8.h"
-
+#include "src/base/flags.h"
 #include "src/code-stubs.h"
 #include "src/compiler/frame.h"
 #include "src/compiler/machine-type.h"
@@ -37,24 +36,27 @@
 };


-class CallDescriptor : public ZoneObject {
+class CallDescriptor V8_FINAL : public ZoneObject {
  public:
   // Describes whether the first parameter is a code object, a JSFunction,
// or an address--all of which require different machine sequences to call.
   enum Kind { kCallCodeObject, kCallJSFunction, kCallAddress };

- // TODO(jarin) kLazyDeoptimization and kNeedsFrameState should be unified.
-  enum DeoptimizationSupport {
-    kNoDeoptimization = 0,
-    kLazyDeoptimization = 1,
-    kNeedsFrameState = 2
+  enum Flag {
+ // TODO(jarin) kLazyDeoptimization and kNeedsFrameState should be unified.
+    kNoFlags = 0u,
+    kLazyDeoptimization = 1u << 0,
+    kNeedsFrameState = 1u << 1,
+    kPatchableCallSite = 1u << 2,
+    kNeedsNopAfterCall = 1u << 3,
+    kPatchableCallSiteWithNop = kPatchableCallSite | kNeedsNopAfterCall
   };
+  DEFINE_FLAGS(Flags, Flag);

   CallDescriptor(Kind kind, int8_t return_count, int16_t parameter_count,
                  int16_t input_count, LinkageLocation* locations,
Operator::Property properties, RegList callee_saved_registers,
-                 DeoptimizationSupport deoptimization_support,
-                 const char* debug_name = "")
+                 Flags flags, const char* debug_name = "")
       : kind_(kind),
         return_count_(return_count),
         parameter_count_(parameter_count),
@@ -62,7 +64,7 @@
         locations_(locations),
         properties_(properties),
         callee_saved_registers_(callee_saved_registers),
-        deoptimization_support_(deoptimization_support),
+        flags_(flags),
         debug_name_(debug_name) {}
   // Returns the kind of this call.
   Kind kind() const { return kind_; }
@@ -81,17 +83,10 @@

   int FrameStateCount() const { return NeedsFrameState() ? 1 : 0; }

-  bool CanLazilyDeoptimize() const {
-    return (deoptimization_support() & kLazyDeoptimization) != 0;
-  }
+  Flags flags() const { return flags_; }

-  bool NeedsFrameState() const {
-    return (deoptimization_support() & kNeedsFrameState) != 0;
-  }
-
-  DeoptimizationSupport deoptimization_support() const {
-    return deoptimization_support_;
-  }
+ bool CanLazilyDeoptimize() const { return flags() & kLazyDeoptimization; }
+  bool NeedsFrameState() const { return flags() & kNeedsFrameState; }

   LinkageLocation GetReturnLocation(int index) {
     DCHECK(index < return_count_);
@@ -121,10 +116,12 @@
   LinkageLocation* locations_;
   Operator::Property properties_;
   RegList callee_saved_registers_;
-  DeoptimizationSupport deoptimization_support_;
+  Flags flags_;
   const char* debug_name_;
 };

+DEFINE_OPERATORS_FOR_FLAGS(CallDescriptor::Flags)
+
 OStream& operator<<(OStream& os, const CallDescriptor& d);
 OStream& operator<<(OStream& os, const CallDescriptor::Kind& k);

@@ -155,20 +152,19 @@
   CallDescriptor* GetRuntimeCallDescriptor(
       Runtime::FunctionId function, int parameter_count,
       Operator::Property properties,
-      CallDescriptor::DeoptimizationSupport can_deoptimize =
-          CallDescriptor::kNoDeoptimization);
-  static CallDescriptor* GetRuntimeCallDescriptor(
-      Runtime::FunctionId function, int parameter_count,
-      Operator::Property properties,
-      CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone);
+      CallDescriptor::Flags flags = CallDescriptor::kNoFlags);
+ static CallDescriptor* GetRuntimeCallDescriptor(Runtime::FunctionId function,
+                                                  int parameter_count,
+ Operator::Property properties, + CallDescriptor::Flags flags,
+                                                  Zone* zone);

   CallDescriptor* GetStubCallDescriptor(
CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count = 0,
-      CallDescriptor::DeoptimizationSupport can_deoptimize =
-          CallDescriptor::kNoDeoptimization);
+      CallDescriptor::Flags flags = CallDescriptor::kNoFlags);
   static CallDescriptor* GetStubCallDescriptor(
       CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count,
-      CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone);
+      CallDescriptor::Flags flags, Zone* zone);

   // Creates a call descriptor for simplified C calls that is appropriate
// for the host platform. This simplified calling convention only supports
@@ -201,8 +197,9 @@
   CompilationInfo* info_;
   CallDescriptor* incoming_;
 };
-}
-}
-}  // namespace v8::internal::compiler
+
+}  // namespace compiler
+}  // namespace internal
+}  // namespace v8

 #endif  // V8_COMPILER_LINKAGE_H_
=======================================
--- /branches/bleeding_edge/src/compiler/raw-machine-assembler.cc Wed Aug 27 15:56:11 2014 UTC +++ /branches/bleeding_edge/src/compiler/raw-machine-assembler.cc Fri Aug 29 05:00:55 2014 UTC
@@ -94,9 +94,8 @@
   stub.InitializeInterfaceDescriptor(d);

   CallDescriptor* desc = Linkage::GetStubCallDescriptor(
-      d, 1, static_cast<CallDescriptor::DeoptimizationSupport>(
-                CallDescriptor::kLazyDeoptimization |
-                CallDescriptor::kNeedsFrameState),
+      d, 1,
+ CallDescriptor::kLazyDeoptimization | CallDescriptor::kNeedsFrameState,
       zone());
   Node* stub_code = HeapConstant(stub.GetCode());
   Node* call = graph()->NewNode(common()->Call(desc), stub_code, function,
=======================================
--- /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc Wed Aug 27 15:56:11 2014 UTC +++ /branches/bleeding_edge/src/compiler/x64/code-generator-x64.cc Fri Aug 29 05:00:55 2014 UTC
@@ -214,7 +214,6 @@
         __ Call(Operand(reg, entry));
       }
       AddSafepointAndDeopt(instr);
-      AddNopForSmiCodeInlining();
       break;
     }
     case kArchCallAddress:
=======================================
--- /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc Wed Aug 27 06:25:02 2014 UTC +++ /branches/bleeding_edge/src/compiler/x64/instruction-selector-x64.cc Fri Aug 29 05:00:55 2014 UTC
@@ -707,7 +707,7 @@
       UNREACHABLE();
       return;
   }
-  opcode |= MiscField::encode(descriptor->deoptimization_support());
+  opcode |= MiscField::encode(descriptor->flags());

   // Emit the call instruction.
   Instruction* call_instr =
=======================================
--- /branches/bleeding_edge/src/compiler/x64/linkage-x64.cc Mon Aug 11 15:55:28 2014 UTC +++ /branches/bleeding_edge/src/compiler/x64/linkage-x64.cc Fri Aug 29 05:00:55 2014 UTC
@@ -54,20 +54,21 @@
 }


-CallDescriptor* Linkage::GetRuntimeCallDescriptor(
-    Runtime::FunctionId function, int parameter_count,
-    Operator::Property properties,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+CallDescriptor* Linkage::GetRuntimeCallDescriptor(Runtime::FunctionId function,
+                                                  int parameter_count,
+ Operator::Property properties, + CallDescriptor::Flags flags,
+                                                  Zone* zone) {
   return LinkageHelper::GetRuntimeCallDescriptor<LinkageHelperTraits>(
-      zone, function, parameter_count, properties, can_deoptimize);
+      zone, function, parameter_count, properties, flags);
 }


 CallDescriptor* Linkage::GetStubCallDescriptor(
     CodeStubInterfaceDescriptor* descriptor, int stack_parameter_count,
-    CallDescriptor::DeoptimizationSupport can_deoptimize, Zone* zone) {
+    CallDescriptor::Flags flags, Zone* zone) {
   return LinkageHelper::GetStubCallDescriptor<LinkageHelperTraits>(
-      zone, descriptor, stack_parameter_count, can_deoptimize);
+      zone, descriptor, stack_parameter_count, flags);
 }


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