Revision: 23394
Author:   [email protected]
Date:     Tue Aug 26 10:39:20 2014 UTC
Log: Change more PlatformCodeStubs to encode properties in the minor key.

[email protected]

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

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.cc
 /branches/bleeding_edge/src/code-stubs.h
 /branches/bleeding_edge/src/codegen.cc
 /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
 /branches/bleeding_edge/src/ic/ic-compiler.cc
 /branches/bleeding_edge/src/x64/code-stubs-x64.cc

=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Aug 26 09:50:09 2014 UTC +++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Tue Aug 26 10:39:20 2014 UTC
@@ -1148,7 +1148,7 @@
   const Register scratch2 = r4;

   Label call_runtime, done, int_exponent;
-  if (exponent_type_ == ON_STACK) {
+  if (exponent_type() == ON_STACK) {
     Label base_is_smi, unpack_exponent;
     // The exponent and base are supplied as arguments on the stack.
     // This can only happen if the stub is called from non-optimized code.
@@ -1178,7 +1178,7 @@
     __ b(ne, &call_runtime);
     __ vldr(double_exponent,
             FieldMemOperand(exponent, HeapNumber::kValueOffset));
-  } else if (exponent_type_ == TAGGED) {
+  } else if (exponent_type() == TAGGED) {
     // Base is already in double_base.
     __ UntagAndJumpIfSmi(scratch, exponent, &int_exponent);

@@ -1186,7 +1186,7 @@
             FieldMemOperand(exponent, HeapNumber::kValueOffset));
   }

