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

Side by Side Diff: src/ast/ast.cc

Issue 2209633002: [Interpreter] Assign feedback slots for binary operations and use them in ignition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased the patch. Created 4 years, 4 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/ast/ast.h ('k') | src/ast/ast-numbering.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/ast/ast.h" 5 #include "src/ast/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 8
9 #include "src/ast/prettyprinter.h" 9 #include "src/ast/prettyprinter.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 FeedbackVectorSpec* spec, 282 FeedbackVectorSpec* spec,
283 FeedbackVectorSlotCache* cache) { 283 FeedbackVectorSlotCache* cache) {
284 AssignVectorSlots(target(), spec, &slot_); 284 AssignVectorSlots(target(), spec, &slot_);
285 } 285 }
286 286
287 287
288 void CountOperation::AssignFeedbackVectorSlots(Isolate* isolate, 288 void CountOperation::AssignFeedbackVectorSlots(Isolate* isolate,
289 FeedbackVectorSpec* spec, 289 FeedbackVectorSpec* spec,
290 FeedbackVectorSlotCache* cache) { 290 FeedbackVectorSlotCache* cache) {
291 AssignVectorSlots(expression(), spec, &slot_); 291 AssignVectorSlots(expression(), spec, &slot_);
292 // Assign a slot to collect feedback about binary operations. Used only in
293 // ignition. Fullcodegen uses AstId to record type feedback.
294 binary_operation_slot_ = spec->AddGeneralSlot();
292 } 295 }
293 296
294 297
295 Token::Value Assignment::binary_op() const { 298 Token::Value Assignment::binary_op() const {
296 switch (op()) { 299 switch (op()) {
297 case Token::ASSIGN_BIT_OR: return Token::BIT_OR; 300 case Token::ASSIGN_BIT_OR: return Token::BIT_OR;
298 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR; 301 case Token::ASSIGN_BIT_XOR: return Token::BIT_XOR;
299 case Token::ASSIGN_BIT_AND: return Token::BIT_AND; 302 case Token::ASSIGN_BIT_AND: return Token::BIT_AND;
300 case Token::ASSIGN_SHL: return Token::SHL; 303 case Token::ASSIGN_SHL: return Token::SHL;
301 case Token::ASSIGN_SAR: return Token::SAR; 304 case Token::ASSIGN_SAR: return Token::SAR;
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 730
728 void BinaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { 731 void BinaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
729 // TODO(olivf) If this Operation is used in a test context, then the right 732 // TODO(olivf) If this Operation is used in a test context, then the right
730 // hand side has a ToBoolean stub and we want to collect the type information. 733 // hand side has a ToBoolean stub and we want to collect the type information.
731 // However the GraphBuilder expects it to be on the instruction corresponding 734 // However the GraphBuilder expects it to be on the instruction corresponding
732 // to the TestContext, therefore we have to store it here and not on the 735 // to the TestContext, therefore we have to store it here and not on the
733 // right hand operand. 736 // right hand operand.
734 set_to_boolean_types(oracle->ToBooleanTypes(right()->test_id())); 737 set_to_boolean_types(oracle->ToBooleanTypes(right()->test_id()));
735 } 738 }
736 739
740 void BinaryOperation::AssignFeedbackVectorSlots(
741 Isolate* isolate, FeedbackVectorSpec* spec,
742 FeedbackVectorSlotCache* cache) {
743 // Feedback vector slot is only used by interpreter for binary operations.
744 // Full-codegen uses AstId to record type feedback.
745 switch (op()) {
746 // Comma, logical_or and logical_and do not collect type feedback.
747 case Token::COMMA:
748 case Token::AND:
749 case Token::OR:
750 return;
751 default:
752 type_feedback_slot_ = spec->AddGeneralSlot();
753 return;
754 }
755 }
737 756
738 static bool IsTypeof(Expression* expr) { 757 static bool IsTypeof(Expression* expr) {
739 UnaryOperation* maybe_unary = expr->AsUnaryOperation(); 758 UnaryOperation* maybe_unary = expr->AsUnaryOperation();
740 return maybe_unary != NULL && maybe_unary->op() == Token::TYPEOF; 759 return maybe_unary != NULL && maybe_unary->op() == Token::TYPEOF;
741 } 760 }
742 761
743 762
744 // Check for the pattern: typeof <expression> equals <string literal>. 763 // Check for the pattern: typeof <expression> equals <string literal>.
745 static bool MatchLiteralCompareTypeof(Expression* left, 764 static bool MatchLiteralCompareTypeof(Expression* left,
746 Token::Value op, 765 Token::Value op,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 bool Literal::Match(void* literal1, void* literal2) { 978 bool Literal::Match(void* literal1, void* literal2) {
960 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 979 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
961 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 980 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
962 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 981 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
963 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 982 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
964 } 983 }
965 984
966 985
967 } // namespace internal 986 } // namespace internal
968 } // namespace v8 987 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/ast-numbering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698