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 4056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4067 AddInstruction(new HLeaveInlined); | 4067 AddInstruction(new HLeaveInlined); |
4068 HEnvironment* outer = last_environment()->outer(); | 4068 HEnvironment* outer = last_environment()->outer(); |
4069 outer->Push(return_value); | 4069 outer->Push(return_value); |
4070 UpdateEnvironment(outer); | 4070 UpdateEnvironment(outer); |
4071 Goto(target); | 4071 Goto(target); |
4072 } | 4072 } |
4073 | 4073 |
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 if (!expr->target()->shared()->IsBuiltinMathFunction()) return false; |
| 4078 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); |
4078 int argument_count = expr->arguments()->length() + 1; // Plus receiver. | 4079 int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
4079 switch (id) { | 4080 switch (id) { |
4080 case kMathRound: | 4081 case kMathRound: |
4081 case kMathFloor: | 4082 case kMathFloor: |
4082 case kMathAbs: | 4083 case kMathAbs: |
4083 case kMathSqrt: | 4084 case kMathSqrt: |
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); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4129 ast_context()->ReturnInstruction(result, expr->id()); | 4130 ast_context()->ReturnInstruction(result, expr->id()); |
4130 return true; | 4131 return true; |
4131 } | 4132 } |
4132 | 4133 |
4133 result = new HPower(left, right); | 4134 result = new HPower(left, right); |
4134 ast_context()->ReturnInstruction(result, expr->id()); | 4135 ast_context()->ReturnInstruction(result, expr->id()); |
4135 return true; | 4136 return true; |
4136 } | 4137 } |
4137 break; | 4138 break; |
4138 default: | 4139 default: |
4139 // Either not a special math function or not yet supported for inlining. | 4140 // Not yet supported for inlining. |
4140 break; | 4141 break; |
4141 } | 4142 } |
4142 return false; | 4143 return false; |
4143 } | 4144 } |
4144 | 4145 |
4145 | 4146 |
4146 bool HGraphBuilder::TryCallApply(Call* expr) { | 4147 bool HGraphBuilder::TryCallApply(Call* expr) { |
4147 Expression* callee = expr->expression(); | 4148 Expression* callee = expr->expression(); |
4148 Property* prop = callee->AsProperty(); | 4149 Property* prop = callee->AsProperty(); |
4149 ASSERT(prop != NULL); | 4150 ASSERT(prop != NULL); |
(...skipping 1515 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 |