| 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 4069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4080 | 4080 |
| 4081 bool HGraphBuilder::TryMathFunctionInline(Call* expr) { | 4081 bool HGraphBuilder::TryMathFunctionInline(Call* expr) { |
| 4082 // Try to inline calls like Math.* as operations in the calling function. | 4082 // Try to inline calls like Math.* as operations in the calling function. |
| 4083 MathFunctionId id = expr->target()->shared()->math_function_id(); | 4083 MathFunctionId id = expr->target()->shared()->math_function_id(); |
| 4084 int argument_count = expr->arguments()->length() + 1; // Plus receiver. | 4084 int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
| 4085 switch (id) { | 4085 switch (id) { |
| 4086 case kMathRound: | 4086 case kMathRound: |
| 4087 case kMathFloor: | 4087 case kMathFloor: |
| 4088 case kMathAbs: | 4088 case kMathAbs: |
| 4089 case kMathSqrt: | 4089 case kMathSqrt: |
| 4090 case kMathLog: |
| 4090 if (argument_count == 2) { | 4091 if (argument_count == 2) { |
| 4091 HValue* argument = Pop(); | 4092 HValue* argument = Pop(); |
| 4092 Drop(1); // Receiver. | 4093 Drop(1); // Receiver. |
| 4093 HUnaryMathOperation* op = new HUnaryMathOperation(argument, id); | 4094 HUnaryMathOperation* op = new HUnaryMathOperation(argument, id); |
| 4094 op->set_position(expr->position()); | 4095 op->set_position(expr->position()); |
| 4095 ast_context()->ReturnInstruction(op, expr->id()); | 4096 ast_context()->ReturnInstruction(op, expr->id()); |
| 4096 return true; | 4097 return true; |
| 4097 } | 4098 } |
| 4098 break; | 4099 break; |
| 4099 case kMathPow: | 4100 case kMathPow: |
| (...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5666 } | 5667 } |
| 5667 | 5668 |
| 5668 #ifdef DEBUG | 5669 #ifdef DEBUG |
| 5669 if (graph_ != NULL) graph_->Verify(); | 5670 if (graph_ != NULL) graph_->Verify(); |
| 5670 if (chunk_ != NULL) chunk_->Verify(); | 5671 if (chunk_ != NULL) chunk_->Verify(); |
| 5671 if (allocator_ != NULL) allocator_->Verify(); | 5672 if (allocator_ != NULL) allocator_->Verify(); |
| 5672 #endif | 5673 #endif |
| 5673 } | 5674 } |
| 5674 | 5675 |
| 5675 } } // namespace v8::internal | 5676 } } // namespace v8::internal |
| OLD | NEW |