| 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/compile-time-value.h" | 9 #include "src/ast/compile-time-value.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 UnaryOperation* maybe_unary = expr->AsUnaryOperation(); | 728 UnaryOperation* maybe_unary = expr->AsUnaryOperation(); |
| 729 return maybe_unary != NULL && maybe_unary->op() == Token::TYPEOF; | 729 return maybe_unary != NULL && maybe_unary->op() == Token::TYPEOF; |
| 730 } | 730 } |
| 731 | 731 |
| 732 void CompareOperation::AssignFeedbackVectorSlots( | 732 void CompareOperation::AssignFeedbackVectorSlots( |
| 733 Isolate* isolate, FeedbackVectorSpec* spec, | 733 Isolate* isolate, FeedbackVectorSpec* spec, |
| 734 FeedbackVectorSlotCache* cache_) { | 734 FeedbackVectorSlotCache* cache_) { |
| 735 // Feedback vector slot is only used by interpreter for binary operations. | 735 // Feedback vector slot is only used by interpreter for binary operations. |
| 736 // Full-codegen uses AstId to record type feedback. | 736 // Full-codegen uses AstId to record type feedback. |
| 737 switch (op()) { | 737 switch (op()) { |
| 738 // instanceof and in do not collect type feedback. | |
| 739 case Token::INSTANCEOF: | 738 case Token::INSTANCEOF: |
| 739 // instanceof collects feedback in a general slot (for now). |
| 740 type_feedback_slot_ = spec->AddGeneralSlot(); |
| 741 return; |
| 740 case Token::IN: | 742 case Token::IN: |
| 743 // in does not collect type feedback. |
| 741 return; | 744 return; |
| 742 default: | 745 default: |
| 743 type_feedback_slot_ = spec->AddInterpreterCompareICSlot(); | 746 type_feedback_slot_ = spec->AddInterpreterCompareICSlot(); |
| 747 return; |
| 744 } | 748 } |
| 745 } | 749 } |
| 746 | 750 |
| 747 // Check for the pattern: typeof <expression> equals <string literal>. | 751 // Check for the pattern: typeof <expression> equals <string literal>. |
| 748 static bool MatchLiteralCompareTypeof(Expression* left, | 752 static bool MatchLiteralCompareTypeof(Expression* left, |
| 749 Token::Value op, | 753 Token::Value op, |
| 750 Expression* right, | 754 Expression* right, |
| 751 Expression** expr, | 755 Expression** expr, |
| 752 Handle<String>* check) { | 756 Handle<String>* check) { |
| 753 if (IsTypeof(left) && right->IsStringLiteral() && Token::IsEqualityOp(op)) { | 757 if (IsTypeof(left) && right->IsStringLiteral() && Token::IsEqualityOp(op)) { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 // static | 964 // static |
| 961 bool Literal::Match(void* literal1, void* literal2) { | 965 bool Literal::Match(void* literal1, void* literal2) { |
| 962 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 966 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 963 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 967 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 964 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 968 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 965 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 969 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 966 } | 970 } |
| 967 | 971 |
| 968 } // namespace internal | 972 } // namespace internal |
| 969 } // namespace v8 | 973 } // namespace v8 |
| OLD | NEW |