OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 | 920 |
921 bool Object::IsPrimitive() { | 921 bool Object::IsPrimitive() { |
922 return IsOddball() || IsNumber() || IsString(); | 922 return IsOddball() || IsNumber() || IsString(); |
923 } | 923 } |
924 | 924 |
925 | 925 |
926 bool Object::IsJSGlobalProxy() { | 926 bool Object::IsJSGlobalProxy() { |
927 bool result = IsHeapObject() && | 927 bool result = IsHeapObject() && |
928 (HeapObject::cast(this)->map()->instance_type() == | 928 (HeapObject::cast(this)->map()->instance_type() == |
929 JS_GLOBAL_PROXY_TYPE); | 929 JS_GLOBAL_PROXY_TYPE); |
930 ASSERT(!result || | 930 ASSERT(!result || IsAccessCheckNeeded()); |
931 HeapObject::cast(this)->map()->is_access_check_needed()); | |
932 return result; | 931 return result; |
933 } | 932 } |
934 | 933 |
935 | 934 |
936 bool Object::IsGlobalObject() { | 935 bool Object::IsGlobalObject() { |
937 if (!IsHeapObject()) return false; | 936 if (!IsHeapObject()) return false; |
938 | 937 |
939 InstanceType type = HeapObject::cast(this)->map()->instance_type(); | 938 InstanceType type = HeapObject::cast(this)->map()->instance_type(); |
940 return type == JS_GLOBAL_OBJECT_TYPE || | 939 return type == JS_GLOBAL_OBJECT_TYPE || |
941 type == JS_BUILTINS_OBJECT_TYPE; | 940 type == JS_BUILTINS_OBJECT_TYPE; |
942 } | 941 } |
943 | 942 |
944 | 943 |
945 TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE) | 944 TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE) |
946 TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE) | 945 TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE) |
947 | 946 |
948 | 947 |
949 bool Object::IsUndetectableObject() { | 948 bool Object::IsUndetectableObject() { |
950 return IsHeapObject() | 949 return IsHeapObject() |
951 && HeapObject::cast(this)->map()->is_undetectable(); | 950 && HeapObject::cast(this)->map()->is_undetectable(); |
952 } | 951 } |
953 | 952 |
954 | 953 |
955 bool Object::IsAccessCheckNeeded() { | 954 bool Object::IsAccessCheckNeeded() { |
956 if (!IsHeapObject()) return false; | 955 return IsHeapObject() |
957 if (IsJSGlobalProxy()) { | 956 && HeapObject::cast(this)->map()->is_access_check_needed(); |
958 JSGlobalProxy* proxy = JSGlobalProxy::cast(this); | |
959 GlobalObject* global = | |
960 proxy->GetIsolate()->context()->global_object(); | |
961 return proxy->IsDetachedFrom(global); | |
962 } | |
963 return HeapObject::cast(this)->map()->is_access_check_needed(); | |
964 } | 957 } |
965 | 958 |
966 | 959 |
967 bool Object::IsStruct() { | 960 bool Object::IsStruct() { |
968 if (!IsHeapObject()) return false; | 961 if (!IsHeapObject()) return false; |
969 switch (HeapObject::cast(this)->map()->instance_type()) { | 962 switch (HeapObject::cast(this)->map()->instance_type()) { |
970 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true; | 963 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true; |
971 STRUCT_LIST(MAKE_STRUCT_CASE) | 964 STRUCT_LIST(MAKE_STRUCT_CASE) |
972 #undef MAKE_STRUCT_CASE | 965 #undef MAKE_STRUCT_CASE |
973 default: return false; | 966 default: return false; |
(...skipping 5786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6760 #undef READ_UINT32_FIELD | 6753 #undef READ_UINT32_FIELD |
6761 #undef WRITE_UINT32_FIELD | 6754 #undef WRITE_UINT32_FIELD |
6762 #undef READ_SHORT_FIELD | 6755 #undef READ_SHORT_FIELD |
6763 #undef WRITE_SHORT_FIELD | 6756 #undef WRITE_SHORT_FIELD |
6764 #undef READ_BYTE_FIELD | 6757 #undef READ_BYTE_FIELD |
6765 #undef WRITE_BYTE_FIELD | 6758 #undef WRITE_BYTE_FIELD |
6766 | 6759 |
6767 } } // namespace v8::internal | 6760 } } // namespace v8::internal |
6768 | 6761 |
6769 #endif // V8_OBJECTS_INL_H_ | 6762 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |