| 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 return static_cast<const Node*>(this)->IsMonomorphic(); | 881 return static_cast<const Node*>(this)->IsMonomorphic(); |
| 882 PROPERTY_NODE_LIST(GENERATE_CASE) | 882 PROPERTY_NODE_LIST(GENERATE_CASE) |
| 883 CALL_NODE_LIST(GENERATE_CASE) | 883 CALL_NODE_LIST(GENERATE_CASE) |
| 884 #undef GENERATE_CASE | 884 #undef GENERATE_CASE |
| 885 default: | 885 default: |
| 886 UNREACHABLE(); | 886 UNREACHABLE(); |
| 887 return false; | 887 return false; |
| 888 } | 888 } |
| 889 } | 889 } |
| 890 | 890 |
| 891 bool Call::IsUsingCallFeedbackICSlot( | 891 bool Call::IsUsingCallFeedbackICSlot() const { |
| 892 Isolate* isolate, HandleDereferenceMode dereference_mode) const { | 892 return GetCallType() != POSSIBLY_EVAL_CALL; |
| 893 CallType call_type = GetCallType(isolate, dereference_mode); | |
| 894 if (call_type == POSSIBLY_EVAL_CALL) { | |
| 895 return false; | |
| 896 } | |
| 897 return true; | |
| 898 } | 893 } |
| 899 | 894 |
| 900 bool Call::IsUsingCallFeedbackSlot( | 895 bool Call::IsUsingCallFeedbackSlot() const { |
| 901 Isolate* isolate, HandleDereferenceMode dereference_mode) const { | |
| 902 // SuperConstructorCall uses a CallConstructStub, which wants | 896 // SuperConstructorCall uses a CallConstructStub, which wants |
| 903 // a Slot, in addition to any IC slots requested elsewhere. | 897 // a Slot, in addition to any IC slots requested elsewhere. |
| 904 return GetCallType(isolate, dereference_mode) == SUPER_CALL; | 898 return GetCallType() == SUPER_CALL; |
| 905 } | 899 } |
| 906 | 900 |
| 907 | 901 |
| 908 void Call::AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, | 902 void Call::AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec, |
| 909 FeedbackVectorSlotCache* cache) { | 903 FeedbackVectorSlotCache* cache) { |
| 910 if (IsUsingCallFeedbackICSlot(isolate)) { | 904 if (IsUsingCallFeedbackICSlot()) { |
| 911 ic_slot_ = spec->AddCallICSlot(); | 905 ic_slot_ = spec->AddCallICSlot(); |
| 912 } | 906 } |
| 913 if (IsUsingCallFeedbackSlot(isolate)) { | 907 if (IsUsingCallFeedbackSlot()) { |
| 914 stub_slot_ = spec->AddGeneralSlot(); | 908 stub_slot_ = spec->AddGeneralSlot(); |
| 915 } | 909 } |
| 916 } | 910 } |
| 917 | 911 |
| 918 Call::CallType Call::GetCallType(Isolate* isolate, | 912 Call::CallType Call::GetCallType() const { |
| 919 HandleDereferenceMode deref_mode) const { | |
| 920 VariableProxy* proxy = expression()->AsVariableProxy(); | 913 VariableProxy* proxy = expression()->AsVariableProxy(); |
| 921 if (proxy != NULL) { | 914 if (proxy != NULL) { |
| 922 if (proxy->var()->is_possibly_eval(isolate, deref_mode)) { | 915 if (is_possibly_eval()) { |
| 923 return POSSIBLY_EVAL_CALL; | 916 return POSSIBLY_EVAL_CALL; |
| 924 } else if (proxy->var()->IsUnallocatedOrGlobalSlot()) { | 917 } else if (proxy->var()->IsUnallocatedOrGlobalSlot()) { |
| 925 return GLOBAL_CALL; | 918 return GLOBAL_CALL; |
| 926 } else if (proxy->var()->IsLookupSlot()) { | 919 } else if (proxy->var()->IsLookupSlot()) { |
| 927 return LOOKUP_SLOT_CALL; | 920 return LOOKUP_SLOT_CALL; |
| 928 } | 921 } |
| 929 } | 922 } |
| 930 | 923 |
| 931 if (expression()->IsSuperCallReference()) return SUPER_CALL; | 924 if (expression()->IsSuperCallReference()) return SUPER_CALL; |
| 932 | 925 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 961 // static | 954 // static |
| 962 bool Literal::Match(void* literal1, void* literal2) { | 955 bool Literal::Match(void* literal1, void* literal2) { |
| 963 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 956 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 964 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 957 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 965 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 958 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 966 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 959 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 967 } | 960 } |
| 968 | 961 |
| 969 } // namespace internal | 962 } // namespace internal |
| 970 } // namespace v8 | 963 } // namespace v8 |
| OLD | NEW |