Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: src/runtime.cc

Issue 14657003: Implementation of Uint8ClampedArray. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.cc ('k') | src/typedarray.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 767
768 enum TypedArrayId { 768 enum TypedArrayId {
769 // arrayIds below should be synchromized with typedarray.js natives. 769 // arrayIds below should be synchromized with typedarray.js natives.
770 ARRAY_ID_UINT8 = 1, 770 ARRAY_ID_UINT8 = 1,
771 ARRAY_ID_INT8 = 2, 771 ARRAY_ID_INT8 = 2,
772 ARRAY_ID_UINT16 = 3, 772 ARRAY_ID_UINT16 = 3,
773 ARRAY_ID_INT16 = 4, 773 ARRAY_ID_INT16 = 4,
774 ARRAY_ID_UINT32 = 5, 774 ARRAY_ID_UINT32 = 5,
775 ARRAY_ID_INT32 = 6, 775 ARRAY_ID_INT32 = 6,
776 ARRAY_ID_FLOAT32 = 7, 776 ARRAY_ID_FLOAT32 = 7,
777 ARRAY_ID_FLOAT64 = 8 777 ARRAY_ID_FLOAT64 = 8,
778 ARRAY_ID_UINT8C = 9
778 }; 779 };
779 780
780 781
781 RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitialize) { 782 RUNTIME_FUNCTION(MaybeObject*, Runtime_TypedArrayInitialize) {
782 HandleScope scope(isolate); 783 HandleScope scope(isolate);
783 ASSERT(args.length() == 5); 784 ASSERT(args.length() == 5);
784 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0); 785 CONVERT_ARG_HANDLE_CHECKED(JSTypedArray, holder, 0);
785 CONVERT_SMI_ARG_CHECKED(arrayId, 1); 786 CONVERT_SMI_ARG_CHECKED(arrayId, 1);
786 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 2); 787 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, buffer, 2);
787 CONVERT_ARG_HANDLE_CHECKED(Object, byte_offset_object, 3); 788 CONVERT_ARG_HANDLE_CHECKED(Object, byte_offset_object, 3);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 case ARRAY_ID_FLOAT32: 825 case ARRAY_ID_FLOAT32:
825 elementsKind = EXTERNAL_FLOAT_ELEMENTS; 826 elementsKind = EXTERNAL_FLOAT_ELEMENTS;
826 arrayType = kExternalFloatArray; 827 arrayType = kExternalFloatArray;
827 elementSize = 4; 828 elementSize = 4;
828 break; 829 break;
829 case ARRAY_ID_FLOAT64: 830 case ARRAY_ID_FLOAT64:
830 elementsKind = EXTERNAL_DOUBLE_ELEMENTS; 831 elementsKind = EXTERNAL_DOUBLE_ELEMENTS;
831 arrayType = kExternalDoubleArray; 832 arrayType = kExternalDoubleArray;
832 elementSize = 8; 833 elementSize = 8;
833 break; 834 break;
835 case ARRAY_ID_UINT8C:
836 elementsKind = EXTERNAL_PIXEL_ELEMENTS;
837 arrayType = kExternalPixelArray;
838 elementSize = 1;
839 break;
834 default: 840 default:
835 UNREACHABLE(); 841 UNREACHABLE();
836 return NULL; 842 return NULL;
837 } 843 }
838 844
839 holder->set_buffer(*buffer); 845 holder->set_buffer(*buffer);
840 holder->set_byte_offset(*byte_offset_object); 846 holder->set_byte_offset(*byte_offset_object);
841 holder->set_byte_length(*byte_length_object); 847 holder->set_byte_length(*byte_length_object);
842 848
843 size_t byte_offset = NumberToSize(isolate, *byte_offset_object); 849 size_t byte_offset = NumberToSize(isolate, *byte_offset_object);
(...skipping 12525 matching lines...) Expand 10 before | Expand all | Expand 10 after
13369 // Handle last resort GC and make sure to allow future allocations 13375 // Handle last resort GC and make sure to allow future allocations
13370 // to grow the heap without causing GCs (if possible). 13376 // to grow the heap without causing GCs (if possible).
13371 isolate->counters()->gc_last_resort_from_js()->Increment(); 13377 isolate->counters()->gc_last_resort_from_js()->Increment();
13372 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13378 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13373 "Runtime::PerformGC"); 13379 "Runtime::PerformGC");
13374 } 13380 }
13375 } 13381 }
13376 13382
13377 13383
13378 } } // namespace v8::internal 13384 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/typedarray.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698