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 <memory> | 7 #include <memory> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 8836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8847 default: | 8847 default: |
8848 // Not yet supported for inlining. | 8848 // Not yet supported for inlining. |
8849 break; | 8849 break; |
8850 } | 8850 } |
8851 return false; | 8851 return false; |
8852 } | 8852 } |
8853 | 8853 |
8854 | 8854 |
8855 bool HOptimizedGraphBuilder::TryInlineApiFunctionCall(Call* expr, | 8855 bool HOptimizedGraphBuilder::TryInlineApiFunctionCall(Call* expr, |
8856 HValue* receiver) { | 8856 HValue* receiver) { |
| 8857 if (FLAG_runtime_call_stats) return false; |
8857 Handle<JSFunction> function = expr->target(); | 8858 Handle<JSFunction> function = expr->target(); |
8858 int argc = expr->arguments()->length(); | 8859 int argc = expr->arguments()->length(); |
8859 SmallMapList receiver_maps; | 8860 SmallMapList receiver_maps; |
8860 return TryInlineApiCall(function, receiver, &receiver_maps, argc, expr->id(), | 8861 return TryInlineApiCall(function, receiver, &receiver_maps, argc, expr->id(), |
8861 kCallApiFunction, expr->tail_call_mode()); | 8862 kCallApiFunction, expr->tail_call_mode()); |
8862 } | 8863 } |
8863 | 8864 |
8864 | 8865 |
8865 bool HOptimizedGraphBuilder::TryInlineApiMethodCall( | 8866 bool HOptimizedGraphBuilder::TryInlineApiMethodCall( |
8866 Call* expr, | 8867 Call* expr, |
8867 HValue* receiver, | 8868 HValue* receiver, |
8868 SmallMapList* receiver_maps) { | 8869 SmallMapList* receiver_maps) { |
| 8870 if (FLAG_runtime_call_stats) return false; |
8869 Handle<JSFunction> function = expr->target(); | 8871 Handle<JSFunction> function = expr->target(); |
8870 int argc = expr->arguments()->length(); | 8872 int argc = expr->arguments()->length(); |
8871 return TryInlineApiCall(function, receiver, receiver_maps, argc, expr->id(), | 8873 return TryInlineApiCall(function, receiver, receiver_maps, argc, expr->id(), |
8872 kCallApiMethod, expr->tail_call_mode()); | 8874 kCallApiMethod, expr->tail_call_mode()); |
8873 } | 8875 } |
8874 | 8876 |
8875 bool HOptimizedGraphBuilder::TryInlineApiGetter(Handle<Object> function, | 8877 bool HOptimizedGraphBuilder::TryInlineApiGetter(Handle<Object> function, |
8876 Handle<Map> receiver_map, | 8878 Handle<Map> receiver_map, |
8877 BailoutId ast_id) { | 8879 BailoutId ast_id) { |
| 8880 if (FLAG_runtime_call_stats) return false; |
8878 SmallMapList receiver_maps(1, zone()); | 8881 SmallMapList receiver_maps(1, zone()); |
8879 receiver_maps.Add(receiver_map, zone()); | 8882 receiver_maps.Add(receiver_map, zone()); |
8880 return TryInlineApiCall(function, | 8883 return TryInlineApiCall(function, |
8881 NULL, // Receiver is on expression stack. | 8884 NULL, // Receiver is on expression stack. |
8882 &receiver_maps, 0, ast_id, kCallApiGetter, | 8885 &receiver_maps, 0, ast_id, kCallApiGetter, |
8883 TailCallMode::kDisallow); | 8886 TailCallMode::kDisallow); |
8884 } | 8887 } |
8885 | 8888 |
8886 bool HOptimizedGraphBuilder::TryInlineApiSetter(Handle<Object> function, | 8889 bool HOptimizedGraphBuilder::TryInlineApiSetter(Handle<Object> function, |
8887 Handle<Map> receiver_map, | 8890 Handle<Map> receiver_map, |
8888 BailoutId ast_id) { | 8891 BailoutId ast_id) { |
8889 SmallMapList receiver_maps(1, zone()); | 8892 SmallMapList receiver_maps(1, zone()); |
8890 receiver_maps.Add(receiver_map, zone()); | 8893 receiver_maps.Add(receiver_map, zone()); |
8891 return TryInlineApiCall(function, | 8894 return TryInlineApiCall(function, |
8892 NULL, // Receiver is on expression stack. | 8895 NULL, // Receiver is on expression stack. |
8893 &receiver_maps, 1, ast_id, kCallApiSetter, | 8896 &receiver_maps, 1, ast_id, kCallApiSetter, |
8894 TailCallMode::kDisallow); | 8897 TailCallMode::kDisallow); |
8895 } | 8898 } |
8896 | 8899 |
8897 bool HOptimizedGraphBuilder::TryInlineApiCall( | 8900 bool HOptimizedGraphBuilder::TryInlineApiCall( |
8898 Handle<Object> function, HValue* receiver, SmallMapList* receiver_maps, | 8901 Handle<Object> function, HValue* receiver, SmallMapList* receiver_maps, |
8899 int argc, BailoutId ast_id, ApiCallType call_type, | 8902 int argc, BailoutId ast_id, ApiCallType call_type, |
8900 TailCallMode syntactic_tail_call_mode) { | 8903 TailCallMode syntactic_tail_call_mode) { |
| 8904 if (FLAG_runtime_call_stats) return false; |
8901 if (function->IsJSFunction() && | 8905 if (function->IsJSFunction() && |
8902 Handle<JSFunction>::cast(function)->context()->native_context() != | 8906 Handle<JSFunction>::cast(function)->context()->native_context() != |
8903 top_info()->closure()->context()->native_context()) { | 8907 top_info()->closure()->context()->native_context()) { |
8904 return false; | 8908 return false; |
8905 } | 8909 } |
8906 if (argc > CallApiCallbackStub::kArgMax) { | 8910 if (argc > CallApiCallbackStub::kArgMax) { |
8907 return false; | 8911 return false; |
8908 } | 8912 } |
8909 | 8913 |
8910 CallOptimization optimization(function); | 8914 CallOptimization optimization(function); |
(...skipping 4080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12991 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12995 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12992 } | 12996 } |
12993 | 12997 |
12994 #ifdef DEBUG | 12998 #ifdef DEBUG |
12995 graph_->Verify(false); // No full verify. | 12999 graph_->Verify(false); // No full verify. |
12996 #endif | 13000 #endif |
12997 } | 13001 } |
12998 | 13002 |
12999 } // namespace internal | 13003 } // namespace internal |
13000 } // namespace v8 | 13004 } // namespace v8 |
OLD | NEW |