OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2750 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*hidden_props)); | 2750 i::Handle<i::JSObject> js_obj(i::JSObject::cast(*hidden_props)); |
2751 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 2751 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
2752 return i::DeleteProperty(js_obj, key_obj)->IsTrue(); | 2752 return i::DeleteProperty(js_obj, key_obj)->IsTrue(); |
2753 } | 2753 } |
2754 | 2754 |
2755 | 2755 |
2756 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { | 2756 void v8::Object::SetIndexedPropertiesToPixelData(uint8_t* data, int length) { |
2757 ON_BAILOUT("v8::SetElementsToPixelData()", return); | 2757 ON_BAILOUT("v8::SetElementsToPixelData()", return); |
2758 ENTER_V8; | 2758 ENTER_V8; |
2759 HandleScope scope; | 2759 HandleScope scope; |
2760 if (!ApiCheck(length <= i::PixelArray::kMaxLength, | 2760 if (!ApiCheck(length <= i::ExternalPixelArray::kMaxLength, |
2761 "v8::Object::SetIndexedPropertiesToPixelData()", | 2761 "v8::Object::SetIndexedPropertiesToPixelData()", |
2762 "length exceeds max acceptable value")) { | 2762 "length exceeds max acceptable value")) { |
2763 return; | 2763 return; |
2764 } | 2764 } |
2765 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2765 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2766 if (!ApiCheck(!self->IsJSArray(), | 2766 if (!ApiCheck(!self->IsJSArray(), |
2767 "v8::Object::SetIndexedPropertiesToPixelData()", | 2767 "v8::Object::SetIndexedPropertiesToPixelData()", |
2768 "JSArray is not supported")) { | 2768 "JSArray is not supported")) { |
2769 return; | 2769 return; |
2770 } | 2770 } |
2771 i::Handle<i::PixelArray> pixels = i::Factory::NewPixelArray(length, data); | 2771 i::Handle<i::ExternalPixelArray> pixels = |
2772 i::Factory::NewExternalPixelArray(length, data); | |
2772 i::Handle<i::Map> pixel_array_map = | 2773 i::Handle<i::Map> pixel_array_map = |
2773 i::Factory::GetPixelArrayElementsMap(i::Handle<i::Map>(self->map())); | 2774 i::Factory::GetExternalPixelArrayElementsMap( |
danno
2011/02/21 13:03:09
TODO: This needs to be unified with the elements a
| |
2775 i::Handle<i::Map>(self->map())); | |
2774 self->set_map(*pixel_array_map); | 2776 self->set_map(*pixel_array_map); |
2775 self->set_elements(*pixels); | 2777 self->set_elements(*pixels); |
2776 } | 2778 } |
2777 | 2779 |
2778 | 2780 |
2779 bool v8::Object::HasIndexedPropertiesInPixelData() { | 2781 bool v8::Object::HasIndexedPropertiesInPixelData() { |
2780 ON_BAILOUT("v8::HasIndexedPropertiesInPixelData()", return false); | 2782 ON_BAILOUT("v8::HasIndexedPropertiesInPixelData()", return false); |
2781 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2783 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2782 return self->HasPixelElements(); | 2784 return self->HasExternalPixelElements(); |
2783 } | 2785 } |
2784 | 2786 |
2785 | 2787 |
2786 uint8_t* v8::Object::GetIndexedPropertiesPixelData() { | 2788 uint8_t* v8::Object::GetIndexedPropertiesPixelData() { |
2787 ON_BAILOUT("v8::GetIndexedPropertiesPixelData()", return NULL); | 2789 ON_BAILOUT("v8::GetIndexedPropertiesPixelData()", return NULL); |
2788 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2790 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2789 if (self->HasPixelElements()) { | 2791 if (self->HasExternalPixelElements()) { |
2790 return i::PixelArray::cast(self->elements())->external_pointer(); | 2792 return i::ExternalPixelArray::cast(self->elements())-> |
2793 external_pixel_pointer(); | |
2791 } else { | 2794 } else { |
2792 return NULL; | 2795 return NULL; |
2793 } | 2796 } |
2794 } | 2797 } |
2795 | 2798 |
2796 | 2799 |
2797 int v8::Object::GetIndexedPropertiesPixelDataLength() { | 2800 int v8::Object::GetIndexedPropertiesPixelDataLength() { |
2798 ON_BAILOUT("v8::GetIndexedPropertiesPixelDataLength()", return -1); | 2801 ON_BAILOUT("v8::GetIndexedPropertiesPixelDataLength()", return -1); |
2799 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2802 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2800 if (self->HasPixelElements()) { | 2803 if (self->HasExternalPixelElements()) { |
2801 return i::PixelArray::cast(self->elements())->length(); | 2804 return i::ExternalPixelArray::cast(self->elements())->length(); |
2802 } else { | 2805 } else { |
2803 return -1; | 2806 return -1; |
2804 } | 2807 } |
2805 } | 2808 } |
2806 | 2809 |
2807 | 2810 |
2808 void v8::Object::SetIndexedPropertiesToExternalArrayData( | 2811 void v8::Object::SetIndexedPropertiesToExternalArrayData( |
2809 void* data, | 2812 void* data, |
2810 ExternalArrayType array_type, | 2813 ExternalArrayType array_type, |
2811 int length) { | 2814 int length) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2862 case i::EXTERNAL_SHORT_ARRAY_TYPE: | 2865 case i::EXTERNAL_SHORT_ARRAY_TYPE: |
2863 return kExternalShortArray; | 2866 return kExternalShortArray; |
2864 case i::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 2867 case i::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
2865 return kExternalUnsignedShortArray; | 2868 return kExternalUnsignedShortArray; |
2866 case i::EXTERNAL_INT_ARRAY_TYPE: | 2869 case i::EXTERNAL_INT_ARRAY_TYPE: |
2867 return kExternalIntArray; | 2870 return kExternalIntArray; |
2868 case i::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | 2871 case i::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
2869 return kExternalUnsignedIntArray; | 2872 return kExternalUnsignedIntArray; |
2870 case i::EXTERNAL_FLOAT_ARRAY_TYPE: | 2873 case i::EXTERNAL_FLOAT_ARRAY_TYPE: |
2871 return kExternalFloatArray; | 2874 return kExternalFloatArray; |
2875 case i::EXTERNAL_PIXEL_ARRAY_TYPE: | |
2876 return kExternalPixelArray; | |
2872 default: | 2877 default: |
2873 return static_cast<ExternalArrayType>(-1); | 2878 return static_cast<ExternalArrayType>(-1); |
2874 } | 2879 } |
2875 } | 2880 } |
2876 | 2881 |
2877 | 2882 |
2878 int v8::Object::GetIndexedPropertiesExternalArrayDataLength() { | 2883 int v8::Object::GetIndexedPropertiesExternalArrayDataLength() { |
2879 ON_BAILOUT("v8::GetIndexedPropertiesExternalArrayDataLength()", return 0); | 2884 ON_BAILOUT("v8::GetIndexedPropertiesExternalArrayDataLength()", return 0); |
2880 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2885 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2881 if (self->HasExternalArrayElements()) { | 2886 if (self->HasExternalArrayElements()) { |
(...skipping 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5180 | 5185 |
5181 | 5186 |
5182 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5187 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5183 HandleScopeImplementer* thread_local = | 5188 HandleScopeImplementer* thread_local = |
5184 reinterpret_cast<HandleScopeImplementer*>(storage); | 5189 reinterpret_cast<HandleScopeImplementer*>(storage); |
5185 thread_local->IterateThis(v); | 5190 thread_local->IterateThis(v); |
5186 return storage + ArchiveSpacePerThread(); | 5191 return storage + ArchiveSpacePerThread(); |
5187 } | 5192 } |
5188 | 5193 |
5189 } } // namespace v8::internal | 5194 } } // namespace v8::internal |
OLD | NEW |