| 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/v8.h" | 9 #include "src/v8.h" |
| 10 | 10 |
| (...skipping 3472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3483 is_recursive_(false), | 3483 is_recursive_(false), |
| 3484 use_optimistic_licm_(false), | 3484 use_optimistic_licm_(false), |
| 3485 depends_on_empty_array_proto_elements_(false), | 3485 depends_on_empty_array_proto_elements_(false), |
| 3486 type_change_checksum_(0), | 3486 type_change_checksum_(0), |
| 3487 maximum_environment_size_(0), | 3487 maximum_environment_size_(0), |
| 3488 no_side_effects_scope_count_(0), | 3488 no_side_effects_scope_count_(0), |
| 3489 disallow_adding_new_values_(false) { | 3489 disallow_adding_new_values_(false) { |
| 3490 if (info->IsStub()) { | 3490 if (info->IsStub()) { |
| 3491 CallInterfaceDescriptor descriptor = | 3491 CallInterfaceDescriptor descriptor = |
| 3492 info->code_stub()->GetCallInterfaceDescriptor(); | 3492 info->code_stub()->GetCallInterfaceDescriptor(); |
| 3493 start_environment_ = new (zone_) | 3493 start_environment_ = |
| 3494 HEnvironment(zone_, descriptor.GetEnvironmentParameterCount()); | 3494 new (zone_) HEnvironment(zone_, descriptor.GetRegisterParameterCount()); |
| 3495 } else { | 3495 } else { |
| 3496 if (info->is_tracking_positions()) { | 3496 if (info->is_tracking_positions()) { |
| 3497 info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(), | 3497 info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(), |
| 3498 InlinedFunctionInfo::kNoParentId); | 3498 InlinedFunctionInfo::kNoParentId); |
| 3499 } | 3499 } |
| 3500 start_environment_ = | 3500 start_environment_ = |
| 3501 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); | 3501 new(zone_) HEnvironment(NULL, info->scope(), info->closure(), zone_); |
| 3502 } | 3502 } |
| 3503 start_environment_->set_ast_id(BailoutId::FunctionEntry()); | 3503 start_environment_->set_ast_id(BailoutId::FunctionEntry()); |
| 3504 entry_block_ = CreateBasicBlock(); | 3504 entry_block_ = CreateBasicBlock(); |
| (...skipping 4180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7685 int argument_count, HValue* expected_param_count) { | 7685 int argument_count, HValue* expected_param_count) { |
| 7686 ArgumentAdaptorDescriptor descriptor(isolate()); | 7686 ArgumentAdaptorDescriptor descriptor(isolate()); |
| 7687 HValue* arity = Add<HConstant>(argument_count - 1); | 7687 HValue* arity = Add<HConstant>(argument_count - 1); |
| 7688 | 7688 |
| 7689 HValue* op_vals[] = { context, fun, arity, expected_param_count }; | 7689 HValue* op_vals[] = { context, fun, arity, expected_param_count }; |
| 7690 | 7690 |
| 7691 Handle<Code> adaptor = | 7691 Handle<Code> adaptor = |
| 7692 isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 7692 isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 7693 HConstant* adaptor_value = Add<HConstant>(adaptor); | 7693 HConstant* adaptor_value = Add<HConstant>(adaptor); |
| 7694 | 7694 |
| 7695 return New<HCallWithDescriptor>( | 7695 return New<HCallWithDescriptor>(adaptor_value, argument_count, descriptor, |
| 7696 adaptor_value, argument_count, descriptor, | 7696 Vector<HValue*>(op_vals, arraysize(op_vals))); |
| 7697 Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength())); | |
| 7698 } | 7697 } |
| 7699 | 7698 |
| 7700 | 7699 |
| 7701 HInstruction* HOptimizedGraphBuilder::BuildCallConstantFunction( | 7700 HInstruction* HOptimizedGraphBuilder::BuildCallConstantFunction( |
| 7702 Handle<JSFunction> jsfun, int argument_count) { | 7701 Handle<JSFunction> jsfun, int argument_count) { |
| 7703 HValue* target = Add<HConstant>(jsfun); | 7702 HValue* target = Add<HConstant>(jsfun); |
| 7704 // For constant functions, we try to avoid calling the | 7703 // For constant functions, we try to avoid calling the |
| 7705 // argument adaptor and instead call the function directly | 7704 // argument adaptor and instead call the function directly |
| 7706 int formal_parameter_count = | 7705 int formal_parameter_count = |
| 7707 jsfun->shared()->internal_formal_parameter_count(); | 7706 jsfun->shared()->internal_formal_parameter_count(); |
| (...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8943 | 8942 |
| 8944 HValue* op_vals[] = {context(), Add<HConstant>(function), call_data, holder, | 8943 HValue* op_vals[] = {context(), Add<HConstant>(function), call_data, holder, |
| 8945 api_function_address, nullptr}; | 8944 api_function_address, nullptr}; |
| 8946 | 8945 |
| 8947 HInstruction* call = nullptr; | 8946 HInstruction* call = nullptr; |
| 8948 if (!is_function) { | 8947 if (!is_function) { |
| 8949 CallApiAccessorStub stub(isolate(), is_store, call_data_undefined); | 8948 CallApiAccessorStub stub(isolate(), is_store, call_data_undefined); |
| 8950 Handle<Code> code = stub.GetCode(); | 8949 Handle<Code> code = stub.GetCode(); |
| 8951 HConstant* code_value = Add<HConstant>(code); | 8950 HConstant* code_value = Add<HConstant>(code); |
| 8952 ApiAccessorDescriptor descriptor(isolate()); | 8951 ApiAccessorDescriptor descriptor(isolate()); |
| 8953 DCHECK(arraysize(op_vals) - 1 == descriptor.GetEnvironmentLength()); | |
| 8954 call = New<HCallWithDescriptor>( | 8952 call = New<HCallWithDescriptor>( |
| 8955 code_value, argc + 1, descriptor, | 8953 code_value, argc + 1, descriptor, |
| 8956 Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength())); | 8954 Vector<HValue*>(op_vals, arraysize(op_vals) - 1)); |
| 8957 } else if (argc <= CallApiFunctionWithFixedArgsStub::kMaxFixedArgs) { | 8955 } else if (argc <= CallApiFunctionWithFixedArgsStub::kMaxFixedArgs) { |
| 8958 CallApiFunctionWithFixedArgsStub stub(isolate(), argc, call_data_undefined); | 8956 CallApiFunctionWithFixedArgsStub stub(isolate(), argc, call_data_undefined); |
| 8959 Handle<Code> code = stub.GetCode(); | 8957 Handle<Code> code = stub.GetCode(); |
| 8960 HConstant* code_value = Add<HConstant>(code); | 8958 HConstant* code_value = Add<HConstant>(code); |
| 8961 ApiFunctionWithFixedArgsDescriptor descriptor(isolate()); | 8959 ApiFunctionWithFixedArgsDescriptor descriptor(isolate()); |
| 8962 DCHECK(arraysize(op_vals) - 1 == descriptor.GetEnvironmentLength()); | |
| 8963 call = New<HCallWithDescriptor>( | 8960 call = New<HCallWithDescriptor>( |
| 8964 code_value, argc + 1, descriptor, | 8961 code_value, argc + 1, descriptor, |
| 8965 Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength())); | 8962 Vector<HValue*>(op_vals, arraysize(op_vals) - 1)); |
| 8966 Drop(1); // Drop function. | 8963 Drop(1); // Drop function. |
| 8967 } else { | 8964 } else { |
| 8968 op_vals[arraysize(op_vals) - 1] = Add<HConstant>(argc); | 8965 op_vals[arraysize(op_vals) - 1] = Add<HConstant>(argc); |
| 8969 CallApiFunctionStub stub(isolate(), call_data_undefined); | 8966 CallApiFunctionStub stub(isolate(), call_data_undefined); |
| 8970 Handle<Code> code = stub.GetCode(); | 8967 Handle<Code> code = stub.GetCode(); |
| 8971 HConstant* code_value = Add<HConstant>(code); | 8968 HConstant* code_value = Add<HConstant>(code); |
| 8972 ApiFunctionDescriptor descriptor(isolate()); | 8969 ApiFunctionDescriptor descriptor(isolate()); |
| 8973 DCHECK(arraysize(op_vals) == descriptor.GetEnvironmentLength()); | 8970 call = |
| 8974 call = New<HCallWithDescriptor>( | 8971 New<HCallWithDescriptor>(code_value, argc + 1, descriptor, |
| 8975 code_value, argc + 1, descriptor, | 8972 Vector<HValue*>(op_vals, arraysize(op_vals))); |
| 8976 Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength())); | |
| 8977 Drop(1); // Drop function. | 8973 Drop(1); // Drop function. |
| 8978 } | 8974 } |
| 8979 | 8975 |
| 8980 ast_context()->ReturnInstruction(call, ast_id); | 8976 ast_context()->ReturnInstruction(call, ast_id); |
| 8981 return true; | 8977 return true; |
| 8982 } | 8978 } |
| 8983 | 8979 |
| 8984 | 8980 |
| 8985 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function, | 8981 void HOptimizedGraphBuilder::HandleIndirectCall(Call* expr, HValue* function, |
| 8986 int arguments_count) { | 8982 int arguments_count) { |
| (...skipping 4222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13209 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13205 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 13210 } | 13206 } |
| 13211 | 13207 |
| 13212 #ifdef DEBUG | 13208 #ifdef DEBUG |
| 13213 graph_->Verify(false); // No full verify. | 13209 graph_->Verify(false); // No full verify. |
| 13214 #endif | 13210 #endif |
| 13215 } | 13211 } |
| 13216 | 13212 |
| 13217 } // namespace internal | 13213 } // namespace internal |
| 13218 } // namespace v8 | 13214 } // namespace v8 |
| OLD | NEW |