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 8875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8886 default: | 8886 default: |
8887 // Not yet supported for inlining. | 8887 // Not yet supported for inlining. |
8888 break; | 8888 break; |
8889 } | 8889 } |
8890 return false; | 8890 return false; |
8891 } | 8891 } |
8892 | 8892 |
8893 | 8893 |
8894 bool HOptimizedGraphBuilder::TryInlineApiFunctionCall(Call* expr, | 8894 bool HOptimizedGraphBuilder::TryInlineApiFunctionCall(Call* expr, |
8895 HValue* receiver) { | 8895 HValue* receiver) { |
8896 if (FLAG_runtime_call_stats) return false; | 8896 if (V8_UNLIKELY(FLAG_runtime_stats)) return false; |
8897 Handle<JSFunction> function = expr->target(); | 8897 Handle<JSFunction> function = expr->target(); |
8898 int argc = expr->arguments()->length(); | 8898 int argc = expr->arguments()->length(); |
8899 SmallMapList receiver_maps; | 8899 SmallMapList receiver_maps; |
8900 return TryInlineApiCall(function, receiver, &receiver_maps, argc, expr->id(), | 8900 return TryInlineApiCall(function, receiver, &receiver_maps, argc, expr->id(), |
8901 kCallApiFunction, expr->tail_call_mode()); | 8901 kCallApiFunction, expr->tail_call_mode()); |
8902 } | 8902 } |
8903 | 8903 |
8904 | 8904 |
8905 bool HOptimizedGraphBuilder::TryInlineApiMethodCall( | 8905 bool HOptimizedGraphBuilder::TryInlineApiMethodCall( |
8906 Call* expr, | 8906 Call* expr, |
8907 HValue* receiver, | 8907 HValue* receiver, |
8908 SmallMapList* receiver_maps) { | 8908 SmallMapList* receiver_maps) { |
8909 if (FLAG_runtime_call_stats) return false; | 8909 if (V8_UNLIKELY(FLAG_runtime_stats)) return false; |
8910 Handle<JSFunction> function = expr->target(); | 8910 Handle<JSFunction> function = expr->target(); |
8911 int argc = expr->arguments()->length(); | 8911 int argc = expr->arguments()->length(); |
8912 return TryInlineApiCall(function, receiver, receiver_maps, argc, expr->id(), | 8912 return TryInlineApiCall(function, receiver, receiver_maps, argc, expr->id(), |
8913 kCallApiMethod, expr->tail_call_mode()); | 8913 kCallApiMethod, expr->tail_call_mode()); |
8914 } | 8914 } |
8915 | 8915 |
8916 bool HOptimizedGraphBuilder::TryInlineApiGetter(Handle<Object> function, | 8916 bool HOptimizedGraphBuilder::TryInlineApiGetter(Handle<Object> function, |
8917 Handle<Map> receiver_map, | 8917 Handle<Map> receiver_map, |
8918 BailoutId ast_id) { | 8918 BailoutId ast_id) { |
8919 if (FLAG_runtime_call_stats) return false; | 8919 if (V8_UNLIKELY(FLAG_runtime_stats)) return false; |
8920 SmallMapList receiver_maps(1, zone()); | 8920 SmallMapList receiver_maps(1, zone()); |
8921 receiver_maps.Add(receiver_map, zone()); | 8921 receiver_maps.Add(receiver_map, zone()); |
8922 return TryInlineApiCall(function, | 8922 return TryInlineApiCall(function, |
8923 NULL, // Receiver is on expression stack. | 8923 NULL, // Receiver is on expression stack. |
8924 &receiver_maps, 0, ast_id, kCallApiGetter, | 8924 &receiver_maps, 0, ast_id, kCallApiGetter, |
8925 TailCallMode::kDisallow); | 8925 TailCallMode::kDisallow); |
8926 } | 8926 } |
8927 | 8927 |
8928 bool HOptimizedGraphBuilder::TryInlineApiSetter(Handle<Object> function, | 8928 bool HOptimizedGraphBuilder::TryInlineApiSetter(Handle<Object> function, |
8929 Handle<Map> receiver_map, | 8929 Handle<Map> receiver_map, |
8930 BailoutId ast_id) { | 8930 BailoutId ast_id) { |
8931 SmallMapList receiver_maps(1, zone()); | 8931 SmallMapList receiver_maps(1, zone()); |
8932 receiver_maps.Add(receiver_map, zone()); | 8932 receiver_maps.Add(receiver_map, zone()); |
8933 return TryInlineApiCall(function, | 8933 return TryInlineApiCall(function, |
8934 NULL, // Receiver is on expression stack. | 8934 NULL, // Receiver is on expression stack. |
8935 &receiver_maps, 1, ast_id, kCallApiSetter, | 8935 &receiver_maps, 1, ast_id, kCallApiSetter, |
8936 TailCallMode::kDisallow); | 8936 TailCallMode::kDisallow); |
8937 } | 8937 } |
8938 | 8938 |
8939 bool HOptimizedGraphBuilder::TryInlineApiCall( | 8939 bool HOptimizedGraphBuilder::TryInlineApiCall( |
8940 Handle<Object> function, HValue* receiver, SmallMapList* receiver_maps, | 8940 Handle<Object> function, HValue* receiver, SmallMapList* receiver_maps, |
8941 int argc, BailoutId ast_id, ApiCallType call_type, | 8941 int argc, BailoutId ast_id, ApiCallType call_type, |
8942 TailCallMode syntactic_tail_call_mode) { | 8942 TailCallMode syntactic_tail_call_mode) { |
8943 if (FLAG_runtime_call_stats) return false; | 8943 if (V8_UNLIKELY(FLAG_runtime_stats)) return false; |
8944 if (function->IsJSFunction() && | 8944 if (function->IsJSFunction() && |
8945 Handle<JSFunction>::cast(function)->context()->native_context() != | 8945 Handle<JSFunction>::cast(function)->context()->native_context() != |
8946 top_info()->closure()->context()->native_context()) { | 8946 top_info()->closure()->context()->native_context()) { |
8947 return false; | 8947 return false; |
8948 } | 8948 } |
8949 if (argc > CallApiCallbackStub::kArgMax) { | 8949 if (argc > CallApiCallbackStub::kArgMax) { |
8950 return false; | 8950 return false; |
8951 } | 8951 } |
8952 | 8952 |
8953 CallOptimization optimization(function); | 8953 CallOptimization optimization(function); |
(...skipping 4079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13033 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13033 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13034 } | 13034 } |
13035 | 13035 |
13036 #ifdef DEBUG | 13036 #ifdef DEBUG |
13037 graph_->Verify(false); // No full verify. | 13037 graph_->Verify(false); // No full verify. |
13038 #endif | 13038 #endif |
13039 } | 13039 } |
13040 | 13040 |
13041 } // namespace internal | 13041 } // namespace internal |
13042 } // namespace v8 | 13042 } // namespace v8 |
OLD | NEW |