Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 | |
|
rmcilroy
2016/08/03 16:04:29
/s/used/Used
mythria
2016/08/05 07:08:14
Done.
| |
| 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 Loading... | |
| 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 Loading... | |
| 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 |
| OLD | NEW |