OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/crankshaft/hydrogen.h" | 5 #include "src/crankshaft/hydrogen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 8837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8848 expr->ReturnId(), NORMAL_RETURN, expr->tail_call_mode()); | 8848 expr->ReturnId(), NORMAL_RETURN, expr->tail_call_mode()); |
8849 } | 8849 } |
8850 | 8850 |
8851 | 8851 |
8852 bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr) { | 8852 bool HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(Call* expr) { |
8853 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; | 8853 if (!expr->target()->shared()->HasBuiltinFunctionId()) return false; |
8854 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); | 8854 BuiltinFunctionId id = expr->target()->shared()->builtin_function_id(); |
8855 // We intentionally ignore expr->tail_call_mode() here because builtins | 8855 // We intentionally ignore expr->tail_call_mode() here because builtins |
8856 // we inline here do not observe if they were tail called or not. | 8856 // we inline here do not observe if they were tail called or not. |
8857 switch (id) { | 8857 switch (id) { |
| 8858 case kMathCos: |
8858 case kMathExp: | 8859 case kMathExp: |
8859 case kMathRound: | 8860 case kMathRound: |
8860 case kMathFround: | 8861 case kMathFround: |
8861 case kMathFloor: | 8862 case kMathFloor: |
8862 case kMathAbs: | 8863 case kMathAbs: |
| 8864 case kMathSin: |
8863 case kMathSqrt: | 8865 case kMathSqrt: |
8864 case kMathLog: | 8866 case kMathLog: |
8865 case kMathClz32: | 8867 case kMathClz32: |
8866 if (expr->arguments()->length() == 1) { | 8868 if (expr->arguments()->length() == 1) { |
8867 HValue* argument = Pop(); | 8869 HValue* argument = Pop(); |
8868 Drop(2); // Receiver and function. | 8870 Drop(2); // Receiver and function. |
8869 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id); | 8871 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id); |
8870 ast_context()->ReturnInstruction(op, expr->id()); | 8872 ast_context()->ReturnInstruction(op, expr->id()); |
8871 return true; | 8873 return true; |
8872 } | 8874 } |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9029 HValue* argument = Pop(); | 9031 HValue* argument = Pop(); |
9030 Drop(2); // Receiver and function. | 9032 Drop(2); // Receiver and function. |
9031 argument = AddUncasted<HForceRepresentation>( | 9033 argument = AddUncasted<HForceRepresentation>( |
9032 argument, Representation::Integer32()); | 9034 argument, Representation::Integer32()); |
9033 argument->SetFlag(HValue::kTruncatingToInt32); | 9035 argument->SetFlag(HValue::kTruncatingToInt32); |
9034 HInstruction* result = NewUncasted<HStringCharFromCode>(argument); | 9036 HInstruction* result = NewUncasted<HStringCharFromCode>(argument); |
9035 ast_context()->ReturnInstruction(result, ast_id); | 9037 ast_context()->ReturnInstruction(result, ast_id); |
9036 return true; | 9038 return true; |
9037 } | 9039 } |
9038 break; | 9040 break; |
| 9041 case kMathCos: |
9039 case kMathExp: | 9042 case kMathExp: |
9040 if (!FLAG_fast_math) break; | |
9041 // Fall through if FLAG_fast_math. | |
9042 case kMathRound: | 9043 case kMathRound: |
9043 case kMathFround: | 9044 case kMathFround: |
9044 case kMathFloor: | 9045 case kMathFloor: |
9045 case kMathAbs: | 9046 case kMathAbs: |
| 9047 case kMathSin: |
9046 case kMathSqrt: | 9048 case kMathSqrt: |
9047 case kMathLog: | 9049 case kMathLog: |
9048 case kMathClz32: | 9050 case kMathClz32: |
9049 if (argument_count == 2) { | 9051 if (argument_count == 2) { |
9050 HValue* argument = Pop(); | 9052 HValue* argument = Pop(); |
9051 Drop(2); // Receiver and function. | 9053 Drop(2); // Receiver and function. |
9052 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id); | 9054 HInstruction* op = NewUncasted<HUnaryMathOperation>(argument, id); |
9053 ast_context()->ReturnInstruction(op, ast_id); | 9055 ast_context()->ReturnInstruction(op, ast_id); |
9054 return true; | 9056 return true; |
9055 } | 9057 } |
(...skipping 4644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13700 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13702 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13701 } | 13703 } |
13702 | 13704 |
13703 #ifdef DEBUG | 13705 #ifdef DEBUG |
13704 graph_->Verify(false); // No full verify. | 13706 graph_->Verify(false); // No full verify. |
13705 #endif | 13707 #endif |
13706 } | 13708 } |
13707 | 13709 |
13708 } // namespace internal | 13710 } // namespace internal |
13709 } // namespace v8 | 13711 } // namespace v8 |
OLD | NEW |