Index: src/full-codegen.h |
=================================================================== |
--- src/full-codegen.h (revision 5348) |
+++ src/full-codegen.h (working copy) |
@@ -237,6 +237,12 @@ |
kStack |
}; |
+ enum ConstantOperand { |
+ kNoConstants, |
+ kLeftConstant, |
+ kRightConstant |
+ }; |
+ |
// Compute the frame pointer relative offset for a given local or |
// parameter slot. |
int SlotOffset(Slot* slot); |
@@ -245,6 +251,11 @@ |
// operation. |
bool ShouldInlineSmiCase(Token::Value op); |
+ // Compute which (if any) of the operands is a compile-time constant. |
+ ConstantOperand GetConstantOperand(Token::Value op, |
+ Expression* left, |
+ Expression* right); |
+ |
// Emit code to convert a pure value (in a register, slot, as a literal, |
// or on top of the stack) into the result expected according to an |
// expression context. |
@@ -361,7 +372,6 @@ |
void EmitCallWithIC(Call* expr, Handle<Object> name, RelocInfo::Mode mode); |
void EmitKeyedCallWithIC(Call* expr, Expression* key, RelocInfo::Mode mode); |
- |
// Platform-specific code for inline runtime calls. |
void EmitInlineRuntimeCall(CallRuntime* expr); |
@@ -393,6 +403,47 @@ |
Expression::Context context, |
OverwriteMode mode); |
+ // Helper functions for generating inlined smi code for certain |
+ // binary operations. |
+ void EmitInlineSmiBinaryOp(Expression* expr, |
+ Token::Value op, |
+ Expression::Context context, |
+ OverwriteMode mode, |
+ Expression* left, |
+ Expression* right, |
+ ConstantOperand constant); |
+ |
+ void EmitConstantSmiBinaryOp(Expression* expr, |
+ Token::Value op, |
+ Expression::Context context, |
+ OverwriteMode mode, |
+ bool left_is_constant_smi, |
+ Smi* value); |
+ |
+ void EmitConstantSmiBitOp(Expression* expr, |
+ Token::Value op, |
+ Expression::Context context, |
+ OverwriteMode mode, |
+ Smi* value); |
+ |
+ void EmitConstantSmiShiftOp(Expression* expr, |
+ Token::Value op, |
+ Expression::Context context, |
+ OverwriteMode mode, |
+ Smi* value); |
+ |
+ void EmitConstantSmiAdd(Expression* expr, |
+ Expression::Context context, |
+ OverwriteMode mode, |
+ bool left_is_constant_smi, |
+ Smi* value); |
+ |
+ void EmitConstantSmiSub(Expression* expr, |
+ Expression::Context context, |
+ OverwriteMode mode, |
+ bool left_is_constant_smi, |
+ Smi* value); |
+ |
// Assign to the given expression as if via '='. The right-hand-side value |
// is expected in the accumulator. |
void EmitAssignment(Expression* expr); |