-  if (exponent_type_ != INTEGER) {
+  if (exponent_type() != INTEGER) {
     Label int_exponent_convert;
     // Detect integer exponents stored as double.
     __ vcvt_u32_f64(single_scratch, double_exponent);
@@ -1196,7 +1196,7 @@
     __ VFPCompareAndSetFlags(double_scratch, double_exponent);
     __ b(eq, &int_exponent_convert);

-    if (exponent_type_ == ON_STACK) {
+    if (exponent_type() == ON_STACK) {
       // Detect square root case.  Crankshaft detects constant +/-0.5 at
// compile time and uses DoMathPowHalf instead. We then skip this check
       // for non-constant cases of +/-0.5 as these hardly occur.
@@ -1261,7 +1261,7 @@
   __ bind(&int_exponent);

   // Get two copies of exponent in the registers scratch and exponent.
-  if (exponent_type_ == INTEGER) {
+  if (exponent_type() == INTEGER) {
     __ mov(scratch, exponent);
   } else {
// Exponent has previously been stored into scratch as untagged integer.
@@ -1297,7 +1297,7 @@

   // Returning or bailing out.
   Counters* counters = isolate()->counters();
-  if (exponent_type_ == ON_STACK) {
+  if (exponent_type() == ON_STACK) {
     // The arguments are still on the stack.
     __ bind(&call_runtime);
     __ TailCallRuntime(Runtime::kMathPowRT, 2, 1);
@@ -2897,7 +2897,7 @@


 void CallFunctionStub::Generate(MacroAssembler* masm) {
-  CallFunctionNoFeedback(masm, argc_, NeedsChecks(), CallAsMethod());
+  CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
 }


@@ -4582,7 +4582,7 @@
   int parameter_count_offset =
       StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
   __ ldr(r1, MemOperand(fp, parameter_count_offset));
-  if (function_mode_ == JS_FUNCTION_STUB_MODE) {
+  if (function_mode() == JS_FUNCTION_STUB_MODE) {
     __ add(r1, r1, Operand(1));
   }
   masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
@@ -4812,7 +4812,7 @@
 void ArrayConstructorStub::GenerateDispatchToArrayStub(
     MacroAssembler* masm,
     AllocationSiteOverrideMode mode) {
-  if (argument_count_ == ANY) {
+  if (argument_count() == ANY) {
     Label not_zero_case, not_one_case;
     __ tst(r0, r0);
     __ b(ne, &not_zero_case);
@@ -4825,11 +4825,11 @@

     __ bind(&not_one_case);
     CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
-  } else if (argument_count_ == NONE) {
+  } else if (argument_count() == NONE) {
     CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
-  } else if (argument_count_ == ONE) {
+  } else if (argument_count() == ONE) {
     CreateArrayDispatchOneArgument(masm, mode);
-  } else if (argument_count_ == MORE_THAN_ONE) {
+  } else if (argument_count() == MORE_THAN_ONE) {
     CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
   } else {
     UNREACHABLE();
@@ -4839,7 +4839,7 @@

 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
   // ----------- S t a t e -------------
-  //  -- r0 : argc (only if argument_count_ == ANY)
+  //  -- r0 : argc (only if argument_count() == ANY)
   //  -- r1 : constructor
   //  -- r2 : AllocationSite or undefined
   //  -- sp[0] : return address
@@ -4973,9 +4973,9 @@
   Register api_function_address = r1;
   Register context = cp;

-  int argc = ArgumentBits::decode(bit_field_);
-  bool is_store = IsStoreBits::decode(bit_field_);
-  bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_);
+  int argc = this->argc();
+  bool is_store = this->is_store();
+  bool call_data_undefined = this->call_data_undefined();

   typedef FunctionCallbackArguments FCA;

=======================================
--- /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Tue Aug 26 09:50:09 2014 UTC +++ /branches/bleeding_edge/src/arm64/code-stubs-arm64.cc Tue Aug 26 10:39:20 2014 UTC
@@ -1048,7 +1048,7 @@
   Label done;

   // Unpack the inputs.
-  if (exponent_type_ == ON_STACK) {
+  if (exponent_type() == ON_STACK) {
     Label base_is_smi;
     Label unpack_exponent;

@@ -1072,20 +1072,20 @@
     // exponent_tagged is a heap number, so load its double value.
     __ Ldr(exponent_double,
            FieldMemOperand(exponent_tagged, HeapNumber::kValueOffset));
-  } else if (exponent_type_ == TAGGED) {
+  } else if (exponent_type() == TAGGED) {
     __ JumpIfSmi(exponent_tagged, &exponent_is_smi);
     __ Ldr(exponent_double,
            FieldMemOperand(exponent_tagged, HeapNumber::kValueOffset));
   }

   // Handle double (heap number) exponents.
-  if (exponent_type_ != INTEGER) {
+  if (exponent_type() != INTEGER) {
     // Detect integer exponents stored as doubles and handle those in the
     // integer fast-path.
     __ TryRepresentDoubleAsInt64(exponent_integer, exponent_double,
                                  scratch0_double, &exponent_is_integer);

-    if (exponent_type_ == ON_STACK) {
+    if (exponent_type() == ON_STACK) {
       FPRegister  half_double = d3;
       FPRegister  minus_half_double = d4;
// Detect square root case. Crankshaft detects constant +/-0.5 at compile
@@ -1236,7 +1236,7 @@
   __ Fcmp(result_double, 0.0);
   __ B(&done, ne);

-  if (exponent_type_ == ON_STACK) {
+  if (exponent_type() == ON_STACK) {
     // Bail out to runtime code.
     __ Bind(&call_runtime);
     // Put the arguments back on the stack.
@@ -3147,7 +3147,7 @@

 void CallFunctionStub::Generate(MacroAssembler* masm) {
   ASM_LOCATION("CallFunctionStub::Generate");
-  CallFunctionNoFeedback(masm, argc_, NeedsChecks(), CallAsMethod());
+  CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
 }


@@ -4590,7 +4590,7 @@
   int parameter_count_offset =
       StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
   __ Ldr(x1, MemOperand(fp, parameter_count_offset));
-  if (function_mode_ == JS_FUNCTION_STUB_MODE) {
+  if (function_mode() == JS_FUNCTION_STUB_MODE) {
     __ Add(x1, x1, 1);
   }
   masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
@@ -5115,7 +5115,7 @@
     MacroAssembler* masm,
     AllocationSiteOverrideMode mode) {
   Register argc = x0;
-  if (argument_count_ == ANY) {
+  if (argument_count() == ANY) {
     Label zero_case, n_case;
     __ Cbz(argc, &zero_case);
     __ Cmp(argc, 1);
@@ -5132,11 +5132,11 @@
     // N arguments.
     CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);

-  } else if (argument_count_ == NONE) {
+  } else if (argument_count() == NONE) {
     CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
-  } else if (argument_count_ == ONE) {
+  } else if (argument_count() == ONE) {
     CreateArrayDispatchOneArgument(masm, mode);
-  } else if (argument_count_ == MORE_THAN_ONE) {
+  } else if (argument_count() == MORE_THAN_ONE) {
     CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
   } else {
     UNREACHABLE();
@@ -5147,7 +5147,7 @@
 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
   ASM_LOCATION("ArrayConstructorStub::Generate");
   // ----------- S t a t e -------------
-  //  -- x0 : argc (only if argument_count_ == ANY)
+  //  -- x0 : argc (only if argument_count() == ANY)
   //  -- x1 : constructor
   //  -- x2 : AllocationSite or undefined
   //  -- sp[0] : return address
@@ -5299,9 +5299,9 @@
   Register api_function_address = x1;
   Register context = cp;

-  int argc = ArgumentBits::decode(bit_field_);
-  bool is_store = IsStoreBits::decode(bit_field_);
-  bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_);
+  int argc = this->argc();
+  bool is_store = this->is_store();
+  bool call_data_undefined = this->call_data_undefined();

   typedef FunctionCallbackArguments FCA;

=======================================
--- /branches/bleeding_edge/src/code-stubs.cc   Tue Aug 26 09:50:09 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.cc   Tue Aug 26 10:39:20 2014 UTC
@@ -676,7 +676,7 @@


 void StoreElementStub::Generate(MacroAssembler* masm) {
-  switch (elements_kind_) {
+  switch (elements_kind()) {
     case FAST_ELEMENTS:
     case FAST_HOLEY_ELEMENTS:
     case FAST_SMI_ELEMENTS:
@@ -699,11 +699,29 @@
       break;
   }
 }
+
+
+void ArgumentsAccessStub::Generate(MacroAssembler* masm) {
+  switch (type()) {
+    case READ_ELEMENT:
+      GenerateReadElement(masm);
+      break;
+    case NEW_SLOPPY_FAST:
+      GenerateNewSloppyFast(masm);
+      break;
+    case NEW_SLOPPY_SLOW:
+      GenerateNewSloppySlow(masm);
+      break;
+    case NEW_STRICT:
+      GenerateNewStrict(masm);
+      break;
+  }
+}


 void ArgumentsAccessStub::PrintName(OStream& os) const {  // NOLINT
   os << "ArgumentsAccessStub_";
-  switch (type_) {
+  switch (type()) {
     case READ_ELEMENT:
       os << "ReadElement";
       break;
@@ -722,7 +740,7 @@


 void CallFunctionStub::PrintName(OStream& os) const {  // NOLINT
-  os << "CallFunctionStub_Args" << argc_;
+  os << "CallFunctionStub_Args" << argc();
 }


@@ -734,7 +752,7 @@

 void ArrayConstructorStub::PrintName(OStream& os) const {  // NOLINT
   os << "ArrayConstructorStub";
-  switch (argument_count_) {
+  switch (argument_count()) {
     case ANY:
       os << "_Any";
       break;
@@ -948,7 +966,8 @@


 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
-    : PlatformCodeStub(isolate), argument_count_(ANY) {
+    : PlatformCodeStub(isolate) {
+  minor_key_ = ArgumentCountBits::encode(ANY);
   ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
 }

@@ -957,11 +976,11 @@
                                            int argument_count)
     : PlatformCodeStub(isolate) {
   if (argument_count == 0) {
-    argument_count_ = NONE;
+    minor_key_ = ArgumentCountBits::encode(NONE);
   } else if (argument_count == 1) {
-    argument_count_ = ONE;
+    minor_key_ = ArgumentCountBits::encode(ONE);
   } else if (argument_count >= 2) {
-    argument_count_ = MORE_THAN_ONE;
+    minor_key_ = ArgumentCountBits::encode(MORE_THAN_ONE);
   } else {
     UNREACHABLE();
   }
=======================================
--- /branches/bleeding_edge/src/code-stubs.h    Tue Aug 26 09:50:09 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.h    Tue Aug 26 10:39:20 2014 UTC
@@ -743,36 +743,38 @@
     kReturnTrueFalseObject = 1 << 2
   };

-  InstanceofStub(Isolate* isolate, Flags flags)
-      : PlatformCodeStub(isolate), flags_(flags) { }
+ InstanceofStub(Isolate* isolate, Flags flags) : PlatformCodeStub(isolate) {
+    minor_key_ = FlagBits::encode(flags);
+  }
+
+  void Generate(MacroAssembler* masm);

   static Register left();
   static Register right();

-  void Generate(MacroAssembler* masm);
-
   virtual void InitializeInterfaceDescriptor(
       CodeStubInterfaceDescriptor* descriptor);

  private:
   Major MajorKey() const { return Instanceof; }
-  uint32_t MinorKey() const { return static_cast<int>(flags_); }

-  bool HasArgsInRegisters() const {
-    return (flags_ & kArgsInRegisters) != 0;
-  }
+  Flags flags() const { return FlagBits::decode(minor_key_); }
+
+ bool HasArgsInRegisters() const { return (flags() & kArgsInRegisters) != 0; }

   bool HasCallSiteInlineCheck() const {
-    return (flags_ & kCallSiteInlineCheck) != 0;
+    return (flags() & kCallSiteInlineCheck) != 0;
   }

   bool ReturnTrueFalseObject() const {
-    return (flags_ & kReturnTrueFalseObject) != 0;
+    return (flags() & kReturnTrueFalseObject) != 0;
   }

   virtual void PrintName(OStream& os) const V8_OVERRIDE;  // NOLINT

-  Flags flags_;
+  class FlagBits : public BitField<Flags, 0, 3> {};
+
+  DISALLOW_COPY_AND_ASSIGN(InstanceofStub);
 };


@@ -787,19 +789,26 @@
  public:
   enum ArgumentCountKey { ANY, NONE, ONE, MORE_THAN_ONE };
   ArrayConstructorStub(Isolate* isolate, int argument_count);
+
   explicit ArrayConstructorStub(Isolate* isolate);

   void Generate(MacroAssembler* masm);

  private:
+  virtual CodeStub::Major MajorKey() const { return ArrayConstructor; }
+
+  ArgumentCountKey argument_count() const {
+    return ArgumentCountBits::decode(minor_key_);
+  }
+
   void GenerateDispatchToArrayStub(MacroAssembler* masm,
                                    AllocationSiteOverrideMode mode);
+
   virtual void PrintName(OStream& os) const V8_OVERRIDE;  // NOLINT

-  virtual CodeStub::Major MajorKey() const { return ArrayConstructor; }
-  virtual uint32_t MinorKey() const { return argument_count_; }
+  class ArgumentCountBits : public BitField<ArgumentCountKey, 0, 2> {};

-  ArgumentCountKey argument_count_;
+  DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStub);
 };


@@ -811,9 +820,10 @@

  private:
virtual CodeStub::Major MajorKey() const { return InternalArrayConstructor; }
-  virtual uint32_t MinorKey() const { return 0; }

   void GenerateCase(MacroAssembler* masm, ElementsKind kind);
+
+  DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStub);
 };


@@ -822,14 +832,22 @@
   enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK };

   MathPowStub(Isolate* isolate, ExponentType exponent_type)
-      : PlatformCodeStub(isolate), exponent_type_(exponent_type) { }
+      : PlatformCodeStub(isolate) {
+    minor_key_ = ExponentTypeBits::encode(exponent_type);
+  }
+
   virtual void Generate(MacroAssembler* masm);

  private:
   virtual CodeStub::Major MajorKey() const { return MathPow; }
-  virtual uint32_t MinorKey() const { return exponent_type_; }
+
+  ExponentType exponent_type() const {
+    return ExponentTypeBits::decode(minor_key_);
+  }
+
+  class ExponentTypeBits : public BitField<ExponentType, 0, 2> {};

-  ExponentType exponent_type_;
+  DISALLOW_COPY_AND_ASSIGN(MathPowStub);
 };


@@ -900,7 +918,8 @@

  private:
   virtual CodeStub::Major MajorKey() const { return FunctionPrototype; }
-  virtual uint32_t MinorKey() const { return 0; }
+
+  DISALLOW_COPY_AND_ASSIGN(FunctionPrototypeStub);
 };


@@ -1076,23 +1095,26 @@
                       bool is_store,
                       bool call_data_undefined,
                       int argc) : PlatformCodeStub(isolate) {
-    bit_field_ =
-        IsStoreBits::encode(is_store) |
-        CallDataUndefinedBits::encode(call_data_undefined) |
-        ArgumentBits::encode(argc);
+    minor_key_ = IsStoreBits::encode(is_store) |
+                 CallDataUndefinedBits::encode(call_data_undefined) |
+                 ArgumentBits::encode(argc);
     DCHECK(!is_store || argc == 1);
   }

  private:
   virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
   virtual Major MajorKey() const V8_OVERRIDE { return CallApiFunction; }
-  virtual uint32_t MinorKey() const V8_OVERRIDE { return bit_field_; }
+
+  bool is_store() const { return IsStoreBits::decode(minor_key_); }
+  bool call_data_undefined() const {
+    return CallDataUndefinedBits::decode(minor_key_);
+  }
+  int argc() const { return ArgumentBits::decode(minor_key_); }

   class IsStoreBits: public BitField<bool, 0, 1> {};
   class CallDataUndefinedBits: public BitField<bool, 1, 1> {};
   class ArgumentBits: public BitField<int, 2, Code::kArgumentsBits> {};
-
-  int bit_field_;
+  STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);

   DISALLOW_COPY_AND_ASSIGN(CallApiFunctionStub);
 };
@@ -1105,7 +1127,6 @@
  private:
   virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
   virtual Major MajorKey() const V8_OVERRIDE { return CallApiGetter; }
-  virtual uint32_t MinorKey() const V8_OVERRIDE { return 0; }

   DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub);
 };
@@ -1493,6 +1514,8 @@

   class SaveDoublesBits : public BitField<bool, 0, 1> {};
   class ResultSizeBits : public BitField<int, 1, 3> {};
+
+  DISALLOW_COPY_AND_ASSIGN(CEntryStub);
 };


@@ -1507,26 +1530,29 @@

  private:
   Major MajorKey() const { return JSEntry; }
-  uint32_t MinorKey() const { return 0; }

   virtual void FinishCode(Handle<Code> code);

   int handler_offset_;
+
+  DISALLOW_COPY_AND_ASSIGN(JSEntryStub);
 };


 class JSConstructEntryStub : public JSEntryStub {
  public:
- explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) { }
+  explicit JSConstructEntryStub(Isolate* isolate) : JSEntryStub(isolate) {
+    minor_key_ = 1;
+  }

   void Generate(MacroAssembler* masm) { GenerateBody(masm, true); }

  private:
-  uint32_t MinorKey() const { return 1; }
-
   virtual void PrintName(OStream& os) const V8_OVERRIDE {  // NOLINT
     os << "JSConstructEntryStub";
   }
+
+  DISALLOW_COPY_AND_ASSIGN(JSConstructEntryStub);
 };


@@ -1539,14 +1565,14 @@
     NEW_STRICT
   };

-  ArgumentsAccessStub(Isolate* isolate, Type type)
-      : PlatformCodeStub(isolate), type_(type) { }
+ ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) {
+    minor_key_ = TypeBits::encode(type);
+  }

  private:
-  Type type_;
+  Major MajorKey() const { return ArgumentsAccess; }

-  Major MajorKey() const { return ArgumentsAccess; }
-  uint32_t MinorKey() const { return type_; }
+  Type type() const { return TypeBits::decode(minor_key_); }

   void Generate(MacroAssembler* masm);
   void GenerateReadElement(MacroAssembler* masm);
@@ -1555,6 +1581,10 @@
   void GenerateNewSloppySlow(MacroAssembler* masm);

   virtual void PrintName(OStream& os) const V8_OVERRIDE;  // NOLINT
+
+  class TypeBits : public BitField<Type, 0, 2> {};
+
+  DISALLOW_COPY_AND_ASSIGN(ArgumentsAccessStub);
 };


@@ -1564,9 +1594,10 @@

  private:
   Major MajorKey() const { return RegExpExec; }
-  uint32_t MinorKey() const { return 0; }

   void Generate(MacroAssembler* masm);
+
+  DISALLOW_COPY_AND_ASSIGN(RegExpExecStub);
 };


@@ -1598,8 +1629,9 @@
 class CallFunctionStub: public PlatformCodeStub {
  public:
   CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags)
-      : PlatformCodeStub(isolate), argc_(argc), flags_(flags) {
-    DCHECK(argc <= Code::kMaxArguments);
+      : PlatformCodeStub(isolate) {
+    DCHECK(argc >= 0 && argc <= Code::kMaxArguments);
+    minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags);
   }

   void Generate(MacroAssembler* masm);
@@ -1612,37 +1644,34 @@
       CodeStubInterfaceDescriptor* descriptor);

  private:
-  int argc_;
-  CallFunctionFlags flags_;
+  Major MajorKey() const { return CallFunction; }
+
+  int argc() const { return ArgcBits::decode(minor_key_); }
+  int flags() const { return FlagBits::decode(minor_key_); }
+
+  bool CallAsMethod() const {
+    return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL;
+  }
+
+  bool NeedsChecks() const { return flags() != WRAP_AND_CALL; }

   virtual void PrintName(OStream& os) const V8_OVERRIDE;  // NOLINT

   // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
-  class FlagBits: public BitField<CallFunctionFlags, 0, 2> {};
+  class FlagBits : public BitField<CallFunctionFlags, 0, 2> {};
   class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {};
-
   STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits);

-  Major MajorKey() const { return CallFunction; }
-  uint32_t MinorKey() const {
-    // Encode the parameters in a unique 32 bit value.
-    return FlagBits::encode(flags_) | ArgcBits::encode(argc_);
-  }
-
-  bool CallAsMethod() {
-    return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL;
-  }
-
-  bool NeedsChecks() {
-    return flags_ != WRAP_AND_CALL;
-  }
+  DISALLOW_COPY_AND_ASSIGN(CallFunctionStub);
 };


 class CallConstructStub: public PlatformCodeStub {
  public:
   CallConstructStub(Isolate* isolate, CallConstructorFlags flags)
-      : PlatformCodeStub(isolate), flags_(flags) {}
+      : PlatformCodeStub(isolate) {
+    minor_key_ = FlagBits::encode(flags);
+  }

   void Generate(MacroAssembler* masm);

@@ -1654,16 +1683,19 @@
       CodeStubInterfaceDescriptor* descriptor);

  private:
-  CallConstructorFlags flags_;
+  Major MajorKey() const { return CallConstruct; }
+
+ CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); }
+
+  bool RecordCallTarget() const {
+    return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0;
+  }

   virtual void PrintName(OStream& os) const V8_OVERRIDE;  // NOLINT

-  Major MajorKey() const { return CallConstruct; }
-  uint32_t MinorKey() const { return flags_; }
+  class FlagBits : public BitField<CallConstructorFlags, 0, 1> {};

-  bool RecordCallTarget() const {
-    return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0;
-  }
+  DISALLOW_COPY_AND_ASSIGN(CallConstructStub);
 };


