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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 | 1287 |
1288 | 1288 |
1289 RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) { | 1289 RUNTIME_FUNCTION(MaybeObject*, Runtime_DisableAccessChecks) { |
1290 ASSERT(args.length() == 1); | 1290 ASSERT(args.length() == 1); |
1291 CONVERT_ARG_CHECKED(HeapObject, object, 0); | 1291 CONVERT_ARG_CHECKED(HeapObject, object, 0); |
1292 Map* old_map = object->map(); | 1292 Map* old_map = object->map(); |
1293 bool needs_access_checks = old_map->is_access_check_needed(); | 1293 bool needs_access_checks = old_map->is_access_check_needed(); |
1294 if (needs_access_checks) { | 1294 if (needs_access_checks) { |
1295 // Copy map so it won't interfere constructor's initial map. | 1295 // Copy map so it won't interfere constructor's initial map. |
1296 Map* new_map; | 1296 Map* new_map; |
1297 MaybeObject* maybe_new_map = old_map->Copy(DescriptorArray::MAY_BE_SHARED); | 1297 MaybeObject* maybe_new_map = old_map->Copy(); |
1298 if (!maybe_new_map->To(&new_map)) return maybe_new_map; | 1298 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
1299 | 1299 |
1300 new_map->set_is_access_check_needed(false); | 1300 new_map->set_is_access_check_needed(false); |
1301 object->set_map(new_map); | 1301 object->set_map(new_map); |
1302 } | 1302 } |
1303 return isolate->heap()->ToBoolean(needs_access_checks); | 1303 return isolate->heap()->ToBoolean(needs_access_checks); |
1304 } | 1304 } |
1305 | 1305 |
1306 | 1306 |
1307 RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { | 1307 RUNTIME_FUNCTION(MaybeObject*, Runtime_EnableAccessChecks) { |
1308 ASSERT(args.length() == 1); | 1308 ASSERT(args.length() == 1); |
1309 CONVERT_ARG_CHECKED(HeapObject, object, 0); | 1309 CONVERT_ARG_CHECKED(HeapObject, object, 0); |
1310 Map* old_map = object->map(); | 1310 Map* old_map = object->map(); |
1311 if (!old_map->is_access_check_needed()) { | 1311 if (!old_map->is_access_check_needed()) { |
1312 // Copy map so it won't interfere constructor's initial map. | 1312 // Copy map so it won't interfere constructor's initial map. |
1313 Map* new_map; | 1313 Map* new_map; |
1314 MaybeObject* maybe_new_map = old_map->Copy(DescriptorArray::MAY_BE_SHARED); | 1314 MaybeObject* maybe_new_map = old_map->Copy(); |
1315 if (!maybe_new_map->To(&new_map)) return maybe_new_map; | 1315 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
1316 | 1316 |
1317 new_map->set_is_access_check_needed(true); | 1317 new_map->set_is_access_check_needed(true); |
1318 object->set_map(new_map); | 1318 object->set_map(new_map); |
1319 } | 1319 } |
1320 return isolate->heap()->undefined_value(); | 1320 return isolate->heap()->undefined_value(); |
1321 } | 1321 } |
1322 | 1322 |
1323 | 1323 |
1324 static Failure* ThrowRedeclarationError(Isolate* isolate, | 1324 static Failure* ThrowRedeclarationError(Isolate* isolate, |
(...skipping 12390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13715 // Handle last resort GC and make sure to allow future allocations | 13715 // Handle last resort GC and make sure to allow future allocations |
13716 // to grow the heap without causing GCs (if possible). | 13716 // to grow the heap without causing GCs (if possible). |
13717 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13717 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13718 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13718 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13719 "Runtime::PerformGC"); | 13719 "Runtime::PerformGC"); |
13720 } | 13720 } |
13721 } | 13721 } |
13722 | 13722 |
13723 | 13723 |
13724 } } // namespace v8::internal | 13724 } } // namespace v8::internal |
OLD | NEW |