OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/bytecode-generator.h" | 5 #include "src/interpreter/bytecode-generator.h" |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "src/interpreter/control-flow-builders.h" | 10 #include "src/interpreter/control-flow-builders.h" |
(...skipping 2778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 SuperPropertyReference* super_property = | 2789 SuperPropertyReference* super_property = |
2790 property->obj()->AsSuperPropertyReference(); | 2790 property->obj()->AsSuperPropertyReference(); |
2791 VisitForRegisterValue(super_property->this_var(), object); | 2791 VisitForRegisterValue(super_property->this_var(), object); |
2792 VisitForRegisterValue(super_property->home_object(), home_object); | 2792 VisitForRegisterValue(super_property->home_object(), home_object); |
2793 VisitForRegisterValue(property->key(), key); | 2793 VisitForRegisterValue(property->key(), key); |
2794 BuildKeyedSuperPropertyLoad(object, home_object, key); | 2794 BuildKeyedSuperPropertyLoad(object, home_object, key); |
2795 break; | 2795 break; |
2796 } | 2796 } |
2797 } | 2797 } |
2798 | 2798 |
2799 // Convert old value into a number. | |
2800 builder()->CastAccumulatorToNumber(); | |
2801 | |
2802 // Save result for postfix expressions. | 2799 // Save result for postfix expressions. |
2803 if (is_postfix) { | 2800 if (is_postfix) { |
2804 old_value = register_allocator()->outer()->NewRegister(); | 2801 old_value = register_allocator()->outer()->NewRegister(); |
2805 builder()->StoreAccumulatorInRegister(old_value); | 2802 |
| 2803 // Convert old value into a number before saving it. |
| 2804 builder()->CastAccumulatorToNumber().StoreAccumulatorInRegister(old_value); |
2806 } | 2805 } |
2807 | 2806 |
2808 // Perform +1/-1 operation. | 2807 // Perform +1/-1 operation. |
2809 builder()->CountOperation(expr->binary_op()); | 2808 builder()->CountOperation(expr->binary_op()); |
2810 | 2809 |
2811 // Store the value. | 2810 // Store the value. |
2812 builder()->SetExpressionPosition(expr); | 2811 builder()->SetExpressionPosition(expr); |
2813 FeedbackVectorSlot feedback_slot = expr->CountSlot(); | 2812 FeedbackVectorSlot feedback_slot = expr->CountSlot(); |
2814 switch (assign_type) { | 2813 switch (assign_type) { |
2815 case VARIABLE: { | 2814 case VARIABLE: { |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3212 } | 3211 } |
3213 | 3212 |
3214 | 3213 |
3215 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3214 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3216 return info()->shared_info()->feedback_vector()->GetIndex(slot); | 3215 return info()->shared_info()->feedback_vector()->GetIndex(slot); |
3217 } | 3216 } |
3218 | 3217 |
3219 } // namespace interpreter | 3218 } // namespace interpreter |
3220 } // namespace internal | 3219 } // namespace internal |
3221 } // namespace v8 | 3220 } // namespace v8 |
OLD | NEW |