@@ -1862,13 +1894,14 @@
 class LoadDictionaryElementPlatformStub : public PlatformCodeStub {
  public:
   explicit LoadDictionaryElementPlatformStub(Isolate* isolate)
-      : PlatformCodeStub(isolate) {}
+      : PlatformCodeStub(isolate) {
+    minor_key_ = DICTIONARY_ELEMENTS;
+  }

   void Generate(MacroAssembler* masm);

  private:
   Major MajorKey() const { return LoadElement; }
-  uint32_t MinorKey() const { return DICTIONARY_ELEMENTS; }

   DISALLOW_COPY_AND_ASSIGN(LoadDictionaryElementPlatformStub);
 };
@@ -1898,46 +1931,34 @@

 class DoubleToIStub : public PlatformCodeStub {
  public:
-  DoubleToIStub(Isolate* isolate,
-                Register source,
-                Register destination,
-                int offset,
-                bool is_truncating,
-                bool skip_fastpath = false)
-      : PlatformCodeStub(isolate), bit_field_(0) {
-    bit_field_ = SourceRegisterBits::encode(source.code()) |
-      DestinationRegisterBits::encode(destination.code()) |
-      OffsetBits::encode(offset) |
-      IsTruncatingBits::encode(is_truncating) |
-      SkipFastPathBits::encode(skip_fastpath) |
-      SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0);
+  DoubleToIStub(Isolate* isolate, Register source, Register destination,
+                int offset, bool is_truncating, bool skip_fastpath = false)
+      : PlatformCodeStub(isolate) {
+    minor_key_ = SourceRegisterBits::encode(source.code()) |
+                 DestinationRegisterBits::encode(destination.code()) |
+                 OffsetBits::encode(offset) |
+                 IsTruncatingBits::encode(is_truncating) |
+                 SkipFastPathBits::encode(skip_fastpath) |
+                 SSE3Bits::encode(CpuFeatures::IsSupported(SSE3) ? 1 : 0);
   }

-  Register source() {
-    return Register::from_code(SourceRegisterBits::decode(bit_field_));
-  }
+  void Generate(MacroAssembler* masm);

-  Register destination() {
- return Register::from_code(DestinationRegisterBits::decode(bit_field_));
-  }
+  virtual bool SometimesSetsUpAFrame() { return false; }

-  bool is_truncating() {
-    return IsTruncatingBits::decode(bit_field_);
-  }
+ private:
+  Major MajorKey() const { return DoubleToI; }

-  bool skip_fastpath() {
-    return SkipFastPathBits::decode(bit_field_);
+  Register source() const {
+    return Register::from_code(SourceRegisterBits::decode(minor_key_));
   }
-
-  int offset() {
-    return OffsetBits::decode(bit_field_);
+  Register destination() const {
+ return Register::from_code(DestinationRegisterBits::decode(minor_key_));
   }
+ bool is_truncating() const { return IsTruncatingBits::decode(minor_key_); } + bool skip_fastpath() const { return SkipFastPathBits::decode(minor_key_); }
+  int offset() const { return OffsetBits::decode(minor_key_); }

-  void Generate(MacroAssembler* masm);
-
-  virtual bool SometimesSetsUpAFrame() { return false; }
-
- private:
   static const int kBitsPerRegisterNumber = 6;
   STATIC_ASSERT((1L << kBitsPerRegisterNumber) >= Register::kNumRegisters);
   class SourceRegisterBits:
@@ -1954,11 +1975,6 @@
   class SSE3Bits:
public BitField<int, 2 * kBitsPerRegisterNumber + 5, 1> {}; // NOLINT

-  Major MajorKey() const { return DoubleToI; }
-  uint32_t MinorKey() const { return bit_field_; }
-
-  int bit_field_;
-
   DISALLOW_COPY_AND_ASSIGN(DoubleToIStub);
 };

@@ -2283,30 +2299,21 @@

 class StoreElementStub : public PlatformCodeStub {
  public:
-  StoreElementStub(Isolate* isolate, bool is_js_array,
- ElementsKind elements_kind, KeyedAccessStoreMode store_mode)
-      : PlatformCodeStub(isolate),
-        is_js_array_(is_js_array),
-        elements_kind_(elements_kind),
-        store_mode_(store_mode) {}
-
-  Major MajorKey() const { return StoreElement; }
-  uint32_t MinorKey() const {
-    return ElementsKindBits::encode(elements_kind_) |
-        IsJSArrayBits::encode(is_js_array_) |
-        StoreModeBits::encode(store_mode_);
+  StoreElementStub(Isolate* isolate, ElementsKind elements_kind)
+      : PlatformCodeStub(isolate) {
+    minor_key_ = ElementsKindBits::encode(elements_kind);
   }

   void Generate(MacroAssembler* masm);

  private:
-  class ElementsKindBits: public BitField<ElementsKind,      0, 8> {};
-  class StoreModeBits: public BitField<KeyedAccessStoreMode, 8, 4> {};
-  class IsJSArrayBits: public BitField<bool,                12, 1> {};
+  Major MajorKey() const { return StoreElement; }

-  bool is_js_array_;
-  ElementsKind elements_kind_;
-  KeyedAccessStoreMode store_mode_;
+  ElementsKind elements_kind() const {
+    return ElementsKindBits::decode(minor_key_);
+  }
+
+  class ElementsKindBits : public BitField<ElementsKind, 0, 8> {};

   DISALLOW_COPY_AND_ASSIGN(StoreElementStub);
 };
@@ -2483,7 +2490,6 @@

  private:
   Major MajorKey() const { return StoreArrayLiteralElement; }
-  uint32_t MinorKey() const { return 0; }

   void Generate(MacroAssembler* masm);

@@ -2494,22 +2500,22 @@
 class StubFailureTrampolineStub : public PlatformCodeStub {
  public:
StubFailureTrampolineStub(Isolate* isolate, StubFunctionMode function_mode)
-      : PlatformCodeStub(isolate),
-        function_mode_(function_mode) {}
+      : PlatformCodeStub(isolate) {
+    minor_key_ = FunctionModeField::encode(function_mode);
+  }

   static void GenerateAheadOfTime(Isolate* isolate);

  private:
-  class FunctionModeField: public BitField<StubFunctionMode,    0, 1> {};
+  Major MajorKey() const { return StubFailureTrampoline; }

-  Major MajorKey() const { return StubFailureTrampoline; }
-  uint32_t MinorKey() const {
-    return FunctionModeField::encode(function_mode_);
+  StubFunctionMode function_mode() const {
+    return FunctionModeField::decode(minor_key_);
   }

   void Generate(MacroAssembler* masm);

-  StubFunctionMode function_mode_;
+  class FunctionModeField : public BitField<StubFunctionMode, 0, 1> {};

   DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub);
 };
@@ -2531,7 +2537,6 @@
                                   Isolate* isolate);

   Major MajorKey() const { return ProfileEntryHook; }
-  uint32_t MinorKey() const { return 0; }

   void Generate(MacroAssembler* masm);

=======================================
--- /branches/bleeding_edge/src/codegen.cc      Mon Aug 25 13:09:02 2014 UTC
+++ /branches/bleeding_edge/src/codegen.cc      Tue Aug 26 10:39:20 2014 UTC
@@ -233,23 +233,5 @@
   }
   return false;
 }
