OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 7468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7479 } | 7479 } |
7480 } | 7480 } |
7481 | 7481 |
7482 if (result == NULL) { | 7482 if (result == NULL) { |
7483 result = NewUncasted<HPower>(left, right); | 7483 result = NewUncasted<HPower>(left, right); |
7484 } | 7484 } |
7485 ast_context()->ReturnInstruction(result, expr->id()); | 7485 ast_context()->ReturnInstruction(result, expr->id()); |
7486 return true; | 7486 return true; |
7487 } | 7487 } |
7488 break; | 7488 break; |
7489 case kMathRandom: | |
7490 if (argument_count == 1 && check_type == RECEIVER_MAP_CHECK) { | |
7491 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); | |
7492 Drop(1); // Receiver. | |
7493 HGlobalObject* global_object = Add<HGlobalObject>(); | |
7494 HRandom* result = New<HRandom>(global_object); | |
7495 ast_context()->ReturnInstruction(result, expr->id()); | |
7496 return true; | |
7497 } | |
7498 break; | |
7499 case kMathMax: | 7489 case kMathMax: |
7500 case kMathMin: | 7490 case kMathMin: |
7501 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { | 7491 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { |
7502 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); | 7492 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); |
7503 HValue* right = Pop(); | 7493 HValue* right = Pop(); |
7504 HValue* left = Pop(); | 7494 HValue* left = Pop(); |
7505 Drop(1); // Receiver. | 7495 Drop(1); // Receiver. |
7506 HMathMinMax::Operation op = (id == kMathMin) ? HMathMinMax::kMathMin | 7496 HMathMinMax::Operation op = (id == kMathMin) ? HMathMinMax::kMathMin |
7507 : HMathMinMax::kMathMax; | 7497 : HMathMinMax::kMathMax; |
7508 HInstruction* result = NewUncasted<HMathMinMax>(left, right, op); | 7498 HInstruction* result = NewUncasted<HMathMinMax>(left, right, op); |
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9861 return ast_context()->ReturnControl(result, call->id()); | 9851 return ast_context()->ReturnControl(result, call->id()); |
9862 } | 9852 } |
9863 | 9853 |
9864 | 9854 |
9865 void HOptimizedGraphBuilder::GenerateLog(CallRuntime* call) { | 9855 void HOptimizedGraphBuilder::GenerateLog(CallRuntime* call) { |
9866 // %_Log is ignored in optimized code. | 9856 // %_Log is ignored in optimized code. |
9867 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); | 9857 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
9868 } | 9858 } |
9869 | 9859 |
9870 | 9860 |
9871 // Fast support for Math.random(). | |
9872 void HOptimizedGraphBuilder::GenerateRandomHeapNumber(CallRuntime* call) { | |
9873 HGlobalObject* global_object = Add<HGlobalObject>(); | |
9874 HRandom* result = New<HRandom>(global_object); | |
9875 return ast_context()->ReturnInstruction(result, call->id()); | |
9876 } | |
9877 | |
9878 | |
9879 // Fast support for StringAdd. | 9861 // Fast support for StringAdd. |
9880 void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { | 9862 void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { |
9881 ASSERT_EQ(2, call->arguments()->length()); | 9863 ASSERT_EQ(2, call->arguments()->length()); |
9882 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 9864 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
9883 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 9865 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
9884 HValue* right = Pop(); | 9866 HValue* right = Pop(); |
9885 HValue* left = Pop(); | 9867 HValue* left = Pop(); |
9886 HInstruction* result = New<HStringAdd>(left, right, STRING_ADD_CHECK_BOTH); | 9868 HInstruction* result = New<HStringAdd>(left, right, STRING_ADD_CHECK_BOTH); |
9887 return ast_context()->ReturnInstruction(result, call->id()); | 9869 return ast_context()->ReturnInstruction(result, call->id()); |
9888 } | 9870 } |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10665 if (ShouldProduceTraceOutput()) { | 10647 if (ShouldProduceTraceOutput()) { |
10666 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10648 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10667 } | 10649 } |
10668 | 10650 |
10669 #ifdef DEBUG | 10651 #ifdef DEBUG |
10670 graph_->Verify(false); // No full verify. | 10652 graph_->Verify(false); // No full verify. |
10671 #endif | 10653 #endif |
10672 } | 10654 } |
10673 | 10655 |
10674 } } // namespace v8::internal | 10656 } } // namespace v8::internal |
OLD | NEW |