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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 // Due to some WebKit tests, we want to make sure that we do not log | 1091 // Due to some WebKit tests, we want to make sure that we do not log |
1092 // more than one access failure here. | 1092 // more than one access failure here. |
1093 switch (CheckPropertyAccess(*obj, *name, v8::ACCESS_HAS)) { | 1093 switch (CheckPropertyAccess(*obj, *name, v8::ACCESS_HAS)) { |
1094 case ACCESS_FORBIDDEN: return heap->false_value(); | 1094 case ACCESS_FORBIDDEN: return heap->false_value(); |
1095 case ACCESS_ALLOWED: break; | 1095 case ACCESS_ALLOWED: break; |
1096 case ACCESS_ABSENT: return heap->undefined_value(); | 1096 case ACCESS_ABSENT: return heap->undefined_value(); |
1097 } | 1097 } |
1098 | 1098 |
1099 PropertyAttributes attrs = obj->GetLocalPropertyAttribute(*name); | 1099 PropertyAttributes attrs = obj->GetLocalPropertyAttribute(*name); |
1100 if (attrs == ABSENT) return heap->undefined_value(); | 1100 if (attrs == ABSENT) return heap->undefined_value(); |
1101 AccessorPair* accessors = obj->GetLocalPropertyAccessorPair(*name); | 1101 Handle<AccessorPair> accessors(obj->GetLocalPropertyAccessorPair(*name)); |
1102 | 1102 |
1103 Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE); | 1103 Handle<FixedArray> elms = isolate->factory()->NewFixedArray(DESCRIPTOR_SIZE); |
1104 elms->set(ENUMERABLE_INDEX, heap->ToBoolean((attrs & DONT_ENUM) == 0)); | 1104 elms->set(ENUMERABLE_INDEX, heap->ToBoolean((attrs & DONT_ENUM) == 0)); |
1105 elms->set(CONFIGURABLE_INDEX, heap->ToBoolean((attrs & DONT_DELETE) == 0)); | 1105 elms->set(CONFIGURABLE_INDEX, heap->ToBoolean((attrs & DONT_DELETE) == 0)); |
1106 elms->set(IS_ACCESSOR_INDEX, heap->ToBoolean(accessors != NULL)); | 1106 elms->set(IS_ACCESSOR_INDEX, heap->ToBoolean(!accessors.is_null())); |
1107 | 1107 |
1108 if (accessors == NULL) { | 1108 if (accessors.is_null()) { |
1109 elms->set(WRITABLE_INDEX, heap->ToBoolean((attrs & READ_ONLY) == 0)); | 1109 elms->set(WRITABLE_INDEX, heap->ToBoolean((attrs & READ_ONLY) == 0)); |
1110 // GetProperty does access check. | 1110 // GetProperty does access check. |
1111 Handle<Object> value = GetProperty(obj, name); | 1111 Handle<Object> value = GetProperty(obj, name); |
1112 if (value.is_null()) return Failure::Exception(); | 1112 if (value.is_null()) return Failure::Exception(); |
1113 elms->set(VALUE_INDEX, *value); | 1113 elms->set(VALUE_INDEX, *value); |
1114 } else { | 1114 } else { |
1115 // Access checks are performed for both accessors separately. | 1115 // Access checks are performed for both accessors separately. |
1116 // When they fail, the respective field is not set in the descriptor. | 1116 // When they fail, the respective field is not set in the descriptor. |
1117 Object* getter = accessors->GetComponent(ACCESSOR_GETTER); | 1117 Object* getter = accessors->GetComponent(ACCESSOR_GETTER); |
1118 Object* setter = accessors->GetComponent(ACCESSOR_SETTER); | 1118 Object* setter = accessors->GetComponent(ACCESSOR_SETTER); |
(...skipping 12524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13643 // Handle last resort GC and make sure to allow future allocations | 13643 // Handle last resort GC and make sure to allow future allocations |
13644 // to grow the heap without causing GCs (if possible). | 13644 // to grow the heap without causing GCs (if possible). |
13645 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13645 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13646 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13646 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13647 "Runtime::PerformGC"); | 13647 "Runtime::PerformGC"); |
13648 } | 13648 } |
13649 } | 13649 } |
13650 | 13650 |
13651 | 13651 |
13652 } } // namespace v8::internal | 13652 } } // namespace v8::internal |
OLD | NEW |