-
-
-void ArgumentsAccessStub::Generate(MacroAssembler* masm) {
-  switch (type_) {
-    case READ_ELEMENT:
-      GenerateReadElement(masm);
-      break;
-    case NEW_SLOPPY_FAST:
-      GenerateNewSloppyFast(masm);
-      break;
-    case NEW_SLOPPY_SLOW:
-      GenerateNewSloppySlow(masm);
-      break;
-    case NEW_STRICT:
-      GenerateNewStrict(masm);
-      break;
-  }
-}

 } }  // namespace v8::internal
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Aug 26 09:50:09 2014 UTC +++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Tue Aug 26 10:39:20 2014 UTC
@@ -642,7 +642,7 @@
   __ mov(scratch, Immediate(1));
   __ Cvtsi2sd(double_result, scratch);

-  if (exponent_type_ == ON_STACK) {
+  if (exponent_type() == ON_STACK) {
     Label base_is_smi, unpack_exponent;
     // The exponent and base are supplied as arguments on the stack.
     // This can only happen if the stub is called from non-optimized code.
@@ -673,7 +673,7 @@
     __ j(not_equal, &call_runtime);
     __ movsd(double_exponent,
               FieldOperand(exponent, HeapNumber::kValueOffset));
-  } else if (exponent_type_ == TAGGED) {
+  } else if (exponent_type() == TAGGED) {
     __ JumpIfNotSmi(exponent, &exponent_not_smi, Label::kNear);
     __ SmiUntag(exponent);
     __ jmp(&int_exponent);
@@ -683,7 +683,7 @@
               FieldOperand(exponent, HeapNumber::kValueOffset));
   }

