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 || IsAccessCheckNeeded()); | 930 ASSERT(!result || |
| 931 HeapObject::cast(this)->map()->is_access_check_needed()); |
931 return result; | 932 return result; |
932 } | 933 } |
933 | 934 |
934 | 935 |
935 bool Object::IsGlobalObject() { | 936 bool Object::IsGlobalObject() { |
936 if (!IsHeapObject()) return false; | 937 if (!IsHeapObject()) return false; |
937 | 938 |
938 InstanceType type = HeapObject::cast(this)->map()->instance_type(); | 939 InstanceType type = HeapObject::cast(this)->map()->instance_type(); |
939 return type == JS_GLOBAL_OBJECT_TYPE || | 940 return type == JS_GLOBAL_OBJECT_TYPE || |
940 type == JS_BUILTINS_OBJECT_TYPE; | 941 type == JS_BUILTINS_OBJECT_TYPE; |
941 } | 942 } |
942 | 943 |
943 | 944 |
944 TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE) | 945 TYPE_CHECKER(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE) |
945 TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE) | 946 TYPE_CHECKER(JSBuiltinsObject, JS_BUILTINS_OBJECT_TYPE) |
946 | 947 |
947 | 948 |
948 bool Object::IsUndetectableObject() { | 949 bool Object::IsUndetectableObject() { |
949 return IsHeapObject() | 950 return IsHeapObject() |
950 && HeapObject::cast(this)->map()->is_undetectable(); | 951 && HeapObject::cast(this)->map()->is_undetectable(); |
951 } | 952 } |
952 | 953 |
953 | 954 |
954 bool Object::IsAccessCheckNeeded() { | 955 bool Object::IsAccessCheckNeeded() { |
955 return IsHeapObject() | 956 if (!IsHeapObject()) return false; |
956 && HeapObject::cast(this)->map()->is_access_check_needed(); | 957 if (IsJSGlobalProxy()) { |
| 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(); |
957 } | 964 } |
958 | 965 |
959 | 966 |
960 bool Object::IsStruct() { | 967 bool Object::IsStruct() { |
961 if (!IsHeapObject()) return false; | 968 if (!IsHeapObject()) return false; |
962 switch (HeapObject::cast(this)->map()->instance_type()) { | 969 switch (HeapObject::cast(this)->map()->instance_type()) { |
963 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true; | 970 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: return true; |
964 STRUCT_LIST(MAKE_STRUCT_CASE) | 971 STRUCT_LIST(MAKE_STRUCT_CASE) |
965 #undef MAKE_STRUCT_CASE | 972 #undef MAKE_STRUCT_CASE |
966 default: return false; | 973 default: return false; |
(...skipping 5767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6734 #undef READ_UINT32_FIELD | 6741 #undef READ_UINT32_FIELD |
6735 #undef WRITE_UINT32_FIELD | 6742 #undef WRITE_UINT32_FIELD |
6736 #undef READ_SHORT_FIELD | 6743 #undef READ_SHORT_FIELD |
6737 #undef WRITE_SHORT_FIELD | 6744 #undef WRITE_SHORT_FIELD |
6738 #undef READ_BYTE_FIELD | 6745 #undef READ_BYTE_FIELD |
6739 #undef WRITE_BYTE_FIELD | 6746 #undef WRITE_BYTE_FIELD |
6740 | 6747 |
6741 } } // namespace v8::internal | 6748 } } // namespace v8::internal |
6742 | 6749 |
6743 #endif // V8_OBJECTS_INL_H_ | 6750 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |