Index: src/code-stubs.h |
diff --git a/src/code-stubs.h b/src/code-stubs.h |
index 6188f3484d505676371b9f1ed7ee5fc1a877b5be..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,43 +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 { |
- int number_of_register_params; |
- Register* register_params; |
- Handle<Code> deoptimization_handler; |
-}; |
- |
- |
-class HGraph; |
-class 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; } |
- |
- virtual CodeStubInterfaceDescriptor* GetInterfaceDescriptor( |
- Isolate* isolate) = 0; |
- |
- protected: |
- Handle<Code> CodeFromGraph(HGraph* graph); |
-}; |
- |
- |
// Helper interface to prepare to/restore after making runtime calls. |
class RuntimeCallHelper { |
public: |
@@ -322,7 +289,7 @@ class NopRuntimeCallHelper : public RuntimeCallHelper { |
}; |
-class StackCheckStub : public PlatformCodeStub { |
+class StackCheckStub : public CodeStub { |
public: |
StackCheckStub() { } |
@@ -334,7 +301,7 @@ class StackCheckStub : public PlatformCodeStub { |
}; |
-class InterruptStub : public PlatformCodeStub { |
+class InterruptStub : public CodeStub { |
public: |
InterruptStub() { } |
@@ -346,7 +313,7 @@ class InterruptStub : public PlatformCodeStub { |
}; |
-class ToNumberStub: public PlatformCodeStub { |
+class ToNumberStub: public CodeStub { |
public: |
ToNumberStub() { } |
@@ -358,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) { } |
@@ -374,7 +341,7 @@ class FastNewClosureStub : public PlatformCodeStub { |
}; |
-class FastNewContextStub : public PlatformCodeStub { |
+class FastNewContextStub : public CodeStub { |
public: |
static const int kMaximumSlots = 64; |
@@ -392,7 +359,7 @@ class FastNewContextStub : public PlatformCodeStub { |
}; |
-class FastNewBlockContextStub : public PlatformCodeStub { |
+class FastNewBlockContextStub : public CodeStub { |
public: |
static const int kMaximumSlots = 64; |
@@ -410,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; |
@@ -443,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; |
@@ -463,7 +430,7 @@ class FastCloneShallowObjectStub : public PlatformCodeStub { |
}; |
-class InstanceofStub: public PlatformCodeStub { |
+class InstanceofStub: public CodeStub { |
public: |
enum Flags { |
kNoFlags = 0, |
@@ -501,7 +468,7 @@ class InstanceofStub: public PlatformCodeStub { |
}; |
-class MathPowStub: public PlatformCodeStub { |
+class MathPowStub: public CodeStub { |
public: |
enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; |
@@ -517,7 +484,7 @@ class MathPowStub: public PlatformCodeStub { |
}; |
-class BinaryOpStub: public PlatformCodeStub { |
+class BinaryOpStub: public CodeStub { |
public: |
BinaryOpStub(Token::Value op, OverwriteMode mode) |
: op_(op), |
@@ -633,7 +600,7 @@ class BinaryOpStub: public PlatformCodeStub { |
}; |
-class ICCompareStub: public PlatformCodeStub { |
+class ICCompareStub: public CodeStub { |
public: |
ICCompareStub(Token::Value op, |
CompareIC::State left, |
@@ -699,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) |
@@ -733,7 +700,7 @@ class CEntryStub : public PlatformCodeStub { |
}; |
-class JSEntryStub : public PlatformCodeStub { |
+class JSEntryStub : public CodeStub { |
public: |
JSEntryStub() { } |
@@ -767,7 +734,7 @@ class JSConstructEntryStub : public JSEntryStub { |
}; |
-class ArgumentsAccessStub: public PlatformCodeStub { |
+class ArgumentsAccessStub: public CodeStub { |
public: |
enum Type { |
READ_ELEMENT, |
@@ -794,7 +761,7 @@ class ArgumentsAccessStub: public PlatformCodeStub { |
}; |
-class RegExpExecStub: public PlatformCodeStub { |
+class RegExpExecStub: public CodeStub { |
public: |
RegExpExecStub() { } |
@@ -806,7 +773,7 @@ class RegExpExecStub: public PlatformCodeStub { |
}; |
-class RegExpConstructResultStub: public PlatformCodeStub { |
+class RegExpConstructResultStub: public CodeStub { |
public: |
RegExpConstructResultStub() { } |
@@ -818,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) { } |
@@ -859,7 +826,7 @@ class CallFunctionStub: public PlatformCodeStub { |
}; |
-class CallConstructStub: public PlatformCodeStub { |
+class CallConstructStub: public CodeStub { |
public: |
explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {} |
@@ -1050,53 +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 CodeStubInterfaceDescriptor* GetInterfaceDescriptor( |
- Isolate* isolate); |
- |
- 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, |
@@ -1131,7 +1070,7 @@ class KeyedStoreElementStub : public PlatformCodeStub { |
}; |
-class ToBooleanStub: public PlatformCodeStub { |
+class ToBooleanStub: public CodeStub { |
public: |
enum Type { |
UNDEFINED, |
@@ -1201,7 +1140,7 @@ class ToBooleanStub: public PlatformCodeStub { |
}; |
-class ElementsTransitionAndStoreStub : public PlatformCodeStub { |
+class ElementsTransitionAndStoreStub : public CodeStub { |
public: |
ElementsTransitionAndStoreStub(ElementsKind from, |
ElementsKind to, |
@@ -1242,7 +1181,7 @@ class ElementsTransitionAndStoreStub : public PlatformCodeStub { |
}; |
-class StoreArrayLiteralElementStub : public PlatformCodeStub { |
+class StoreArrayLiteralElementStub : public CodeStub { |
public: |
StoreArrayLiteralElementStub() |
: fp_registers_(CanUseFPRegisters()) { } |
@@ -1261,7 +1200,7 @@ class StoreArrayLiteralElementStub : public PlatformCodeStub { |
}; |
-class ProfileEntryHookStub : public PlatformCodeStub { |
+class ProfileEntryHookStub : public CodeStub { |
public: |
explicit ProfileEntryHookStub() {} |