Index: src/arm/codegen-arm.h |
=================================================================== |
--- src/arm/codegen-arm.h (revision 4770) |
+++ src/arm/codegen-arm.h (working copy) |
@@ -43,6 +43,7 @@ |
enum InitState { CONST_INIT, NOT_CONST_INIT }; |
enum TypeofState { INSIDE_TYPEOF, NOT_INSIDE_TYPEOF }; |
+enum GenerateInlineSmi { DONT_GENERATE_INLINE_SMI, GENERATE_INLINE_SMI }; |
// ------------------------------------------------------------------------- |
@@ -129,27 +130,58 @@ |
// leaves the code generator with a NULL state. |
explicit CodeGenState(CodeGenerator* owner); |
- // Create a code generator state based on a code generator's current |
- // state. The new state has its own pair of branch labels. |
- CodeGenState(CodeGenerator* owner, |
- JumpTarget* true_target, |
- JumpTarget* false_target); |
- |
// Destroy a code generator state and restore the owning code generator's |
// previous state. |
- ~CodeGenState(); |
+ virtual ~CodeGenState(); |
- JumpTarget* true_target() const { return true_target_; } |
- JumpTarget* false_target() const { return false_target_; } |
+ virtual JumpTarget* true_target() const { return NULL; } |
+ virtual JumpTarget* false_target() const { return NULL; } |
+ protected: |
+ inline CodeGenerator* owner() { return owner_; } |
+ inline CodeGenState* previous() const { return previous_; } |
+ |
private: |
CodeGenerator* owner_; |
+ CodeGenState* previous_; |
+}; |
+ |
+ |
+class ConditionCodeGenState : public CodeGenState { |
+ public: |
+ // Create a code generator state based on a code generator's current |
+ // state. The new state has its own pair of branch labels. |
+ ConditionCodeGenState(CodeGenerator* owner, |
+ JumpTarget* true_target, |
+ JumpTarget* false_target); |
+ |
+ virtual JumpTarget* true_target() const { return true_target_; } |
+ virtual JumpTarget* false_target() const { return false_target_; } |
+ |
+ private: |
JumpTarget* true_target_; |
JumpTarget* false_target_; |
- CodeGenState* previous_; |
}; |
+class TypeInfoCodeGenState : public CodeGenState { |
+ public: |
+ TypeInfoCodeGenState(CodeGenerator* owner, |
+ Slot* slot_number, |
+ TypeInfo info); |
+ ~TypeInfoCodeGenState(); |
+ |
+ virtual JumpTarget* true_target() const { return previous()->true_target(); } |
+ virtual JumpTarget* false_target() const { |
+ return previous()->false_target(); |
+ } |
+ |
+ private: |
+ Slot* slot_; |
+ TypeInfo old_type_info_; |
+}; |
+ |
+ |
// ------------------------------------------------------------------------- |
// Arguments allocation mode |
@@ -216,6 +248,23 @@ |
CodeGenState* state() { return state_; } |
void set_state(CodeGenState* state) { state_ = state; } |
+ TypeInfo type_info(Slot* slot) { |
+ int index = NumberOfSlot(slot); |
+ if (index == kInvalidSlotNumber) return TypeInfo::Unknown(); |
+ return (*type_info_)[index]; |
+ } |
+ |
+ TypeInfo set_type_info(Slot* slot, TypeInfo info) { |
+ int index = NumberOfSlot(slot); |
+ ASSERT(index >= kInvalidSlotNumber); |
+ if (index != kInvalidSlotNumber) { |
+ TypeInfo previous_value = (*type_info_)[index]; |
+ (*type_info_)[index] = info; |
+ return previous_value; |
+ } |
+ return TypeInfo::Unknown(); |
+ } |
+ |
void AddDeferred(DeferredCode* code) { deferred_.Add(code); } |
static const int kUnknownIntValue = -1; |
@@ -225,7 +274,7 @@ |
static int InlineRuntimeCallArgumentsCount(Handle<String> name); |
// Constants related to patching of inlined load/store. |
- static const int kInlinedKeyedLoadInstructionsAfterPatch = 19; |
+ static const int kInlinedKeyedLoadInstructionsAfterPatch = 17; |
static const int kInlinedKeyedStoreInstructionsAfterPatch = 5; |
private: |
@@ -239,6 +288,10 @@ |
// Generating deferred code. |
void ProcessDeferred(); |
+ static const int kInvalidSlotNumber = -1; |
+ |
+ int NumberOfSlot(Slot* slot); |
+ |
// State |
bool has_cc() const { return cc_reg_ != al; } |
JumpTarget* true_target() const { return state_->true_target(); } |
@@ -349,11 +402,9 @@ |
// Generate code that computes a shortcutting logical operation. |
void GenerateLogicalBooleanOperation(BinaryOperation* node); |
- void GenericBinaryOperation(Token::Value op, |
- OverwriteMode overwrite_mode, |
- int known_rhs = kUnknownIntValue); |
void VirtualFrameBinaryOperation(Token::Value op, |
OverwriteMode overwrite_mode, |
+ GenerateInlineSmi inline_smi, |
int known_rhs = kUnknownIntValue); |
void Comparison(Condition cc, |
Expression* left, |
@@ -511,6 +562,8 @@ |
CodeGenState* state_; |
int loop_nesting_; |
+ Vector<TypeInfo>* type_info_; |
+ |
// Jump targets |
BreakTarget function_return_; |