| 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 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4089 // Try to inline calls like Math.* as operations in the calling function. | 4089 // Try to inline calls like Math.* as operations in the calling function. |
| 4090 if (!expr->target()->shared()->IsBuiltinMathFunction()) return false; | 4090 if (!expr->target()->shared()->IsBuiltinMathFunction()) return false; |
| 4091 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); | 4091 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); |
| 4092 int argument_count = expr->arguments()->length() + 1; // Plus receiver. | 4092 int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
| 4093 switch (id) { | 4093 switch (id) { |
| 4094 case kMathRound: | 4094 case kMathRound: |
| 4095 case kMathFloor: | 4095 case kMathFloor: |
| 4096 case kMathAbs: | 4096 case kMathAbs: |
| 4097 case kMathSqrt: | 4097 case kMathSqrt: |
| 4098 case kMathLog: | 4098 case kMathLog: |
| 4099 case kMathSin: |
| 4100 case kMathCos: |
| 4099 if (argument_count == 2) { | 4101 if (argument_count == 2) { |
| 4100 HValue* argument = Pop(); | 4102 HValue* argument = Pop(); |
| 4101 Drop(1); // Receiver. | 4103 Drop(1); // Receiver. |
| 4102 HUnaryMathOperation* op = new HUnaryMathOperation(argument, id); | 4104 HUnaryMathOperation* op = new HUnaryMathOperation(argument, id); |
| 4103 op->set_position(expr->position()); | 4105 op->set_position(expr->position()); |
| 4104 ast_context()->ReturnInstruction(op, expr->id()); | 4106 ast_context()->ReturnInstruction(op, expr->id()); |
| 4105 return true; | 4107 return true; |
| 4106 } | 4108 } |
| 4107 break; | 4109 break; |
| 4108 case kMathPow: | 4110 case kMathPow: |
| (...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5674 } | 5676 } |
| 5675 | 5677 |
| 5676 #ifdef DEBUG | 5678 #ifdef DEBUG |
| 5677 if (graph_ != NULL) graph_->Verify(); | 5679 if (graph_ != NULL) graph_->Verify(); |
| 5678 if (chunk_ != NULL) chunk_->Verify(); | 5680 if (chunk_ != NULL) chunk_->Verify(); |
| 5679 if (allocator_ != NULL) allocator_->Verify(); | 5681 if (allocator_ != NULL) allocator_->Verify(); |
| 5680 #endif | 5682 #endif |
| 5681 } | 5683 } |
| 5682 | 5684 |
| 5683 } } // namespace v8::internal | 5685 } } // namespace v8::internal |
| OLD | NEW |