OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4090 // Try to inline calls like Math.* as operations in the calling function. | 4090 // Try to inline calls like Math.* as operations in the calling function. |
4091 if (!expr->target()->shared()->IsBuiltinMathFunction()) return false; | 4091 if (!expr->target()->shared()->IsBuiltinMathFunction()) return false; |
4092 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); | 4092 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); |
4093 int argument_count = expr->arguments()->length() + 1; // Plus receiver. | 4093 int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
4094 switch (id) { | 4094 switch (id) { |
4095 case kMathRound: | 4095 case kMathRound: |
4096 case kMathFloor: | 4096 case kMathFloor: |
4097 case kMathAbs: | 4097 case kMathAbs: |
4098 case kMathSqrt: | 4098 case kMathSqrt: |
4099 case kMathLog: | 4099 case kMathLog: |
| 4100 case kMathSin: |
| 4101 case kMathCos: |
4100 if (argument_count == 2) { | 4102 if (argument_count == 2) { |
4101 HValue* argument = Pop(); | 4103 HValue* argument = Pop(); |
4102 Drop(1); // Receiver. | 4104 Drop(1); // Receiver. |
4103 HUnaryMathOperation* op = new HUnaryMathOperation(argument, id); | 4105 HUnaryMathOperation* op = new HUnaryMathOperation(argument, id); |
4104 op->set_position(expr->position()); | 4106 op->set_position(expr->position()); |
4105 ast_context()->ReturnInstruction(op, expr->id()); | 4107 ast_context()->ReturnInstruction(op, expr->id()); |
4106 return true; | 4108 return true; |
4107 } | 4109 } |
4108 break; | 4110 break; |
4109 case kMathPow: | 4111 case kMathPow: |
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5675 } | 5677 } |
5676 | 5678 |
5677 #ifdef DEBUG | 5679 #ifdef DEBUG |
5678 if (graph_ != NULL) graph_->Verify(); | 5680 if (graph_ != NULL) graph_->Verify(); |
5679 if (chunk_ != NULL) chunk_->Verify(); | 5681 if (chunk_ != NULL) chunk_->Verify(); |
5680 if (allocator_ != NULL) allocator_->Verify(); | 5682 if (allocator_ != NULL) allocator_->Verify(); |
5681 #endif | 5683 #endif |
5682 } | 5684 } |
5683 | 5685 |
5684 } } // namespace v8::internal | 5686 } } // namespace v8::internal |
OLD | NEW |