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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 i::Factory::NewStruct(i::CALL_HANDLER_INFO_TYPE); | 769 i::Factory::NewStruct(i::CALL_HANDLER_INFO_TYPE); |
770 i::Handle<i::CallHandlerInfo> obj = | 770 i::Handle<i::CallHandlerInfo> obj = |
771 i::Handle<i::CallHandlerInfo>::cast(struct_obj); | 771 i::Handle<i::CallHandlerInfo>::cast(struct_obj); |
772 obj->set_callback(*FromCData(callback)); | 772 obj->set_callback(*FromCData(callback)); |
773 if (data.IsEmpty()) data = v8::Undefined(); | 773 if (data.IsEmpty()) data = v8::Undefined(); |
774 obj->set_data(*Utils::OpenHandle(*data)); | 774 obj->set_data(*Utils::OpenHandle(*data)); |
775 Utils::OpenHandle(this)->set_call_code(*obj); | 775 Utils::OpenHandle(this)->set_call_code(*obj); |
776 } | 776 } |
777 | 777 |
778 | 778 |
779 void FunctionTemplate::AddInstancePropertyAccessor( | 779 static i::Handle<i::AccessorInfo> MakeAccessorInfo( |
780 v8::Handle<String> name, | 780 v8::Handle<String> name, |
781 AccessorGetter getter, | 781 AccessorGetter getter, |
782 AccessorSetter setter, | 782 AccessorSetter setter, |
783 v8::Handle<Value> data, | 783 v8::Handle<Value> data, |
784 v8::AccessControl settings, | 784 v8::AccessControl settings, |
785 v8::PropertyAttribute attributes) { | 785 v8::PropertyAttribute attributes) { |
786 if (IsDeadCheck("v8::FunctionTemplate::AddInstancePropertyAccessor()")) { | |
787 return; | |
788 } | |
789 ENTER_V8; | |
790 HandleScope scope; | |
791 i::Handle<i::AccessorInfo> obj = i::Factory::NewAccessorInfo(); | 786 i::Handle<i::AccessorInfo> obj = i::Factory::NewAccessorInfo(); |
792 ASSERT(getter != NULL); | 787 ASSERT(getter != NULL); |
793 obj->set_getter(*FromCData(getter)); | 788 obj->set_getter(*FromCData(getter)); |
794 obj->set_setter(*FromCData(setter)); | 789 obj->set_setter(*FromCData(setter)); |
795 if (data.IsEmpty()) data = v8::Undefined(); | 790 if (data.IsEmpty()) data = v8::Undefined(); |
796 obj->set_data(*Utils::OpenHandle(*data)); | 791 obj->set_data(*Utils::OpenHandle(*data)); |
797 obj->set_name(*Utils::OpenHandle(*name)); | 792 obj->set_name(*Utils::OpenHandle(*name)); |
798 if (settings & ALL_CAN_READ) obj->set_all_can_read(true); | 793 if (settings & ALL_CAN_READ) obj->set_all_can_read(true); |
799 if (settings & ALL_CAN_WRITE) obj->set_all_can_write(true); | 794 if (settings & ALL_CAN_WRITE) obj->set_all_can_write(true); |
800 if (settings & PROHIBITS_OVERWRITING) obj->set_prohibits_overwriting(true); | 795 if (settings & PROHIBITS_OVERWRITING) obj->set_prohibits_overwriting(true); |
801 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes)); | 796 obj->set_property_attributes(static_cast<PropertyAttributes>(attributes)); |
| 797 return obj; |
| 798 } |
802 | 799 |
| 800 |
| 801 void FunctionTemplate::AddInstancePropertyAccessor( |
| 802 v8::Handle<String> name, |
| 803 AccessorGetter getter, |
| 804 AccessorSetter setter, |
| 805 v8::Handle<Value> data, |
| 806 v8::AccessControl settings, |
| 807 v8::PropertyAttribute attributes) { |
| 808 if (IsDeadCheck("v8::FunctionTemplate::AddInstancePropertyAccessor()")) { |
| 809 return; |
| 810 } |
| 811 ENTER_V8; |
| 812 HandleScope scope; |
| 813 |
| 814 i::Handle<i::AccessorInfo> obj = MakeAccessorInfo(name, |
| 815 getter, setter, data, |
| 816 settings, attributes); |
803 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors()); | 817 i::Handle<i::Object> list(Utils::OpenHandle(this)->property_accessors()); |
804 if (list->IsUndefined()) { | 818 if (list->IsUndefined()) { |
805 list = NeanderArray().value(); | 819 list = NeanderArray().value(); |
806 Utils::OpenHandle(this)->set_property_accessors(*list); | 820 Utils::OpenHandle(this)->set_property_accessors(*list); |
807 } | 821 } |
808 NeanderArray array(list); | 822 NeanderArray array(list); |
809 array.add(obj); | 823 array.add(obj); |
810 } | 824 } |
811 | 825 |
812 | 826 |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2347 } | 2361 } |
2348 | 2362 |
2349 | 2363 |
2350 bool v8::Object::Has(uint32_t index) { | 2364 bool v8::Object::Has(uint32_t index) { |
2351 ON_BAILOUT("v8::Object::HasProperty()", return false); | 2365 ON_BAILOUT("v8::Object::HasProperty()", return false); |
2352 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2366 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2353 return self->HasElement(index); | 2367 return self->HasElement(index); |
2354 } | 2368 } |
2355 | 2369 |
2356 | 2370 |
| 2371 bool Object::SetAccessor(Handle<String> name, |
| 2372 AccessorGetter getter, |
| 2373 AccessorSetter setter, |
| 2374 v8::Handle<Value> data, |
| 2375 AccessControl settings, |
| 2376 PropertyAttribute attributes) { |
| 2377 ON_BAILOUT("v8::Object::SetAccessor()", return false); |
| 2378 ENTER_V8; |
| 2379 HandleScope scope; |
| 2380 i::Handle<i::AccessorInfo> info = MakeAccessorInfo(name, |
| 2381 getter, setter, data, |
| 2382 settings, attributes); |
| 2383 i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this), info); |
| 2384 return !result.is_null() && !result->IsUndefined(); |
| 2385 } |
| 2386 |
| 2387 |
2357 bool v8::Object::HasRealNamedProperty(Handle<String> key) { | 2388 bool v8::Object::HasRealNamedProperty(Handle<String> key) { |
2358 ON_BAILOUT("v8::Object::HasRealNamedProperty()", return false); | 2389 ON_BAILOUT("v8::Object::HasRealNamedProperty()", return false); |
2359 return Utils::OpenHandle(this)->HasRealNamedProperty( | 2390 return Utils::OpenHandle(this)->HasRealNamedProperty( |
2360 *Utils::OpenHandle(*key)); | 2391 *Utils::OpenHandle(*key)); |
2361 } | 2392 } |
2362 | 2393 |
2363 | 2394 |
2364 bool v8::Object::HasRealIndexedProperty(uint32_t index) { | 2395 bool v8::Object::HasRealIndexedProperty(uint32_t index) { |
2365 ON_BAILOUT("v8::Object::HasRealIndexedProperty()", return false); | 2396 ON_BAILOUT("v8::Object::HasRealIndexedProperty()", return false); |
2366 return Utils::OpenHandle(this)->HasRealElementProperty(index); | 2397 return Utils::OpenHandle(this)->HasRealElementProperty(index); |
(...skipping 1986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4353 | 4384 |
4354 | 4385 |
4355 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 4386 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
4356 HandleScopeImplementer* thread_local = | 4387 HandleScopeImplementer* thread_local = |
4357 reinterpret_cast<HandleScopeImplementer*>(storage); | 4388 reinterpret_cast<HandleScopeImplementer*>(storage); |
4358 thread_local->IterateThis(v); | 4389 thread_local->IterateThis(v); |
4359 return storage + ArchiveSpacePerThread(); | 4390 return storage + ArchiveSpacePerThread(); |
4360 } | 4391 } |
4361 | 4392 |
4362 } } // namespace v8::internal | 4393 } } // namespace v8::internal |
OLD | NEW |