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 <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/allocation-site-scopes.h" | 9 #include "src/allocation-site-scopes.h" |
10 #include "src/ast/ast-numbering.h" | 10 #include "src/ast/ast-numbering.h" |
(...skipping 4646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4657 // Create an arguments object containing the initial parameters. Set the | 4657 // Create an arguments object containing the initial parameters. Set the |
4658 // initial values of parameters including "this" having parameter index 0. | 4658 // initial values of parameters including "this" having parameter index 0. |
4659 DCHECK_EQ(scope->num_parameters() + 1, parameter_count); | 4659 DCHECK_EQ(scope->num_parameters() + 1, parameter_count); |
4660 HArgumentsObject* arguments_object = New<HArgumentsObject>(parameter_count); | 4660 HArgumentsObject* arguments_object = New<HArgumentsObject>(parameter_count); |
4661 for (int i = 0; i < parameter_count; ++i) { | 4661 for (int i = 0; i < parameter_count; ++i) { |
4662 HValue* parameter = parameters.at(i); | 4662 HValue* parameter = parameters.at(i); |
4663 arguments_object->AddArgument(parameter, zone()); | 4663 arguments_object->AddArgument(parameter, zone()); |
4664 } | 4664 } |
4665 | 4665 |
4666 AddInstruction(arguments_object); | 4666 AddInstruction(arguments_object); |
4667 graph()->SetArgumentsObject(arguments_object); | |
4668 | 4667 |
4669 // Handle the arguments and arguments shadow variables specially (they do | 4668 // Handle the arguments and arguments shadow variables specially (they do |
4670 // not have declarations). | 4669 // not have declarations). |
4671 if (scope->arguments() != NULL) { | 4670 if (scope->arguments() != NULL) { |
4672 environment()->Bind(scope->arguments(), graph()->GetArgumentsObject()); | 4671 environment()->Bind(scope->arguments(), arguments_object); |
4673 } | 4672 } |
4674 | 4673 |
4675 int rest_index; | 4674 int rest_index; |
4676 Variable* rest = scope->rest_parameter(&rest_index); | 4675 Variable* rest = scope->rest_parameter(&rest_index); |
4677 if (rest) { | 4676 if (rest) { |
4678 return Bailout(kRestParameter); | 4677 return Bailout(kRestParameter); |
4679 } | 4678 } |
4680 | 4679 |
4681 if (scope->this_function_var() != nullptr || | 4680 if (scope->this_function_var() != nullptr || |
4682 scope->new_target_var() != nullptr) { | 4681 scope->new_target_var() != nullptr) { |
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7849 if (function_state()->outer() == NULL) { | 7848 if (function_state()->outer() == NULL) { |
7850 HInstruction* elements = Add<HArgumentsElements>(false); | 7849 HInstruction* elements = Add<HArgumentsElements>(false); |
7851 result = New<HArgumentsLength>(elements); | 7850 result = New<HArgumentsLength>(elements); |
7852 } else { | 7851 } else { |
7853 // Number of arguments without receiver. | 7852 // Number of arguments without receiver. |
7854 int argument_count = environment()-> | 7853 int argument_count = environment()-> |
7855 arguments_environment()->parameter_count() - 1; | 7854 arguments_environment()->parameter_count() - 1; |
7856 result = New<HConstant>(argument_count); | 7855 result = New<HConstant>(argument_count); |
7857 } | 7856 } |
7858 } else { | 7857 } else { |
7859 Push(graph()->GetArgumentsObject()); | 7858 CHECK_ALIVE_OR_RETURN(VisitForValue(expr->obj(), ARGUMENTS_ALLOWED), true); |
7860 CHECK_ALIVE_OR_RETURN(VisitForValue(expr->key()), true); | 7859 CHECK_ALIVE_OR_RETURN(VisitForValue(expr->key()), true); |
7861 HValue* key = Pop(); | 7860 HValue* key = Pop(); |
7862 Drop(1); // Arguments object. | 7861 Drop(1); // Arguments object. |
7863 if (function_state()->outer() == NULL) { | 7862 if (function_state()->outer() == NULL) { |
7864 HInstruction* elements = Add<HArgumentsElements>(false); | 7863 HInstruction* elements = Add<HArgumentsElements>(false); |
7865 HInstruction* length = Add<HArgumentsLength>(elements); | 7864 HInstruction* length = Add<HArgumentsLength>(elements); |
7866 HInstruction* checked_key = Add<HBoundsCheck>(key, length); | 7865 HInstruction* checked_key = Add<HBoundsCheck>(key, length); |
7867 result = New<HAccessArgumentsAt>(elements, length, checked_key); | 7866 result = New<HAccessArgumentsAt>(elements, length, checked_key); |
7868 } else { | 7867 } else { |
7869 EnsureArgumentsArePushedForAccess(); | 7868 EnsureArgumentsArePushedForAccess(); |
(...skipping 5744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13614 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13613 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13615 } | 13614 } |
13616 | 13615 |
13617 #ifdef DEBUG | 13616 #ifdef DEBUG |
13618 graph_->Verify(false); // No full verify. | 13617 graph_->Verify(false); // No full verify. |
13619 #endif | 13618 #endif |
13620 } | 13619 } |
13621 | 13620 |
13622 } // namespace internal | 13621 } // namespace internal |
13623 } // namespace v8 | 13622 } // namespace v8 |
OLD | NEW |