OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 VisitInDuplicateContext(right); | 1045 VisitInDuplicateContext(right); |
1046 __ bind(&done); | 1046 __ bind(&done); |
1047 } | 1047 } |
1048 | 1048 |
1049 | 1049 |
1050 void FullCodeGenerator::VisitArithmeticExpression(BinaryOperation* expr) { | 1050 void FullCodeGenerator::VisitArithmeticExpression(BinaryOperation* expr) { |
1051 Token::Value op = expr->op(); | 1051 Token::Value op = expr->op(); |
1052 Comment cmnt(masm_, "[ ArithmeticExpression"); | 1052 Comment cmnt(masm_, "[ ArithmeticExpression"); |
1053 Expression* left = expr->left(); | 1053 Expression* left = expr->left(); |
1054 Expression* right = expr->right(); | 1054 Expression* right = expr->right(); |
1055 OverwriteMode mode = | |
1056 left->ResultOverwriteAllowed() | |
1057 ? OVERWRITE_LEFT | |
1058 : (right->ResultOverwriteAllowed() ? OVERWRITE_RIGHT : NO_OVERWRITE); | |
1059 | 1055 |
1060 VisitForStackValue(left); | 1056 VisitForStackValue(left); |
1061 VisitForAccumulatorValue(right); | 1057 VisitForAccumulatorValue(right); |
1062 | 1058 |
1063 SetSourcePosition(expr->position()); | 1059 SetSourcePosition(expr->position()); |
1064 if (ShouldInlineSmiCase(op)) { | 1060 if (ShouldInlineSmiCase(op)) { |
1065 EmitInlineSmiBinaryOp(expr, op, mode, left, right); | 1061 EmitInlineSmiBinaryOp(expr, op, left, right); |
1066 } else { | 1062 } else { |
1067 EmitBinaryOp(expr, op, mode); | 1063 EmitBinaryOp(expr, op); |
1068 } | 1064 } |
1069 } | 1065 } |
1070 | 1066 |
1071 | 1067 |
1072 void FullCodeGenerator::VisitBlock(Block* stmt) { | 1068 void FullCodeGenerator::VisitBlock(Block* stmt) { |
1073 Comment cmnt(masm_, "[ Block"); | 1069 Comment cmnt(masm_, "[ Block"); |
1074 NestedBlock nested_block(this, stmt); | 1070 NestedBlock nested_block(this, stmt); |
1075 SetStatementPosition(stmt); | 1071 SetStatementPosition(stmt); |
1076 | 1072 |
1077 { | 1073 { |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 } | 1824 } |
1829 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1825 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
1830 codegen_->scope_ = saved_scope_; | 1826 codegen_->scope_ = saved_scope_; |
1831 } | 1827 } |
1832 | 1828 |
1833 | 1829 |
1834 #undef __ | 1830 #undef __ |
1835 | 1831 |
1836 | 1832 |
1837 } } // namespace v8::internal | 1833 } } // namespace v8::internal |
OLD | NEW |