OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 if (!ApiCheck(!self->IsJSArray(), | 2606 if (!ApiCheck(!self->IsJSArray(), |
2607 "v8::Object::SetIndexedPropertiesToPixelData()", | 2607 "v8::Object::SetIndexedPropertiesToPixelData()", |
2608 "JSArray is not supported")) { | 2608 "JSArray is not supported")) { |
2609 return; | 2609 return; |
2610 } | 2610 } |
2611 i::Handle<i::PixelArray> pixels = i::Factory::NewPixelArray(length, data); | 2611 i::Handle<i::PixelArray> pixels = i::Factory::NewPixelArray(length, data); |
2612 self->set_elements(*pixels); | 2612 self->set_elements(*pixels); |
2613 } | 2613 } |
2614 | 2614 |
2615 | 2615 |
| 2616 bool v8::Object::HasIndexedPropertiesInPixelData() { |
| 2617 ON_BAILOUT("v8::HasIndexedPropertiesInPixelData()", return false); |
| 2618 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2619 return self->HasPixelElements(); |
| 2620 } |
| 2621 |
| 2622 |
| 2623 uint8_t* v8::Object::GetIndexedPropertiesPixelData() { |
| 2624 ON_BAILOUT("v8::GetIndexedPropertiesPixelData()", return NULL); |
| 2625 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2626 if (self->HasPixelElements()) { |
| 2627 return i::PixelArray::cast(self->elements())->external_pointer(); |
| 2628 } else { |
| 2629 return NULL; |
| 2630 } |
| 2631 } |
| 2632 |
| 2633 |
| 2634 int v8::Object::GetIndexedPropertiesPixelDataLength() { |
| 2635 ON_BAILOUT("v8::GetIndexedPropertiesPixelDataLength()", return -1); |
| 2636 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2637 if (self->HasPixelElements()) { |
| 2638 return i::PixelArray::cast(self->elements())->length(); |
| 2639 } else { |
| 2640 return -1; |
| 2641 } |
| 2642 } |
| 2643 |
| 2644 |
2616 void v8::Object::SetIndexedPropertiesToExternalArrayData( | 2645 void v8::Object::SetIndexedPropertiesToExternalArrayData( |
2617 void* data, | 2646 void* data, |
2618 ExternalArrayType array_type, | 2647 ExternalArrayType array_type, |
2619 int length) { | 2648 int length) { |
2620 ON_BAILOUT("v8::SetIndexedPropertiesToExternalArrayData()", return); | 2649 ON_BAILOUT("v8::SetIndexedPropertiesToExternalArrayData()", return); |
2621 ENTER_V8; | 2650 ENTER_V8; |
2622 HandleScope scope; | 2651 HandleScope scope; |
2623 if (!ApiCheck(length <= i::ExternalArray::kMaxLength, | 2652 if (!ApiCheck(length <= i::ExternalArray::kMaxLength, |
2624 "v8::Object::SetIndexedPropertiesToExternalArrayData()", | 2653 "v8::Object::SetIndexedPropertiesToExternalArrayData()", |
2625 "length exceeds max acceptable value")) { | 2654 "length exceeds max acceptable value")) { |
2626 return; | 2655 return; |
2627 } | 2656 } |
2628 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2657 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2629 if (!ApiCheck(!self->IsJSArray(), | 2658 if (!ApiCheck(!self->IsJSArray(), |
2630 "v8::Object::SetIndexedPropertiesToExternalArrayData()", | 2659 "v8::Object::SetIndexedPropertiesToExternalArrayData()", |
2631 "JSArray is not supported")) { | 2660 "JSArray is not supported")) { |
2632 return; | 2661 return; |
2633 } | 2662 } |
2634 i::Handle<i::ExternalArray> array = | 2663 i::Handle<i::ExternalArray> array = |
2635 i::Factory::NewExternalArray(length, array_type, data); | 2664 i::Factory::NewExternalArray(length, array_type, data); |
2636 self->set_elements(*array); | 2665 self->set_elements(*array); |
2637 } | 2666 } |
2638 | 2667 |
2639 | 2668 |
| 2669 bool v8::Object::HasIndexedPropertiesInExternalArrayData() { |
| 2670 ON_BAILOUT("v8::HasIndexedPropertiesInExternalArrayData()", return false); |
| 2671 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2672 return self->HasExternalArrayElements(); |
| 2673 } |
| 2674 |
| 2675 |
| 2676 void* v8::Object::GetIndexedPropertiesExternalArrayData() { |
| 2677 ON_BAILOUT("v8::GetIndexedPropertiesExternalArrayData()", return NULL); |
| 2678 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2679 if (self->HasExternalArrayElements()) { |
| 2680 return i::ExternalArray::cast(self->elements())->external_pointer(); |
| 2681 } else { |
| 2682 return NULL; |
| 2683 } |
| 2684 } |
| 2685 |
| 2686 |
| 2687 ExternalArrayType v8::Object::GetIndexedPropertiesExternalArrayDataType() { |
| 2688 ON_BAILOUT("v8::GetIndexedPropertiesExternalArrayDataType()", |
| 2689 return static_cast<ExternalArrayType>(-1)); |
| 2690 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2691 switch (self->elements()->map()->instance_type()) { |
| 2692 case i::EXTERNAL_BYTE_ARRAY_TYPE: |
| 2693 return kExternalByteArray; |
| 2694 case i::EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 2695 return kExternalUnsignedByteArray; |
| 2696 case i::EXTERNAL_SHORT_ARRAY_TYPE: |
| 2697 return kExternalShortArray; |
| 2698 case i::EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
| 2699 return kExternalUnsignedShortArray; |
| 2700 case i::EXTERNAL_INT_ARRAY_TYPE: |
| 2701 return kExternalIntArray; |
| 2702 case i::EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
| 2703 return kExternalUnsignedIntArray; |
| 2704 case i::EXTERNAL_FLOAT_ARRAY_TYPE: |
| 2705 return kExternalFloatArray; |
| 2706 default: |
| 2707 return static_cast<ExternalArrayType>(-1); |
| 2708 } |
| 2709 } |
| 2710 |
| 2711 |
| 2712 int v8::Object::GetIndexedPropertiesExternalArrayDataLength() { |
| 2713 ON_BAILOUT("v8::GetIndexedPropertiesExternalArrayDataLength()", return 0); |
| 2714 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2715 if (self->HasExternalArrayElements()) { |
| 2716 return i::ExternalArray::cast(self->elements())->length(); |
| 2717 } else { |
| 2718 return -1; |
| 2719 } |
| 2720 } |
| 2721 |
| 2722 |
2640 Local<v8::Object> Function::NewInstance() const { | 2723 Local<v8::Object> Function::NewInstance() const { |
2641 return NewInstance(0, NULL); | 2724 return NewInstance(0, NULL); |
2642 } | 2725 } |
2643 | 2726 |
2644 | 2727 |
2645 Local<v8::Object> Function::NewInstance(int argc, | 2728 Local<v8::Object> Function::NewInstance(int argc, |
2646 v8::Handle<v8::Value> argv[]) const { | 2729 v8::Handle<v8::Value> argv[]) const { |
2647 ON_BAILOUT("v8::Function::NewInstance()", return Local<v8::Object>()); | 2730 ON_BAILOUT("v8::Function::NewInstance()", return Local<v8::Object>()); |
2648 LOG_API("Function::NewInstance"); | 2731 LOG_API("Function::NewInstance"); |
2649 ENTER_V8; | 2732 ENTER_V8; |
(...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4442 | 4525 |
4443 | 4526 |
4444 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 4527 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
4445 HandleScopeImplementer* thread_local = | 4528 HandleScopeImplementer* thread_local = |
4446 reinterpret_cast<HandleScopeImplementer*>(storage); | 4529 reinterpret_cast<HandleScopeImplementer*>(storage); |
4447 thread_local->IterateThis(v); | 4530 thread_local->IterateThis(v); |
4448 return storage + ArchiveSpacePerThread(); | 4531 return storage + ArchiveSpacePerThread(); |
4449 } | 4532 } |
4450 | 4533 |
4451 } } // namespace v8::internal | 4534 } } // namespace v8::internal |
OLD | NEW |