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