Commit d970e04e authored by whesse@chromium.org's avatar whesse@chromium.org

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
parent f8bf152c
This diff is collapsed.
...@@ -436,6 +436,28 @@ class CodeGenerator: public AstVisitor { ...@@ -436,6 +436,28 @@ class CodeGenerator: public AstVisitor {
StaticType* type, StaticType* type,
const OverwriteMode overwrite_mode = NO_OVERWRITE); 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, void Comparison(Condition cc,
bool strict, bool strict,
ControlDestination* destination); ControlDestination* destination);
...@@ -449,13 +471,6 @@ class CodeGenerator: public AstVisitor { ...@@ -449,13 +471,6 @@ class CodeGenerator: public AstVisitor {
// at most 16 bits of user-controlled data per assembly operation. // at most 16 bits of user-controlled data per assembly operation.
void LoadUnsafeSmi(Register target, Handle<Object> value); 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 CallWithArguments(ZoneList<Expression*>* arguments, int position);
void CheckStack(); void CheckStack();
...@@ -562,7 +577,6 @@ class CodeGenerator: public AstVisitor { ...@@ -562,7 +577,6 @@ class CodeGenerator: public AstVisitor {
#endif #endif
bool is_eval_; // Tells whether code is generated for eval. bool is_eval_; // Tells whether code is generated for eval.
Handle<Script> script_; Handle<Script> script_;
List<DeferredCode*> deferred_; List<DeferredCode*> deferred_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment