OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 5110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5121 result = new(zone()) HMul(context, left, left); | 5121 result = new(zone()) HMul(context, left, left); |
5122 } | 5122 } |
5123 | 5123 |
5124 if (result == NULL) { | 5124 if (result == NULL) { |
5125 result = new(zone()) HPower(left, right); | 5125 result = new(zone()) HPower(left, right); |
5126 } | 5126 } |
5127 ast_context()->ReturnInstruction(result, expr->id()); | 5127 ast_context()->ReturnInstruction(result, expr->id()); |
5128 return true; | 5128 return true; |
5129 } | 5129 } |
5130 break; | 5130 break; |
| 5131 case kMathRandom: |
| 5132 if (argument_count == 1 && check_type == RECEIVER_MAP_CHECK) { |
| 5133 AddCheckConstantFunction(expr, receiver, receiver_map, true); |
| 5134 Drop(1); |
| 5135 HValue* context = environment()->LookupContext(); |
| 5136 HGlobalObject* global_object = new(zone()) HGlobalObject(context); |
| 5137 AddInstruction(global_object); |
| 5138 HRandom* result = new(zone()) HRandom(global_object); |
| 5139 ast_context()->ReturnInstruction(result, expr->id()); |
| 5140 return true; |
| 5141 } |
| 5142 break; |
5131 default: | 5143 default: |
5132 // Not yet supported for inlining. | 5144 // Not yet supported for inlining. |
5133 break; | 5145 break; |
5134 } | 5146 } |
5135 return false; | 5147 return false; |
5136 } | 5148 } |
5137 | 5149 |
5138 | 5150 |
5139 bool HGraphBuilder::TryCallApply(Call* expr) { | 5151 bool HGraphBuilder::TryCallApply(Call* expr) { |
5140 Expression* callee = expr->expression(); | 5152 Expression* callee = expr->expression(); |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6568 | 6580 |
6569 | 6581 |
6570 void HGraphBuilder::GenerateLog(CallRuntime* call) { | 6582 void HGraphBuilder::GenerateLog(CallRuntime* call) { |
6571 // %_Log is ignored in optimized code. | 6583 // %_Log is ignored in optimized code. |
6572 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); | 6584 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
6573 } | 6585 } |
6574 | 6586 |
6575 | 6587 |
6576 // Fast support for Math.random(). | 6588 // Fast support for Math.random(). |
6577 void HGraphBuilder::GenerateRandomHeapNumber(CallRuntime* call) { | 6589 void HGraphBuilder::GenerateRandomHeapNumber(CallRuntime* call) { |
6578 return Bailout("inlined runtime function: RandomHeapNumber"); | 6590 HValue* context = environment()->LookupContext(); |
| 6591 HGlobalObject* global_object = new(zone()) HGlobalObject(context); |
| 6592 AddInstruction(global_object); |
| 6593 HRandom* result = new(zone()) HRandom(global_object); |
| 6594 return ast_context()->ReturnInstruction(result, call->id()); |
6579 } | 6595 } |
6580 | 6596 |
6581 | 6597 |
6582 // Fast support for StringAdd. | 6598 // Fast support for StringAdd. |
6583 void HGraphBuilder::GenerateStringAdd(CallRuntime* call) { | 6599 void HGraphBuilder::GenerateStringAdd(CallRuntime* call) { |
6584 ASSERT_EQ(2, call->arguments()->length()); | 6600 ASSERT_EQ(2, call->arguments()->length()); |
6585 CHECK_ALIVE(VisitArgumentList(call->arguments())); | 6601 CHECK_ALIVE(VisitArgumentList(call->arguments())); |
6586 HValue* context = environment()->LookupContext(); | 6602 HValue* context = environment()->LookupContext(); |
6587 HCallStub* result = new(zone()) HCallStub(context, CodeStub::StringAdd, 2); | 6603 HCallStub* result = new(zone()) HCallStub(context, CodeStub::StringAdd, 2); |
6588 Drop(2); | 6604 Drop(2); |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7317 } | 7333 } |
7318 } | 7334 } |
7319 | 7335 |
7320 #ifdef DEBUG | 7336 #ifdef DEBUG |
7321 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 7337 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
7322 if (allocator_ != NULL) allocator_->Verify(); | 7338 if (allocator_ != NULL) allocator_->Verify(); |
7323 #endif | 7339 #endif |
7324 } | 7340 } |
7325 | 7341 |
7326 } } // namespace v8::internal | 7342 } } // namespace v8::internal |
OLD | NEW |