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/hydrogen.h" | 5 #include "src/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-numbering.h" | 10 #include "src/ast-numbering.h" |
(...skipping 7883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7894 | 7894 |
7895 void HOptimizedGraphBuilder::AddCheckPrototypeMaps(Handle<JSObject> holder, | 7895 void HOptimizedGraphBuilder::AddCheckPrototypeMaps(Handle<JSObject> holder, |
7896 Handle<Map> receiver_map) { | 7896 Handle<Map> receiver_map) { |
7897 if (!holder.is_null()) { | 7897 if (!holder.is_null()) { |
7898 Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype())); | 7898 Handle<JSObject> prototype(JSObject::cast(receiver_map->prototype())); |
7899 BuildCheckPrototypeMaps(prototype, holder); | 7899 BuildCheckPrototypeMaps(prototype, holder); |
7900 } | 7900 } |
7901 } | 7901 } |
7902 | 7902 |
7903 | 7903 |
7904 HInstruction* HOptimizedGraphBuilder::NewPlainFunctionCall( | 7904 HInstruction* HOptimizedGraphBuilder::NewPlainFunctionCall(HValue* fun, |
7905 HValue* fun, int argument_count, bool pass_argument_count) { | 7905 int argument_count) { |
7906 return New<HCallJSFunction>(fun, argument_count, pass_argument_count); | 7906 return New<HCallJSFunction>(fun, argument_count); |
7907 } | 7907 } |
7908 | 7908 |
7909 | 7909 |
7910 HInstruction* HOptimizedGraphBuilder::NewArgumentAdaptorCall( | 7910 HInstruction* HOptimizedGraphBuilder::NewArgumentAdaptorCall( |
7911 HValue* fun, HValue* context, | 7911 HValue* fun, HValue* context, |
7912 int argument_count, HValue* expected_param_count) { | 7912 int argument_count, HValue* expected_param_count) { |
7913 ArgumentAdaptorDescriptor descriptor(isolate()); | 7913 ArgumentAdaptorDescriptor descriptor(isolate()); |
7914 HValue* arity = Add<HConstant>(argument_count - 1); | 7914 HValue* arity = Add<HConstant>(argument_count - 1); |
7915 | 7915 |
7916 HValue* op_vals[] = { context, fun, arity, expected_param_count }; | 7916 HValue* op_vals[] = { context, fun, arity, expected_param_count }; |
(...skipping 17 matching lines...) Expand all Loading... |
7934 bool dont_adapt_arguments = | 7934 bool dont_adapt_arguments = |
7935 (formal_parameter_count == | 7935 (formal_parameter_count == |
7936 SharedFunctionInfo::kDontAdaptArgumentsSentinel); | 7936 SharedFunctionInfo::kDontAdaptArgumentsSentinel); |
7937 int arity = argument_count - 1; | 7937 int arity = argument_count - 1; |
7938 bool can_invoke_directly = | 7938 bool can_invoke_directly = |
7939 dont_adapt_arguments || formal_parameter_count == arity; | 7939 dont_adapt_arguments || formal_parameter_count == arity; |
7940 if (can_invoke_directly) { | 7940 if (can_invoke_directly) { |
7941 if (jsfun.is_identical_to(current_info()->closure())) { | 7941 if (jsfun.is_identical_to(current_info()->closure())) { |
7942 graph()->MarkRecursive(); | 7942 graph()->MarkRecursive(); |
7943 } | 7943 } |
7944 return NewPlainFunctionCall(target, argument_count, dont_adapt_arguments); | 7944 return NewPlainFunctionCall(target, argument_count); |
7945 } else { | 7945 } else { |
7946 HValue* param_count_value = Add<HConstant>(formal_parameter_count); | 7946 HValue* param_count_value = Add<HConstant>(formal_parameter_count); |
7947 HValue* context = Add<HLoadNamedField>( | 7947 HValue* context = Add<HLoadNamedField>( |
7948 target, nullptr, HObjectAccess::ForFunctionContextPointer()); | 7948 target, nullptr, HObjectAccess::ForFunctionContextPointer()); |
7949 return NewArgumentAdaptorCall(target, context, | 7949 return NewArgumentAdaptorCall(target, context, |
7950 argument_count, param_count_value); | 7950 argument_count, param_count_value); |
7951 } | 7951 } |
7952 UNREACHABLE(); | 7952 UNREACHABLE(); |
7953 return NULL; | 7953 return NULL; |
7954 } | 7954 } |
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8955 elements, new_length, hole, kind, INITIALIZING_STORE); | 8955 elements, new_length, hole, kind, INITIALIZING_STORE); |
8956 | 8956 |
8957 // Remember new length. | 8957 // Remember new length. |
8958 Add<HStoreNamedField>( | 8958 Add<HStoreNamedField>( |
8959 receiver, HObjectAccess::ForArrayLength(kind), | 8959 receiver, HObjectAccess::ForArrayLength(kind), |
8960 new_length, STORE_TO_INITIALIZED_ENTRY); | 8960 new_length, STORE_TO_INITIALIZED_ENTRY); |
8961 } | 8961 } |
8962 if_inline.Else(); | 8962 if_inline.Else(); |
8963 { | 8963 { |
8964 Add<HPushArguments>(receiver); | 8964 Add<HPushArguments>(receiver); |
8965 result = Add<HCallJSFunction>(function, 1, true); | 8965 result = Add<HCallJSFunction>(function, 1); |
8966 if (!ast_context()->IsEffect()) Push(result); | 8966 if (!ast_context()->IsEffect()) Push(result); |
8967 } | 8967 } |
8968 if_inline.End(); | 8968 if_inline.End(); |
8969 } | 8969 } |
8970 if_lengthiszero.End(); | 8970 if_lengthiszero.End(); |
8971 } | 8971 } |
8972 result = ast_context()->IsEffect() ? graph()->GetConstant0() : Top(); | 8972 result = ast_context()->IsEffect() ? graph()->GetConstant0() : Top(); |
8973 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); | 8973 Add<HSimulate>(expr->id(), REMOVABLE_SIMULATE); |
8974 if (!ast_context()->IsEffect()) Drop(1); | 8974 if (!ast_context()->IsEffect()) Drop(1); |
8975 ast_context()->ReturnValue(result); | 8975 ast_context()->ReturnValue(result); |
(...skipping 4485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13461 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13461 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13462 } | 13462 } |
13463 | 13463 |
13464 #ifdef DEBUG | 13464 #ifdef DEBUG |
13465 graph_->Verify(false); // No full verify. | 13465 graph_->Verify(false); // No full verify. |
13466 #endif | 13466 #endif |
13467 } | 13467 } |
13468 | 13468 |
13469 } // namespace internal | 13469 } // namespace internal |
13470 } // namespace v8 | 13470 } // namespace v8 |
OLD | NEW |