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 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 | 989 |
990 if (source->IsJSTypedArray()) { | 990 if (source->IsJSTypedArray()) { |
991 Handle<JSTypedArray> typed_array(JSTypedArray::cast(*source)); | 991 Handle<JSTypedArray> typed_array(JSTypedArray::cast(*source)); |
992 | 992 |
993 if (typed_array->type() == holder->type()) { | 993 if (typed_array->type() == holder->type()) { |
994 uint8_t* backing_store = | 994 uint8_t* backing_store = |
995 static_cast<uint8_t*>( | 995 static_cast<uint8_t*>( |
996 JSArrayBuffer::cast(typed_array->buffer())->backing_store()); | 996 JSArrayBuffer::cast(typed_array->buffer())->backing_store()); |
997 size_t source_byte_offset = | 997 size_t source_byte_offset = |
998 NumberToSize(isolate, typed_array->byte_offset()); | 998 NumberToSize(isolate, typed_array->byte_offset()); |
999 OS::MemCopy( | 999 memcpy( |
1000 buffer->backing_store(), | 1000 buffer->backing_store(), |
1001 backing_store + source_byte_offset, | 1001 backing_store + source_byte_offset, |
1002 byte_length); | 1002 byte_length); |
1003 return *isolate->factory()->true_value(); | 1003 return *isolate->factory()->true_value(); |
1004 } else { | 1004 } else { |
1005 return *isolate->factory()->false_value(); | 1005 return *isolate->factory()->false_value(); |
1006 } | 1006 } |
1007 } | 1007 } |
1008 | 1008 |
1009 return *isolate->factory()->false_value(); | 1009 return *isolate->factory()->false_value(); |
(...skipping 13631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14641 // Handle last resort GC and make sure to allow future allocations | 14641 // Handle last resort GC and make sure to allow future allocations |
14642 // to grow the heap without causing GCs (if possible). | 14642 // to grow the heap without causing GCs (if possible). |
14643 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14643 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14644 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14644 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14645 "Runtime::PerformGC"); | 14645 "Runtime::PerformGC"); |
14646 } | 14646 } |
14647 } | 14647 } |
14648 | 14648 |
14649 | 14649 |
14650 } } // namespace v8::internal | 14650 } } // namespace v8::internal |
OLD | NEW |