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 6629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6640 HandleGlobalVariableAssignment(var, | 6640 HandleGlobalVariableAssignment(var, |
6641 Top(), | 6641 Top(), |
6642 expr->AssignmentId()); | 6642 expr->AssignmentId()); |
6643 break; | 6643 break; |
6644 | 6644 |
6645 case Variable::PARAMETER: | 6645 case Variable::PARAMETER: |
6646 case Variable::LOCAL: | 6646 case Variable::LOCAL: |
6647 if (var->mode() == CONST_LEGACY) { | 6647 if (var->mode() == CONST_LEGACY) { |
6648 return Bailout(kUnsupportedConstCompoundAssignment); | 6648 return Bailout(kUnsupportedConstCompoundAssignment); |
6649 } | 6649 } |
| 6650 if (var->mode() == CONST) { |
| 6651 return Bailout(kNonInitializerAssignmentToConst); |
| 6652 } |
6650 BindIfLive(var, Top()); | 6653 BindIfLive(var, Top()); |
6651 break; | 6654 break; |
6652 | 6655 |
6653 case Variable::CONTEXT: { | 6656 case Variable::CONTEXT: { |
6654 // Bail out if we try to mutate a parameter value in a function | 6657 // Bail out if we try to mutate a parameter value in a function |
6655 // using the arguments object. We do not (yet) correctly handle the | 6658 // using the arguments object. We do not (yet) correctly handle the |
6656 // arguments property of the function. | 6659 // arguments property of the function. |
6657 if (current_info()->scope()->arguments() != NULL) { | 6660 if (current_info()->scope()->arguments() != NULL) { |
6658 // Parameters will be allocated to context slots. We have no | 6661 // Parameters will be allocated to context slots. We have no |
6659 // direct way to detect that the variable is a parameter so we do | 6662 // direct way to detect that the variable is a parameter so we do |
6660 // a linear search of the parameter variables. | 6663 // a linear search of the parameter variables. |
6661 int count = current_info()->scope()->num_parameters(); | 6664 int count = current_info()->scope()->num_parameters(); |
6662 for (int i = 0; i < count; ++i) { | 6665 for (int i = 0; i < count; ++i) { |
6663 if (var == current_info()->scope()->parameter(i)) { | 6666 if (var == current_info()->scope()->parameter(i)) { |
6664 Bailout(kAssignmentToParameterFunctionUsesArgumentsObject); | 6667 Bailout(kAssignmentToParameterFunctionUsesArgumentsObject); |
6665 } | 6668 } |
6666 } | 6669 } |
6667 } | 6670 } |
6668 | 6671 |
6669 HStoreContextSlot::Mode mode; | 6672 HStoreContextSlot::Mode mode; |
6670 | 6673 |
6671 switch (var->mode()) { | 6674 switch (var->mode()) { |
6672 case LET: | 6675 case LET: |
6673 mode = HStoreContextSlot::kCheckDeoptimize; | 6676 mode = HStoreContextSlot::kCheckDeoptimize; |
6674 break; | 6677 break; |
6675 case CONST: | 6678 case CONST: |
6676 // This case is checked statically so no need to | 6679 return Bailout(kNonInitializerAssignmentToConst); |
6677 // perform checks here | |
6678 UNREACHABLE(); | |
6679 case CONST_LEGACY: | 6680 case CONST_LEGACY: |
6680 return ast_context()->ReturnValue(Pop()); | 6681 return ast_context()->ReturnValue(Pop()); |
6681 default: | 6682 default: |
6682 mode = HStoreContextSlot::kNoCheck; | 6683 mode = HStoreContextSlot::kNoCheck; |
6683 } | 6684 } |
6684 | 6685 |
6685 HValue* context = BuildContextChainWalk(var); | 6686 HValue* context = BuildContextChainWalk(var); |
6686 HStoreContextSlot* instr = Add<HStoreContextSlot>( | 6687 HStoreContextSlot* instr = Add<HStoreContextSlot>( |
6687 context, var->index(), mode, Top()); | 6688 context, var->index(), mode, Top()); |
6688 if (instr->HasObservableSideEffects()) { | 6689 if (instr->HasObservableSideEffects()) { |
(...skipping 3519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10208 bool returns_original_input = | 10209 bool returns_original_input = |
10209 expr->is_postfix() && !ast_context()->IsEffect(); | 10210 expr->is_postfix() && !ast_context()->IsEffect(); |
10210 HValue* input = NULL; // ToNumber(original_input). | 10211 HValue* input = NULL; // ToNumber(original_input). |
10211 HValue* after = NULL; // The result after incrementing or decrementing. | 10212 HValue* after = NULL; // The result after incrementing or decrementing. |
10212 | 10213 |
10213 if (proxy != NULL) { | 10214 if (proxy != NULL) { |
10214 Variable* var = proxy->var(); | 10215 Variable* var = proxy->var(); |
10215 if (var->mode() == CONST_LEGACY) { | 10216 if (var->mode() == CONST_LEGACY) { |
10216 return Bailout(kUnsupportedCountOperationWithConst); | 10217 return Bailout(kUnsupportedCountOperationWithConst); |
10217 } | 10218 } |
| 10219 if (var->mode() == CONST) { |
| 10220 return Bailout(kNonInitializerAssignmentToConst); |
| 10221 } |
10218 // Argument of the count operation is a variable, not a property. | 10222 // Argument of the count operation is a variable, not a property. |
10219 DCHECK(prop == NULL); | 10223 DCHECK(prop == NULL); |
10220 CHECK_ALIVE(VisitForValue(target)); | 10224 CHECK_ALIVE(VisitForValue(target)); |
10221 | 10225 |
10222 after = BuildIncrement(returns_original_input, expr); | 10226 after = BuildIncrement(returns_original_input, expr); |
10223 input = returns_original_input ? Top() : Pop(); | 10227 input = returns_original_input ? Top() : Pop(); |
10224 Push(after); | 10228 Push(after); |
10225 | 10229 |
10226 switch (var->location()) { | 10230 switch (var->location()) { |
10227 case Variable::UNALLOCATED: | 10231 case Variable::UNALLOCATED: |
(...skipping 2548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12776 if (ShouldProduceTraceOutput()) { | 12780 if (ShouldProduceTraceOutput()) { |
12777 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 12781 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
12778 } | 12782 } |
12779 | 12783 |
12780 #ifdef DEBUG | 12784 #ifdef DEBUG |
12781 graph_->Verify(false); // No full verify. | 12785 graph_->Verify(false); // No full verify. |
12782 #endif | 12786 #endif |
12783 } | 12787 } |
12784 | 12788 |
12785 } } // namespace v8::internal | 12789 } } // namespace v8::internal |
OLD | NEW |