Optimize binary operations in which one or both operands is a constant smi.

Review URL: http://codereview.chromium.org/42006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1621 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
whesse@chromium.org 2009-03-26 13:14:10 +00:00
parent f8bf152c89
commit d970e04e04
2 changed files with 474 additions and 286 deletions

File diff suppressed because it is too large Load Diff

View File

@ -436,6 +436,28 @@ class CodeGenerator: public AstVisitor {
StaticType* type,
const OverwriteMode overwrite_mode = NO_OVERWRITE);
// If possible, combine two constant smi values using op to produce
// a smi result, and push it on the virtual frame, all at compile time.
// Returns true if it succeeds. Otherwise it has no effect.
bool FoldConstantSmis(Token::Value op, int left, int right);
// Emit code to perform a binary operation on
// a constant smi and a likely smi. Consumes the Result *operand.
void ConstantSmiBinaryOperation(Token::Value op,
Result* operand,
Handle<Object> constant_operand,
StaticType* type,
bool reversed,
OverwriteMode overwrite_mode);
// Emit code to perform a binary operation on two likely smis.
// The code to handle smi arguments is produced inline.
// Consumes the Results *left and *right.
void LikelySmiBinaryOperation(Token::Value op,
Result* left,
Result* right,
OverwriteMode overwrite_mode);
void Comparison(Condition cc,
bool strict,
ControlDestination* destination);
@ -449,13 +471,6 @@ class CodeGenerator: public AstVisitor {
// at most 16 bits of user-controlled data per assembly operation.
void LoadUnsafeSmi(Register target, Handle<Object> value);
bool IsInlineSmi(Literal* literal);
void SmiOperation(Token::Value op,
StaticType* type,
Handle<Object> value,
bool reversed,
OverwriteMode overwrite_mode);
void CallWithArguments(ZoneList<Expression*>* arguments, int position);
void CheckStack();
@ -562,7 +577,6 @@ class CodeGenerator: public AstVisitor {
#endif
bool is_eval_; // Tells whether code is generated for eval.
Handle<Script> script_;
List<DeferredCode*> deferred_;