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 6865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6876 } | 6876 } |
6877 } | 6877 } |
6878 | 6878 |
6879 if (result == NULL) { | 6879 if (result == NULL) { |
6880 result = NewUncasted<HPower>(left, right); | 6880 result = NewUncasted<HPower>(left, right); |
6881 } | 6881 } |
6882 ast_context()->ReturnInstruction(result, expr->id()); | 6882 ast_context()->ReturnInstruction(result, expr->id()); |
6883 return true; | 6883 return true; |
6884 } | 6884 } |
6885 break; | 6885 break; |
6886 case kMathRandom: | |
6887 if (argument_count == 1 && check_type == RECEIVER_MAP_CHECK) { | |
6888 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); | |
6889 Drop(1); // Receiver. | |
6890 HGlobalObject* global_object = Add<HGlobalObject>(); | |
6891 HRandom* result = New<HRandom>(global_object); | |
6892 ast_context()->ReturnInstruction(result, expr->id()); | |
6893 return true; | |
6894 } | |
6895 break; | |
6896 case kMathMax: | 6886 case kMathMax: |
6897 case kMathMin: | 6887 case kMathMin: |
6898 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { | 6888 if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) { |
6899 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); | 6889 AddCheckConstantFunction(expr->holder(), receiver, receiver_map); |
6900 HValue* right = Pop(); | 6890 HValue* right = Pop(); |
6901 HValue* left = Pop(); | 6891 HValue* left = Pop(); |
6902 Drop(1); // Receiver. | 6892 Drop(1); // Receiver. |
6903 HMathMinMax::Operation op = (id == kMathMin) ? HMathMinMax::kMathMin | 6893 HMathMinMax::Operation op = (id == kMathMin) ? HMathMinMax::kMathMin |
6904 : HMathMinMax::kMathMax; | 6894 : HMathMinMax::kMathMax; |
6905 HInstruction* result = NewUncasted<HMathMinMax>(left, right, op); | 6895 HInstruction* result = NewUncasted<HMathMinMax>(left, right, op); |
(...skipping 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9024 return ast_context()->ReturnControl(result, call->id()); | 9014 return ast_context()->ReturnControl(result, call->id()); |
9025 } | 9015 } |
9026 | 9016 |
9027 | 9017 |
9028 void HOptimizedGraphBuilder::GenerateLog(CallRuntime* call) { | 9018 void HOptimizedGraphBuilder::GenerateLog(CallRuntime* call) { |
9029 // %_Log is ignored in optimized code. | 9019 // %_Log is ignored in optimized code. |
9030 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); | 9020 return ast_context()->ReturnValue(graph()->GetConstantUndefined()); |
9031 } | 9021 } |
9032 | 9022 |
9033 | 9023 |
9034 // Fast support for Math.random(). | |
9035 void HOptimizedGraphBuilder::GenerateRandomHeapNumber(CallRuntime* call) { | |
9036 HGlobalObject* global_object = Add<HGlobalObject>(); | |
9037 HRandom* result = New<HRandom>(global_object); | |
9038 return ast_context()->ReturnInstruction(result, call->id()); | |
9039 } | |
9040 | |
9041 | |
9042 // Fast support for StringAdd. | 9024 // Fast support for StringAdd. |
9043 void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { | 9025 void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { |
9044 ASSERT_EQ(2, call->arguments()->length()); | 9026 ASSERT_EQ(2, call->arguments()->length()); |
9045 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); | 9027 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); |
9046 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); | 9028 CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); |
9047 HValue* right = Pop(); | 9029 HValue* right = Pop(); |
9048 HValue* left = Pop(); | 9030 HValue* left = Pop(); |
9049 HInstruction* result = New<HStringAdd>(left, right, STRING_ADD_CHECK_BOTH); | 9031 HInstruction* result = New<HStringAdd>(left, right, STRING_ADD_CHECK_BOTH); |
9050 return ast_context()->ReturnInstruction(result, call->id()); | 9032 return ast_context()->ReturnInstruction(result, call->id()); |
9051 } | 9033 } |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9854 if (ShouldProduceTraceOutput()) { | 9836 if (ShouldProduceTraceOutput()) { |
9855 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9837 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9856 } | 9838 } |
9857 | 9839 |
9858 #ifdef DEBUG | 9840 #ifdef DEBUG |
9859 graph_->Verify(false); // No full verify. | 9841 graph_->Verify(false); // No full verify. |
9860 #endif | 9842 #endif |
9861 } | 9843 } |
9862 | 9844 |
9863 } } // namespace v8::internal | 9845 } } // namespace v8::internal |
OLD | NEW |