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 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 | 1229 |
1230 | 1230 |
1231 RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) { | 1231 RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) { |
1232 ASSERT(args.length() == 1); | 1232 ASSERT(args.length() == 1); |
1233 CONVERT_ARG_CHECKED(HeapObject, object, 0); | 1233 CONVERT_ARG_CHECKED(HeapObject, object, 0); |
1234 Map* old_map = object->map(); | 1234 Map* old_map = object->map(); |
1235 bool needs_access_checks = old_map->is_access_check_needed(); | 1235 bool needs_access_checks = old_map->is_access_check_needed(); |
1236 if (needs_access_checks) { | 1236 if (needs_access_checks) { |
1237 // Copy map so it won't interfere constructor's initial map. | 1237 // Copy map so it won't interfere constructor's initial map. |
1238 Object* new_map; | 1238 Object* new_map; |
1239 { MaybeObject* maybe_new_map = old_map->CopyDropTransitions(); | 1239 { MaybeObject* maybe_new_map = |
| 1240 old_map->CopyDropTransitions(DescriptorArray::MAY_BE_SHARED); |
1240 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; | 1241 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; |
1241 } | 1242 } |
1242 | 1243 |
1243 Map::cast(new_map)->set_is_access_check_needed(false); | 1244 Map::cast(new_map)->set_is_access_check_needed(false); |
1244 object->set_map(Map::cast(new_map)); | 1245 object->set_map(Map::cast(new_map)); |
1245 } | 1246 } |
1246 return isolate->heap()->ToBoolean(needs_access_checks); | 1247 return isolate->heap()->ToBoolean(needs_access_checks); |
1247 } | 1248 } |
1248 | 1249 |
1249 | 1250 |
1250 RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { | 1251 RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { |
1251 ASSERT(args.length() == 1); | 1252 ASSERT(args.length() == 1); |
1252 CONVERT_ARG_CHECKED(HeapObject, object, 0); | 1253 CONVERT_ARG_CHECKED(HeapObject, object, 0); |
1253 Map* old_map = object->map(); | 1254 Map* old_map = object->map(); |
1254 if (!old_map->is_access_check_needed()) { | 1255 if (!old_map->is_access_check_needed()) { |
1255 // Copy map so it won't interfere constructor's initial map. | 1256 // Copy map so it won't interfere constructor's initial map. |
1256 Object* new_map; | 1257 Object* new_map; |
1257 { MaybeObject* maybe_new_map = old_map->CopyDropTransitions(); | 1258 { MaybeObject* maybe_new_map = |
| 1259 old_map->CopyDropTransitions(DescriptorArray::MAY_BE_SHARED); |
1258 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; | 1260 if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map; |
1259 } | 1261 } |
1260 | 1262 |
1261 Map::cast(new_map)->set_is_access_check_needed(true); | 1263 Map::cast(new_map)->set_is_access_check_needed(true); |
1262 object->set_map(Map::cast(new_map)); | 1264 object->set_map(Map::cast(new_map)); |
1263 } | 1265 } |
1264 return isolate->heap()->undefined_value(); | 1266 return isolate->heap()->undefined_value(); |
1265 } | 1267 } |
1266 | 1268 |
1267 | 1269 |
(...skipping 8964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10232 } | 10234 } |
10233 return maybe_value; | 10235 return maybe_value; |
10234 } | 10236 } |
10235 return value; | 10237 return value; |
10236 } else { | 10238 } else { |
10237 return heap->undefined_value(); | 10239 return heap->undefined_value(); |
10238 } | 10240 } |
10239 } | 10241 } |
10240 case INTERCEPTOR: | 10242 case INTERCEPTOR: |
10241 case MAP_TRANSITION: | 10243 case MAP_TRANSITION: |
10242 case ELEMENTS_TRANSITION: | |
10243 case CONSTANT_TRANSITION: | 10244 case CONSTANT_TRANSITION: |
10244 case NULL_DESCRIPTOR: | 10245 case NULL_DESCRIPTOR: |
10245 return heap->undefined_value(); | 10246 return heap->undefined_value(); |
10246 case HANDLER: | 10247 case HANDLER: |
10247 UNREACHABLE(); | 10248 UNREACHABLE(); |
10248 return heap->undefined_value(); | 10249 return heap->undefined_value(); |
10249 } | 10250 } |
10250 UNREACHABLE(); // keep the compiler happy | 10251 UNREACHABLE(); // keep the compiler happy |
10251 return heap->undefined_value(); | 10252 return heap->undefined_value(); |
10252 } | 10253 } |
(...skipping 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13545 // Handle last resort GC and make sure to allow future allocations | 13546 // Handle last resort GC and make sure to allow future allocations |
13546 // to grow the heap without causing GCs (if possible). | 13547 // to grow the heap without causing GCs (if possible). |
13547 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13548 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13548 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13549 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13549 "Runtime::PerformGC"); | 13550 "Runtime::PerformGC"); |
13550 } | 13551 } |
13551 } | 13552 } |
13552 | 13553 |
13553 | 13554 |
13554 } } // namespace v8::internal | 13555 } } // namespace v8::internal |
OLD | NEW |