Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 2804813003: [turbofan] Collect and use type feedback on ToNumber. (Closed)
Patch Set: Address Michis feedback. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compile-time-value.h" 7 #include "src/ast/compile-time-value.h"
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/builtins/builtins-constructor.h" 9 #include "src/builtins/builtins-constructor.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2958 matching lines...) Expand 10 before | Expand all | Expand 10 after
2969 property->obj()->AsSuperPropertyReference(); 2969 property->obj()->AsSuperPropertyReference();
2970 VisitForRegisterValue(super_property->this_var(), load_super_args[0]); 2970 VisitForRegisterValue(super_property->this_var(), load_super_args[0]);
2971 VisitForRegisterValue(super_property->home_object(), load_super_args[1]); 2971 VisitForRegisterValue(super_property->home_object(), load_super_args[1]);
2972 VisitForRegisterValue(property->key(), load_super_args[2]); 2972 VisitForRegisterValue(property->key(), load_super_args[2]);
2973 builder()->CallRuntime(Runtime::kLoadKeyedFromSuper, load_super_args); 2973 builder()->CallRuntime(Runtime::kLoadKeyedFromSuper, load_super_args);
2974 break; 2974 break;
2975 } 2975 }
2976 } 2976 }
2977 2977
2978 // Save result for postfix expressions. 2978 // Save result for postfix expressions.
2979 FeedbackSlot count_slot = expr->CountBinaryOpFeedbackSlot();
2979 if (is_postfix) { 2980 if (is_postfix) {
2980 // Convert old value into a number before saving it. 2981 // Convert old value into a number before saving it.
2981 old_value = register_allocator()->NewRegister(); 2982 old_value = register_allocator()->NewRegister();
2983 // TODO(ignition): Think about adding proper PostInc/PostDec bytecodes
2984 // instead of this ToNumber + Inc/Dec dance.
2982 builder() 2985 builder()
2983 ->ConvertAccumulatorToNumber(old_value) 2986 ->ConvertAccumulatorToNumber(old_value, feedback_index(count_slot))
2984 .LoadAccumulatorWithRegister(old_value); 2987 .LoadAccumulatorWithRegister(old_value);
2985 } 2988 }
2986 2989
2987 // Perform +1/-1 operation. 2990 // Perform +1/-1 operation.
2988 FeedbackSlot slot = expr->CountBinaryOpFeedbackSlot(); 2991 builder()->CountOperation(expr->binary_op(), feedback_index(count_slot));
2989 builder()->CountOperation(expr->binary_op(), feedback_index(slot));
2990 2992
2991 // Store the value. 2993 // Store the value.
2992 builder()->SetExpressionPosition(expr); 2994 builder()->SetExpressionPosition(expr);
2993 FeedbackSlot feedback_slot = expr->CountSlot(); 2995 FeedbackSlot feedback_slot = expr->CountSlot();
2994 switch (assign_type) { 2996 switch (assign_type) {
2995 case VARIABLE: { 2997 case VARIABLE: {
2996 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 2998 VariableProxy* proxy = expr->expression()->AsVariableProxy();
2997 BuildVariableAssignment(proxy->var(), expr->op(), feedback_slot, 2999 BuildVariableAssignment(proxy->var(), expr->op(), feedback_slot,
2998 proxy->hole_check_mode()); 3000 proxy->hole_check_mode());
2999 break; 3001 break;
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 } 3625 }
3624 3626
3625 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() { 3627 Runtime::FunctionId BytecodeGenerator::StoreKeyedToSuperRuntimeId() {
3626 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict 3628 return is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
3627 : Runtime::kStoreKeyedToSuper_Sloppy; 3629 : Runtime::kStoreKeyedToSuper_Sloppy;
3628 } 3630 }
3629 3631
3630 } // namespace interpreter 3632 } // namespace interpreter
3631 } // namespace internal 3633 } // namespace internal
3632 } // namespace v8 3634 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698