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 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2794 SuperPropertyReference* super_property = | 2794 SuperPropertyReference* super_property = |
2795 property->obj()->AsSuperPropertyReference(); | 2795 property->obj()->AsSuperPropertyReference(); |
2796 VisitForRegisterValue(super_property->this_var(), object); | 2796 VisitForRegisterValue(super_property->this_var(), object); |
2797 VisitForRegisterValue(super_property->home_object(), home_object); | 2797 VisitForRegisterValue(super_property->home_object(), home_object); |
2798 VisitForRegisterValue(property->key(), key); | 2798 VisitForRegisterValue(property->key(), key); |
2799 BuildKeyedSuperPropertyLoad(object, home_object, key); | 2799 BuildKeyedSuperPropertyLoad(object, home_object, key); |
2800 break; | 2800 break; |
2801 } | 2801 } |
2802 } | 2802 } |
2803 | 2803 |
2804 // Convert old value into a number. | |
2805 builder()->CastAccumulatorToNumber(); | |
2806 | |
2807 // Save result for postfix expressions. | 2804 // Save result for postfix expressions. |
2808 if (is_postfix) { | 2805 if (is_postfix) { |
2809 old_value = register_allocator()->outer()->NewRegister(); | 2806 old_value = register_allocator()->outer()->NewRegister(); |
2810 builder()->StoreAccumulatorInRegister(old_value); | 2807 |
| 2808 // Convert old value into a number before saving it. |
| 2809 builder()->CastAccumulatorToNumber().StoreAccumulatorInRegister(old_value); |
2811 } | 2810 } |
2812 | 2811 |
2813 // Perform +1/-1 operation. | 2812 // Perform +1/-1 operation. |
2814 builder()->CountOperation(expr->binary_op()); | 2813 builder()->CountOperation(expr->binary_op()); |
2815 | 2814 |
2816 // Store the value. | 2815 // Store the value. |
2817 builder()->SetExpressionPosition(expr); | 2816 builder()->SetExpressionPosition(expr); |
2818 FeedbackVectorSlot feedback_slot = expr->CountSlot(); | 2817 FeedbackVectorSlot feedback_slot = expr->CountSlot(); |
2819 switch (assign_type) { | 2818 switch (assign_type) { |
2820 case VARIABLE: { | 2819 case VARIABLE: { |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3217 } | 3216 } |
3218 | 3217 |
3219 | 3218 |
3220 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3219 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3221 return info()->shared_info()->feedback_vector()->GetIndex(slot); | 3220 return info()->shared_info()->feedback_vector()->GetIndex(slot); |
3222 } | 3221 } |
3223 | 3222 |
3224 } // namespace interpreter | 3223 } // namespace interpreter |
3225 } // namespace internal | 3224 } // namespace internal |
3226 } // namespace v8 | 3225 } // namespace v8 |
OLD | NEW |