-  if (exponent_type_ != INTEGER) {
+  if (exponent_type() != INTEGER) {
     Label fast_power, try_arithmetic_simplification;
     __ DoubleToI(exponent, double_exponent, double_scratch,
                  TREAT_MINUS_ZERO_AS_ZERO, &try_arithmetic_simplification);
@@ -695,7 +695,7 @@
     __ cmp(exponent, Immediate(0x1));
     __ j(overflow, &call_runtime);

-    if (exponent_type_ == ON_STACK) {
+    if (exponent_type() == ON_STACK) {
       // Detect square root case.  Crankshaft detects constant +/-0.5 at
// compile time and uses DoMathPowHalf instead. We then skip this check
       // for non-constant cases of +/-0.5 as these hardly occur.
@@ -857,7 +857,7 @@

   // Returning or bailing out.
   Counters* counters = isolate()->counters();
-  if (exponent_type_ == ON_STACK) {
+  if (exponent_type() == ON_STACK) {
     // The arguments are still on the stack.
     __ bind(&call_runtime);
     __ TailCallRuntime(Runtime::kMathPowRT, 2, 1);
@@ -2282,7 +2282,7 @@


 void CallFunctionStub::Generate(MacroAssembler* masm) {
-  CallFunctionNoFeedback(masm, argc_, NeedsChecks(), CallAsMethod());
+  CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
 }


@@ -4493,9 +4493,8 @@
   __ mov(ebx, MemOperand(ebp, parameter_count_offset));
   masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
   __ pop(ecx);
-  int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE
-      ? kPointerSize
-      : 0;
+  int additional_offset =
+      function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0;
   __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset));
   __ jmp(ecx);  // Return to IC Miss stub, continuation still on stack.
 }
@@ -4695,7 +4694,7 @@
 void ArrayConstructorStub::GenerateDispatchToArrayStub(
     MacroAssembler* masm,
     AllocationSiteOverrideMode mode) {
-  if (argument_count_ == ANY) {
+  if (argument_count() == ANY) {
     Label not_zero_case, not_one_case;
     __ test(eax, eax);
     __ j(not_zero, &not_zero_case);
@@ -4708,11 +4707,11 @@

     __ bind(&not_one_case);
     CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
-  } else if (argument_count_ == NONE) {
+  } else if (argument_count() == NONE) {
     CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
-  } else if (argument_count_ == ONE) {
+  } else if (argument_count() == ONE) {
     CreateArrayDispatchOneArgument(masm, mode);
-  } else if (argument_count_ == MORE_THAN_ONE) {
+  } else if (argument_count() == MORE_THAN_ONE) {
     CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
   } else {
     UNREACHABLE();
@@ -4722,7 +4721,7 @@

 void ArrayConstructorStub::Generate(MacroAssembler* masm) {
   // ----------- S t a t e -------------
-  //  -- eax : argc (only if argument_count_ == ANY)
+  //  -- eax : argc (only if argument_count() == ANY)
   //  -- ebx : AllocationSite or undefined
   //  -- edi : constructor
   //  -- esp[0] : return address
@@ -4870,9 +4869,9 @@
   Register return_address = edi;
   Register context = esi;

-  int argc = ArgumentBits::decode(bit_field_);
-  bool is_store = IsStoreBits::decode(bit_field_);
-  bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_);
+  int argc = this->argc();
+  bool is_store = this->is_store();
+  bool call_data_undefined = this->call_data_undefined();

   typedef FunctionCallbackArguments FCA;

=======================================
--- /branches/bleeding_edge/src/ic/ic-compiler.cc Mon Aug 25 11:17:37 2014 UTC +++ /branches/bleeding_edge/src/ic/ic-compiler.cc Tue Aug 26 10:39:20 2014 UTC
@@ -409,8 +409,7 @@
         cached_stub = StoreFastElementStub(isolate(), is_js_array,
elements_kind, store_mode).GetCode();
       } else {
- cached_stub = StoreElementStub(isolate(), is_js_array, elements_kind,
-                                       store_mode).GetCode();
+        cached_stub = StoreElementStub(isolate(), elements_kind).GetCode();
       }
     }
     DCHECK(!cached_stub.is_null());
@@ -440,8 +439,7 @@
     stub = StoreFastElementStub(isolate(), is_jsarray, elements_kind,
                                 store_mode).GetCode();
   } else {
- stub = StoreElementStub(isolate(), is_jsarray, elements_kind, store_mode)
-               .GetCode();
+    stub = StoreElementStub(isolate(), elements_kind).GetCode();
   }

   __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Aug 26 09:50:09 2014 UTC +++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Tue Aug 26 10:39:20 2014 UTC
@@ -529,7 +529,7 @@
   __ movp(scratch, Immediate(1));
   __ Cvtlsi2sd(double_result, scratch);

-  if (exponent_type_ == ON_STACK) {
+  if (exponent_type() == ON_STACK) {
     Label base_is_smi, unpack_exponent;
     // The exponent and base are supplied as arguments on the stack.
     // This can only happen if the stub is called from non-optimized code.
@@ -559,7 +559,7 @@
                    Heap::kHeapNumberMapRootIndex);
     __ j(not_equal, &call_runtime);
__ movsd(double_exponent, FieldOperand(exponent, HeapNumber::kValueOffset));
-  } else if (exponent_type_ == TAGGED) {
+  } else if (exponent_type() == TAGGED) {
     __ JumpIfNotSmi(exponent, &exponent_not_smi, Label::kNear);
     __ SmiToInteger32(exponent, exponent);
     __ jmp(&int_exponent);
@@ -568,7 +568,7 @@
__ movsd(double_exponent, FieldOperand(exponent, HeapNumber::kValueOffset));
   }

-  if (exponent_type_ != INTEGER) {
+  if (exponent_type() != INTEGER) {
     Label fast_power, try_arithmetic_simplification;
     // Detect integer exponents stored as double.
     __ DoubleToI(exponent, double_exponent, double_scratch,
@@ -581,7 +581,7 @@
     __ cmpl(exponent, Immediate(0x1));
     __ j(overflow, &call_runtime);

-    if (exponent_type_ == ON_STACK) {
+    if (exponent_type() == ON_STACK) {
       // Detect square root case.  Crankshaft detects constant +/-0.5 at
// compile time and uses DoMathPowHalf instead. We then skip this check
       // for non-constant cases of +/-0.5 as these hardly occur.
@@ -740,7 +740,7 @@

   // Returning or bailing out.
   Counters* counters = isolate()->counters();
-  if (exponent_type_ == ON_STACK) {
+  if (exponent_type() == ON_STACK) {
     // The arguments are still on the stack.
     __ bind(&call_runtime);
     __ TailCallRuntime(Runtime::kMathPowRT, 2, 1);
@@ -2166,7 +2166,7 @@


 void CallFunctionStub::Generate(MacroAssembler* masm) {
-  CallFunctionNoFeedback(masm, argc_, NeedsChecks(), CallAsMethod());
+  CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
 }


@@ -4433,9 +4433,8 @@
   __ movp(rbx, MemOperand(rbp, parameter_count_offset));
   masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
   __ PopReturnAddressTo(rcx);
-  int additional_offset = function_mode_ == JS_FUNCTION_STUB_MODE
-      ? kPointerSize
-      : 0;
+  int additional_offset =
+      function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0;
__ leap(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset));
   __ jmp(rcx);  // Return to IC Miss stub, continuation still on stack.
 }
@@ -4643,7 +4642,7 @@
 void ArrayConstructorStub::GenerateDispatchToArrayStub(
     MacroAssembler* masm,
     AllocationSiteOverrideMode mode) {
-  if (argument_count_ == ANY) {
+  if (argument_count() == ANY) {
     Label not_zero_case, not_one_case;
     __ testp(rax, rax);
     __ j(not_zero, &not_zero_case);
@@ -4656,11 +4655,11 @@

     __ bind(&not_one_case);
     CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
-  } else if (argument_count_ == NONE) {
+  } else if (argument_count() == NONE) {
     CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
-  } else if (argument_count_ == ONE) {
+  } else if (argument_count() == ONE) {
     CreateArrayDispatchOneArgument(masm, mode);
-  } else if (argument_count_ == MORE_THAN_ONE) {
+  } else if (argument_count() == MORE_THAN_ONE) {
     CreateArrayDispatch<ArrayNArgumentsConstructorStub>(masm, mode);
   } else {
     UNREACHABLE();
@@ -4821,9 +4820,9 @@
   Register return_address = rdi;
   Register context = rsi;

-  int argc = ArgumentBits::decode(bit_field_);
-  bool is_store = IsStoreBits::decode(bit_field_);
-  bool call_data_undefined = CallDataUndefinedBits::decode(bit_field_);
+  int argc = this->argc();
+  bool is_store = this->is_store();
+  bool call_data_undefined = this->call_data_undefined();

   typedef FunctionCallbackArguments FCA;

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