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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 if (target_length == 0) return isolate->heap()->undefined_value(); | 794 if (target_length == 0) return isolate->heap()->undefined_value(); |
795 | 795 |
796 ASSERT(NumberToSize(isolate, source->byte_length()) - target_length >= start); | 796 ASSERT(NumberToSize(isolate, source->byte_length()) - target_length >= start); |
797 uint8_t* source_data = reinterpret_cast<uint8_t*>(source->backing_store()); | 797 uint8_t* source_data = reinterpret_cast<uint8_t*>(source->backing_store()); |
798 uint8_t* target_data = reinterpret_cast<uint8_t*>(target->backing_store()); | 798 uint8_t* target_data = reinterpret_cast<uint8_t*>(target->backing_store()); |
799 CopyBytes(target_data, source_data + start, target_length); | 799 CopyBytes(target_data, source_data + start, target_length); |
800 return isolate->heap()->undefined_value(); | 800 return isolate->heap()->undefined_value(); |
801 } | 801 } |
802 | 802 |
803 | 803 |
| 804 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferIsView) { |
| 805 HandleScope scope(isolate); |
| 806 ASSERT(args.length() == 1); |
| 807 CONVERT_ARG_CHECKED(Object, object, 0); |
| 808 return object->IsJSArrayBufferView() |
| 809 ? isolate->heap()->true_value() |
| 810 : isolate->heap()->false_value(); |
| 811 } |
| 812 |
| 813 |
804 enum TypedArrayId { | 814 enum TypedArrayId { |
805 // arrayIds below should be synchromized with typedarray.js natives. | 815 // arrayIds below should be synchromized with typedarray.js natives. |
806 ARRAY_ID_UINT8 = 1, | 816 ARRAY_ID_UINT8 = 1, |
807 ARRAY_ID_INT8 = 2, | 817 ARRAY_ID_INT8 = 2, |
808 ARRAY_ID_UINT16 = 3, | 818 ARRAY_ID_UINT16 = 3, |
809 ARRAY_ID_INT16 = 4, | 819 ARRAY_ID_INT16 = 4, |
810 ARRAY_ID_UINT32 = 5, | 820 ARRAY_ID_UINT32 = 5, |
811 ARRAY_ID_INT32 = 6, | 821 ARRAY_ID_INT32 = 6, |
812 ARRAY_ID_FLOAT32 = 7, | 822 ARRAY_ID_FLOAT32 = 7, |
813 ARRAY_ID_FLOAT64 = 8, | 823 ARRAY_ID_FLOAT64 = 8, |
(...skipping 13995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14809 // Handle last resort GC and make sure to allow future allocations | 14819 // Handle last resort GC and make sure to allow future allocations |
14810 // to grow the heap without causing GCs (if possible). | 14820 // to grow the heap without causing GCs (if possible). |
14811 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14821 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14812 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14822 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14813 "Runtime::PerformGC"); | 14823 "Runtime::PerformGC"); |
14814 } | 14824 } |
14815 } | 14825 } |
14816 | 14826 |
14817 | 14827 |
14818 } } // namespace v8::internal | 14828 } } // namespace v8::internal |
OLD | NEW |