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 6756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6767 case Variable::CONTEXT: { | 6767 case Variable::CONTEXT: { |
6768 // Bail out if we try to mutate a parameter value in a function | 6768 // Bail out if we try to mutate a parameter value in a function |
6769 // using the arguments object. We do not (yet) correctly handle the | 6769 // using the arguments object. We do not (yet) correctly handle the |
6770 // arguments property of the function. | 6770 // arguments property of the function. |
6771 if (current_info()->scope()->arguments() != NULL) { | 6771 if (current_info()->scope()->arguments() != NULL) { |
6772 // Parameters will be allocated to context slots. We have no | 6772 // Parameters will be allocated to context slots. We have no |
6773 // direct way to detect that the variable is a parameter so we do | 6773 // direct way to detect that the variable is a parameter so we do |
6774 // a linear search of the parameter variables. | 6774 // a linear search of the parameter variables. |
6775 int count = current_info()->scope()->num_parameters(); | 6775 int count = current_info()->scope()->num_parameters(); |
6776 for (int i = 0; i < count; ++i) { | 6776 for (int i = 0; i < count; ++i) { |
6777 if (var == current_info()->scope()->parameter(i)) { | 6777 if (var == current_info()->scope()->parameter_var(i)) { |
6778 Bailout(kAssignmentToParameterFunctionUsesArgumentsObject); | 6778 Bailout(kAssignmentToParameterFunctionUsesArgumentsObject); |
6779 } | 6779 } |
6780 } | 6780 } |
6781 } | 6781 } |
6782 | 6782 |
6783 HStoreContextSlot::Mode mode; | 6783 HStoreContextSlot::Mode mode; |
6784 | 6784 |
6785 switch (var->mode()) { | 6785 switch (var->mode()) { |
6786 case LET: | 6786 case LET: |
6787 mode = HStoreContextSlot::kCheckDeoptimize; | 6787 mode = HStoreContextSlot::kCheckDeoptimize; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6901 | 6901 |
6902 case Variable::CONTEXT: { | 6902 case Variable::CONTEXT: { |
6903 // Bail out if we try to mutate a parameter value in a function using | 6903 // Bail out if we try to mutate a parameter value in a function using |
6904 // the arguments object. We do not (yet) correctly handle the | 6904 // the arguments object. We do not (yet) correctly handle the |
6905 // arguments property of the function. | 6905 // arguments property of the function. |
6906 if (current_info()->scope()->arguments() != NULL) { | 6906 if (current_info()->scope()->arguments() != NULL) { |
6907 // Parameters will rewrite to context slots. We have no direct way | 6907 // Parameters will rewrite to context slots. We have no direct way |
6908 // to detect that the variable is a parameter. | 6908 // to detect that the variable is a parameter. |
6909 int count = current_info()->scope()->num_parameters(); | 6909 int count = current_info()->scope()->num_parameters(); |
6910 for (int i = 0; i < count; ++i) { | 6910 for (int i = 0; i < count; ++i) { |
6911 if (var == current_info()->scope()->parameter(i)) { | 6911 if (var == current_info()->scope()->parameter_var(i)) { |
6912 return Bailout(kAssignmentToParameterInArgumentsObject); | 6912 return Bailout(kAssignmentToParameterInArgumentsObject); |
6913 } | 6913 } |
6914 } | 6914 } |
6915 } | 6915 } |
6916 | 6916 |
6917 CHECK_ALIVE(VisitForValue(expr->value())); | 6917 CHECK_ALIVE(VisitForValue(expr->value())); |
6918 HStoreContextSlot::Mode mode; | 6918 HStoreContextSlot::Mode mode; |
6919 if (expr->op() == Token::ASSIGN) { | 6919 if (expr->op() == Token::ASSIGN) { |
6920 switch (var->mode()) { | 6920 switch (var->mode()) { |
6921 case LET: | 6921 case LET: |
(...skipping 3473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10395 case Variable::CONTEXT: { | 10395 case Variable::CONTEXT: { |
10396 // Bail out if we try to mutate a parameter value in a function | 10396 // Bail out if we try to mutate a parameter value in a function |
10397 // using the arguments object. We do not (yet) correctly handle the | 10397 // using the arguments object. We do not (yet) correctly handle the |
10398 // arguments property of the function. | 10398 // arguments property of the function. |
10399 if (current_info()->scope()->arguments() != NULL) { | 10399 if (current_info()->scope()->arguments() != NULL) { |
10400 // Parameters will rewrite to context slots. We have no direct | 10400 // Parameters will rewrite to context slots. We have no direct |
10401 // way to detect that the variable is a parameter so we use a | 10401 // way to detect that the variable is a parameter so we use a |
10402 // linear search of the parameter list. | 10402 // linear search of the parameter list. |
10403 int count = current_info()->scope()->num_parameters(); | 10403 int count = current_info()->scope()->num_parameters(); |
10404 for (int i = 0; i < count; ++i) { | 10404 for (int i = 0; i < count; ++i) { |
10405 if (var == current_info()->scope()->parameter(i)) { | 10405 if (var == current_info()->scope()->parameter_var(i)) { |
10406 return Bailout(kAssignmentToParameterInArgumentsObject); | 10406 return Bailout(kAssignmentToParameterInArgumentsObject); |
10407 } | 10407 } |
10408 } | 10408 } |
10409 } | 10409 } |
10410 | 10410 |
10411 HValue* context = BuildContextChainWalk(var); | 10411 HValue* context = BuildContextChainWalk(var); |
10412 HStoreContextSlot::Mode mode = IsLexicalVariableMode(var->mode()) | 10412 HStoreContextSlot::Mode mode = IsLexicalVariableMode(var->mode()) |
10413 ? HStoreContextSlot::kCheckDeoptimize : HStoreContextSlot::kNoCheck; | 10413 ? HStoreContextSlot::kCheckDeoptimize : HStoreContextSlot::kNoCheck; |
10414 HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(), | 10414 HStoreContextSlot* instr = Add<HStoreContextSlot>(context, var->index(), |
10415 mode, after); | 10415 mode, after); |
(...skipping 2773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13189 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 13189 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
13190 } | 13190 } |
13191 | 13191 |
13192 #ifdef DEBUG | 13192 #ifdef DEBUG |
13193 graph_->Verify(false); // No full verify. | 13193 graph_->Verify(false); // No full verify. |
13194 #endif | 13194 #endif |
13195 } | 13195 } |
13196 | 13196 |
13197 } // namespace internal | 13197 } // namespace internal |
13198 } // namespace v8 | 13198 } // namespace v8 |
OLD | NEW |