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 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
894 } | 894 } |
895 | 895 |
896 Call::CallType Call::GetCallType() const { | 896 Call::CallType Call::GetCallType() const { |
897 VariableProxy* proxy = expression()->AsVariableProxy(); | 897 VariableProxy* proxy = expression()->AsVariableProxy(); |
898 if (proxy != NULL) { | 898 if (proxy != NULL) { |
899 if (is_possibly_eval()) { | 899 if (is_possibly_eval()) { |
900 return POSSIBLY_EVAL_CALL; | 900 return POSSIBLY_EVAL_CALL; |
901 } else if (proxy->var()->IsUnallocated()) { | 901 } else if (proxy->var()->IsUnallocated()) { |
902 return GLOBAL_CALL; | 902 return GLOBAL_CALL; |
903 } else if (proxy->var()->IsLookupSlot()) { | 903 } else if (proxy->var()->IsLookupSlot()) { |
904 return LOOKUP_SLOT_CALL; | 904 // Calls going through 'with' always use DYNAMIC rather than DYNAMIC_LOCAL |
| 905 // or DYNAMIC_GLOBAL. |
| 906 return proxy->var()->mode() == DYNAMIC ? WITH_CALL : OTHER_CALL; |
905 } | 907 } |
906 } | 908 } |
907 | 909 |
908 if (expression()->IsSuperCallReference()) return SUPER_CALL; | 910 if (expression()->IsSuperCallReference()) return SUPER_CALL; |
909 | 911 |
910 Property* property = expression()->AsProperty(); | 912 Property* property = expression()->AsProperty(); |
911 if (property != nullptr) { | 913 if (property != nullptr) { |
912 bool is_super = property->IsSuperAccess(); | 914 bool is_super = property->IsSuperAccess(); |
913 if (property->key()->IsPropertyName()) { | 915 if (property->key()->IsPropertyName()) { |
914 return is_super ? NAMED_SUPER_PROPERTY_CALL : NAMED_PROPERTY_CALL; | 916 return is_super ? NAMED_SUPER_PROPERTY_CALL : NAMED_PROPERTY_CALL; |
(...skipping 28 matching lines...) Expand all Loading... |
943 // static | 945 // static |
944 bool Literal::Match(void* literal1, void* literal2) { | 946 bool Literal::Match(void* literal1, void* literal2) { |
945 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 947 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
946 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 948 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
947 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 949 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
948 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 950 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
949 } | 951 } |
950 | 952 |
951 } // namespace internal | 953 } // namespace internal |
952 } // namespace v8 | 954 } // namespace v8 |
OLD | NEW |