| Index: src/code-stubs.h
 | 
| diff --git a/src/code-stubs.h b/src/code-stubs.h
 | 
| index 527abde958843aa2bbaa255949b43c0a4316efb8..ae113f5729a58d26bcdfeffff0ee5011a2570954 100644
 | 
| --- a/src/code-stubs.h
 | 
| +++ b/src/code-stubs.h
 | 
| @@ -162,29 +162,20 @@ class CodeStub BASE_EMBEDDED {
 | 
|    // Lookup the code in the (possibly custom) cache.
 | 
|    bool FindCodeInCache(Code** code_out, Isolate* isolate);
 | 
|  
 | 
| -  // Returns information for computing the number key.
 | 
| -  virtual Major MajorKey() = 0;
 | 
| -  virtual int MinorKey() = 0;
 | 
| -
 | 
|   protected:
 | 
|    static bool CanUseFPRegisters();
 | 
|  
 | 
| -  // Generates the assembler code for the stub.
 | 
| -  virtual Handle<Code> GenerateCode() = 0;
 | 
| -
 | 
| -  // BinaryOpStub needs to override this.
 | 
| -  virtual InlineCacheState GetICState() {
 | 
| -    return UNINITIALIZED;
 | 
| -  }
 | 
| + private:
 | 
| +  // Nonvirtual wrapper around the stub-specific Generate function.  Call
 | 
| +  // this function to set up the macro assembler and generate the code.
 | 
| +  void GenerateCode(MacroAssembler* masm);
 | 
|  
 | 
| -  // Returns whether the code generated for this stub needs to be allocated as
 | 
| -  // a fixed (non-moveable) code object.
 | 
| -  virtual bool NeedsImmovableCode() { return false; }
 | 
| +  // Generates the assembler code for the stub.
 | 
| +  virtual void Generate(MacroAssembler* masm) = 0;
 | 
|  
 | 
| - private:
 | 
|    // Perform bookkeeping required after code generation when stub code is
 | 
|    // initially generated.
 | 
| -  void RecordCodeGeneration(Code* code, Isolate* isolate);
 | 
| +  void RecordCodeGeneration(Code* code, MacroAssembler* masm);
 | 
|  
 | 
|    // Finish the code object after it has been generated.
 | 
|    virtual void FinishCode(Handle<Code> code) { }
 | 
| @@ -193,9 +184,18 @@ class CodeStub BASE_EMBEDDED {
 | 
|    // registering stub in the stub cache.
 | 
|    virtual void Activate(Code* code) { }
 | 
|  
 | 
| +  // Returns information for computing the number key.
 | 
| +  virtual Major MajorKey() = 0;
 | 
| +  virtual int MinorKey() = 0;
 | 
| +
 | 
|    // BinaryOpStub needs to override this.
 | 
|    virtual int GetCodeKind();
 | 
|  
 | 
| +  // BinaryOpStub needs to override this.
 | 
| +  virtual InlineCacheState GetICState() {
 | 
| +    return UNINITIALIZED;
 | 
| +  }
 | 
| +
 | 
|    // Add the code to a specialized cache, specific to an individual
 | 
|    // stub type. Please note, this method must add the code object to a
 | 
|    // roots object, otherwise we will remove the code during GC.
 | 
| @@ -213,6 +213,10 @@ class CodeStub BASE_EMBEDDED {
 | 
|    SmartArrayPointer<const char> GetName();
 | 
|    virtual void PrintName(StringStream* stream);
 | 
|  
 | 
| +  // Returns whether the code generated for this stub needs to be allocated as
 | 
| +  // a fixed (non-moveable) code object.
 | 
| +  virtual bool NeedsImmovableCode() { return false; }
 | 
| +
 | 
|    // Computes the key based on major and minor.
 | 
|    uint32_t GetKey() {
 | 
|      ASSERT(static_cast<int>(MajorKey()) < NUMBER_OF_IDS);
 | 
| @@ -228,51 +232,6 @@ class CodeStub BASE_EMBEDDED {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class PlatformCodeStub : public CodeStub {
 | 
| - public:
 | 
| -  // Retrieve the code for the stub. Generate the code if needed.
 | 
| -  virtual Handle<Code> GenerateCode();
 | 
| -
 | 
| -  virtual int GetCodeKind() { return Code::STUB; }
 | 
| -
 | 
| - protected:
 | 
| -  // Generates the assembler code for the stub.
 | 
| -  virtual void Generate(MacroAssembler* masm) = 0;
 | 
| -};
 | 
| -
 | 
| -
 | 
| -struct CodeStubInterfaceDescriptor {
 | 
| -  CodeStubInterfaceDescriptor()
 | 
| -      : register_param_count_(-1),
 | 
| -        register_params_(NULL) { }
 | 
| -  int register_param_count_;
 | 
| -  Register* register_params_;
 | 
| -  Handle<Code> deoptimization_handler_;
 | 
| -};
 | 
| -
 | 
| -
 | 
| -class HGraph;
 | 
| -struct Register;
 | 
| -class HydrogenCodeStub : public CodeStub {
 | 
| - public:
 | 
| -  // Retrieve the code for the stub. Generate the code if needed.
 | 
| -  virtual Handle<Code> GenerateCode() = 0;
 | 
| -
 | 
| -  virtual int GetCodeKind() { return Code::COMPILED_STUB; }
 | 
| -
 | 
| -  CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate) {
 | 
| -    return isolate->code_stub_interface_descriptor(MajorKey());
 | 
| -  }
 | 
| -
 | 
| -  virtual void InitializeInterfaceDescriptor(
 | 
| -      Isolate* isolate,
 | 
| -      CodeStubInterfaceDescriptor* descriptor) = 0;
 | 
| -
 | 
| - protected:
 | 
| -  Handle<Code> CodeFromGraph(HGraph* graph);
 | 
| -};
 | 
| -
 | 
| -
 | 
|  // Helper interface to prepare to/restore after making runtime calls.
 | 
|  class RuntimeCallHelper {
 | 
|   public:
 | 
| @@ -330,7 +289,7 @@ class NopRuntimeCallHelper : public RuntimeCallHelper {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class StackCheckStub : public PlatformCodeStub {
 | 
| +class StackCheckStub : public CodeStub {
 | 
|   public:
 | 
|    StackCheckStub() { }
 | 
|  
 | 
| @@ -342,7 +301,7 @@ class StackCheckStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class InterruptStub : public PlatformCodeStub {
 | 
| +class InterruptStub : public CodeStub {
 | 
|   public:
 | 
|    InterruptStub() { }
 | 
|  
 | 
| @@ -354,7 +313,7 @@ class InterruptStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class ToNumberStub: public PlatformCodeStub {
 | 
| +class ToNumberStub: public CodeStub {
 | 
|   public:
 | 
|    ToNumberStub() { }
 | 
|  
 | 
| @@ -366,7 +325,7 @@ class ToNumberStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class FastNewClosureStub : public PlatformCodeStub {
 | 
| +class FastNewClosureStub : public CodeStub {
 | 
|   public:
 | 
|    explicit FastNewClosureStub(LanguageMode language_mode)
 | 
|      : language_mode_(language_mode) { }
 | 
| @@ -382,7 +341,7 @@ class FastNewClosureStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class FastNewContextStub : public PlatformCodeStub {
 | 
| +class FastNewContextStub : public CodeStub {
 | 
|   public:
 | 
|    static const int kMaximumSlots = 64;
 | 
|  
 | 
| @@ -400,7 +359,7 @@ class FastNewContextStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class FastNewBlockContextStub : public PlatformCodeStub {
 | 
| +class FastNewBlockContextStub : public CodeStub {
 | 
|   public:
 | 
|    static const int kMaximumSlots = 64;
 | 
|  
 | 
| @@ -418,7 +377,7 @@ class FastNewBlockContextStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class FastCloneShallowArrayStub : public PlatformCodeStub {
 | 
| +class FastCloneShallowArrayStub : public CodeStub {
 | 
|   public:
 | 
|    // Maximum length of copied elements array.
 | 
|    static const int kMaximumClonedLength = 8;
 | 
| @@ -451,7 +410,7 @@ class FastCloneShallowArrayStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class FastCloneShallowObjectStub : public PlatformCodeStub {
 | 
| +class FastCloneShallowObjectStub : public CodeStub {
 | 
|   public:
 | 
|    // Maximum number of properties in copied object.
 | 
|    static const int kMaximumClonedProperties = 6;
 | 
| @@ -471,7 +430,7 @@ class FastCloneShallowObjectStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class InstanceofStub: public PlatformCodeStub {
 | 
| +class InstanceofStub: public CodeStub {
 | 
|   public:
 | 
|    enum Flags {
 | 
|      kNoFlags = 0,
 | 
| @@ -509,7 +468,7 @@ class InstanceofStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class MathPowStub: public PlatformCodeStub {
 | 
| +class MathPowStub: public CodeStub {
 | 
|   public:
 | 
|    enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK};
 | 
|  
 | 
| @@ -525,7 +484,7 @@ class MathPowStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class BinaryOpStub: public PlatformCodeStub {
 | 
| +class BinaryOpStub: public CodeStub {
 | 
|   public:
 | 
|    BinaryOpStub(Token::Value op, OverwriteMode mode)
 | 
|        : op_(op),
 | 
| @@ -641,7 +600,7 @@ class BinaryOpStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class ICCompareStub: public PlatformCodeStub {
 | 
| +class ICCompareStub: public CodeStub {
 | 
|   public:
 | 
|    ICCompareStub(Token::Value op,
 | 
|                  CompareIC::State left,
 | 
| @@ -707,7 +666,7 @@ class ICCompareStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class CEntryStub : public PlatformCodeStub {
 | 
| +class CEntryStub : public CodeStub {
 | 
|   public:
 | 
|    explicit CEntryStub(int result_size,
 | 
|                        SaveFPRegsMode save_doubles = kDontSaveFPRegs)
 | 
| @@ -741,7 +700,7 @@ class CEntryStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class JSEntryStub : public PlatformCodeStub {
 | 
| +class JSEntryStub : public CodeStub {
 | 
|   public:
 | 
|    JSEntryStub() { }
 | 
|  
 | 
| @@ -775,7 +734,7 @@ class JSConstructEntryStub : public JSEntryStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class ArgumentsAccessStub: public PlatformCodeStub {
 | 
| +class ArgumentsAccessStub: public CodeStub {
 | 
|   public:
 | 
|    enum Type {
 | 
|      READ_ELEMENT,
 | 
| @@ -802,7 +761,7 @@ class ArgumentsAccessStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class RegExpExecStub: public PlatformCodeStub {
 | 
| +class RegExpExecStub: public CodeStub {
 | 
|   public:
 | 
|    RegExpExecStub() { }
 | 
|  
 | 
| @@ -814,7 +773,7 @@ class RegExpExecStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class RegExpConstructResultStub: public PlatformCodeStub {
 | 
| +class RegExpConstructResultStub: public CodeStub {
 | 
|   public:
 | 
|    RegExpConstructResultStub() { }
 | 
|  
 | 
| @@ -826,7 +785,7 @@ class RegExpConstructResultStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class CallFunctionStub: public PlatformCodeStub {
 | 
| +class CallFunctionStub: public CodeStub {
 | 
|   public:
 | 
|    CallFunctionStub(int argc, CallFunctionFlags flags)
 | 
|        : argc_(argc), flags_(flags) { }
 | 
| @@ -867,7 +826,7 @@ class CallFunctionStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class CallConstructStub: public PlatformCodeStub {
 | 
| +class CallConstructStub: public CodeStub {
 | 
|   public:
 | 
|    explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {}
 | 
|  
 | 
| @@ -1058,54 +1017,25 @@ class AllowStubCallsScope {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class KeyedLoadDictionaryElementStub : public PlatformCodeStub {
 | 
| +class KeyedLoadElementStub : public CodeStub {
 | 
|   public:
 | 
| -  KeyedLoadDictionaryElementStub() {}
 | 
| +  explicit KeyedLoadElementStub(ElementsKind elements_kind)
 | 
| +      : elements_kind_(elements_kind)
 | 
| +  { }
 | 
|  
 | 
|    Major MajorKey() { return KeyedLoadElement; }
 | 
| -  int MinorKey() { return DICTIONARY_ELEMENTS; }
 | 
| +  int MinorKey() { return elements_kind_; }
 | 
|  
 | 
|    void Generate(MacroAssembler* masm);
 | 
|  
 | 
|   private:
 | 
| -  DISALLOW_COPY_AND_ASSIGN(KeyedLoadDictionaryElementStub);
 | 
| -};
 | 
| -
 | 
| -
 | 
| -class KeyedLoadFastElementStub : public HydrogenCodeStub {
 | 
| - public:
 | 
| -  KeyedLoadFastElementStub(bool is_js_array, ElementsKind elements_kind) {
 | 
| -    bit_field_ = ElementsKindBits::encode(elements_kind) |
 | 
| -        IsJSArrayBits::encode(is_js_array);
 | 
| -  }
 | 
| -
 | 
| -  Major MajorKey() { return KeyedLoadElement; }
 | 
| -  int MinorKey() { return bit_field_; }
 | 
| -
 | 
| -  bool is_js_array() const {
 | 
| -    return IsJSArrayBits::decode(bit_field_);
 | 
| -  }
 | 
| -
 | 
| -  ElementsKind elements_kind() const {
 | 
| -    return ElementsKindBits::decode(bit_field_);
 | 
| -  }
 | 
| -
 | 
| -  virtual Handle<Code> GenerateCode();
 | 
| -
 | 
| -  virtual void InitializeInterfaceDescriptor(
 | 
| -      Isolate* isolate,
 | 
| -      CodeStubInterfaceDescriptor* descriptor);
 | 
| -
 | 
| - private:
 | 
| -  class IsJSArrayBits: public BitField<bool, 8, 1> {};
 | 
| -  class ElementsKindBits: public BitField<ElementsKind, 0, 8> {};
 | 
| -  uint32_t bit_field_;
 | 
| +  ElementsKind elements_kind_;
 | 
|  
 | 
| -  DISALLOW_COPY_AND_ASSIGN(KeyedLoadFastElementStub);
 | 
| +  DISALLOW_COPY_AND_ASSIGN(KeyedLoadElementStub);
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class KeyedStoreElementStub : public PlatformCodeStub {
 | 
| +class KeyedStoreElementStub : public CodeStub {
 | 
|   public:
 | 
|    KeyedStoreElementStub(bool is_js_array,
 | 
|                          ElementsKind elements_kind,
 | 
| @@ -1140,7 +1070,7 @@ class KeyedStoreElementStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class ToBooleanStub: public PlatformCodeStub {
 | 
| +class ToBooleanStub: public CodeStub {
 | 
|   public:
 | 
|    enum Type {
 | 
|      UNDEFINED,
 | 
| @@ -1210,7 +1140,7 @@ class ToBooleanStub: public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class ElementsTransitionAndStoreStub : public PlatformCodeStub {
 | 
| +class ElementsTransitionAndStoreStub : public CodeStub {
 | 
|   public:
 | 
|    ElementsTransitionAndStoreStub(ElementsKind from,
 | 
|                                   ElementsKind to,
 | 
| @@ -1251,7 +1181,7 @@ class ElementsTransitionAndStoreStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class StoreArrayLiteralElementStub : public PlatformCodeStub {
 | 
| +class StoreArrayLiteralElementStub : public CodeStub {
 | 
|   public:
 | 
|    StoreArrayLiteralElementStub()
 | 
|          : fp_registers_(CanUseFPRegisters()) { }
 | 
| @@ -1270,7 +1200,7 @@ class StoreArrayLiteralElementStub : public PlatformCodeStub {
 | 
|  };
 | 
|  
 | 
|  
 | 
| -class ProfileEntryHookStub : public PlatformCodeStub {
 | 
| +class ProfileEntryHookStub : public CodeStub {
 | 
|   public:
 | 
|    explicit ProfileEntryHookStub() {}
 | 
|  
 | 
| 
 |