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 10490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10501 } | 10501 } |
10502 return string; | 10502 return string; |
10503 } | 10503 } |
10504 | 10504 |
10505 | 10505 |
10506 // Moves all own elements of an object, that are below a limit, to positions | 10506 // Moves all own elements of an object, that are below a limit, to positions |
10507 // starting at zero. All undefined values are placed after non-undefined values, | 10507 // starting at zero. All undefined values are placed after non-undefined values, |
10508 // and are followed by non-existing element. Does not change the length | 10508 // and are followed by non-existing element. Does not change the length |
10509 // property. | 10509 // property. |
10510 // Returns the number of non-undefined elements collected. | 10510 // Returns the number of non-undefined elements collected. |
10511 // Returns -1 if hole removal is not supported by this method. | |
10511 RUNTIME_FUNCTION(MaybeObject*, Runtime_RemoveArrayHoles) { | 10512 RUNTIME_FUNCTION(MaybeObject*, Runtime_RemoveArrayHoles) { |
10512 HandleScope scope(isolate); | 10513 HandleScope scope(isolate); |
10513 ASSERT(args.length() == 2); | 10514 ASSERT(args.length() == 2); |
10514 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 10515 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
10515 CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]); | 10516 CONVERT_NUMBER_CHECKED(uint32_t, limit, Uint32, args[1]); |
10517 if (object->HasFastArgumentsElements() || | |
Michael Starzinger
2014/03/12 13:31:57
nit: Instead of putting this logic here, can we mo
| |
10518 object->HasDictionaryArgumentsElements() || | |
Michael Starzinger
2014/03/12 13:31:57
nit: Better use object->HasNonStrictArgumentsEleme
| |
10519 object->map()->is_observed()) { | |
10520 return Smi::FromInt(-1); | |
10521 } | |
10516 return *JSObject::PrepareElementsForSort(object, limit); | 10522 return *JSObject::PrepareElementsForSort(object, limit); |
10517 } | 10523 } |
10518 | 10524 |
10519 | 10525 |
10520 // Move contents of argument 0 (an array) to argument 1 (an array) | 10526 // Move contents of argument 0 (an array) to argument 1 (an array) |
10521 RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) { | 10527 RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) { |
10522 SealHandleScope shs(isolate); | 10528 SealHandleScope shs(isolate); |
10523 ASSERT(args.length() == 2); | 10529 ASSERT(args.length() == 2); |
10524 CONVERT_ARG_CHECKED(JSArray, from, 0); | 10530 CONVERT_ARG_CHECKED(JSArray, from, 0); |
10525 CONVERT_ARG_CHECKED(JSArray, to, 1); | 10531 CONVERT_ARG_CHECKED(JSArray, to, 1); |
(...skipping 4444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
14970 // Handle last resort GC and make sure to allow future allocations | 14976 // Handle last resort GC and make sure to allow future allocations |
14971 // to grow the heap without causing GCs (if possible). | 14977 // to grow the heap without causing GCs (if possible). |
14972 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14978 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14973 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14979 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14974 "Runtime::PerformGC"); | 14980 "Runtime::PerformGC"); |
14975 } | 14981 } |
14976 } | 14982 } |
14977 | 14983 |
14978 | 14984 |
14979 } } // namespace v8::internal | 14985 } } // namespace v8::internal |
OLD | NEW |