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