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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 { | 204 { |
205 // Leaving JavaScript. | 205 // Leaving JavaScript. |
206 VMState state(isolate, EXTERNAL); | 206 VMState state(isolate, EXTERNAL); |
207 result = call_fun(v8::Utils::ToLocal(key), info); | 207 result = call_fun(v8::Utils::ToLocal(key), info); |
208 } | 208 } |
209 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 209 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
210 if (result.IsEmpty()) { | 210 if (result.IsEmpty()) { |
211 return isolate->heap()->undefined_value(); | 211 return isolate->heap()->undefined_value(); |
212 } | 212 } |
213 Object* return_value = *v8::Utils::OpenHandle(*result); | 213 Object* return_value = *v8::Utils::OpenHandle(*result); |
214 #if ENABLE_EXTRA_CHECKS | 214 return_value->VerifyApiCallResultType(); |
215 if (!(return_value->IsSmi() || | |
216 return_value->IsString() || | |
217 return_value->IsSpecObject() || | |
218 return_value->IsHeapNumber() || | |
219 return_value->IsUndefined() || | |
220 return_value->IsTrue() || | |
221 return_value->IsFalse() || | |
222 return_value->IsNull())) { | |
223 FATAL("API call returned invalid object"); | |
224 } | |
225 #endif | |
226 return return_value; | 215 return return_value; |
227 } | 216 } |
228 | 217 |
229 // __defineGetter__ callback | 218 // __defineGetter__ callback |
230 if (structure->IsAccessorPair()) { | 219 if (structure->IsAccessorPair()) { |
231 Object* getter = AccessorPair::cast(structure)->getter(); | 220 Object* getter = AccessorPair::cast(structure)->getter(); |
232 if (getter->IsSpecFunction()) { | 221 if (getter->IsSpecFunction()) { |
233 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 222 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
234 return GetPropertyWithDefinedGetter(receiver, JSReceiver::cast(getter)); | 223 return GetPropertyWithDefinedGetter(receiver, JSReceiver::cast(getter)); |
235 } | 224 } |
(...skipping 3562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3798 v8::AccessorInfo info(args.end()); | 3787 v8::AccessorInfo info(args.end()); |
3799 v8::Handle<v8::Boolean> result; | 3788 v8::Handle<v8::Boolean> result; |
3800 { | 3789 { |
3801 // Leaving JavaScript. | 3790 // Leaving JavaScript. |
3802 VMState state(isolate, EXTERNAL); | 3791 VMState state(isolate, EXTERNAL); |
3803 result = deleter(v8::Utils::ToLocal(name_handle), info); | 3792 result = deleter(v8::Utils::ToLocal(name_handle), info); |
3804 } | 3793 } |
3805 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 3794 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
3806 if (!result.IsEmpty()) { | 3795 if (!result.IsEmpty()) { |
3807 ASSERT(result->IsBoolean()); | 3796 ASSERT(result->IsBoolean()); |
3808 return *v8::Utils::OpenHandle(*result); | 3797 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
| 3798 result_internal->VerifyApiCallResultType(); |
| 3799 return *result_internal; |
3809 } | 3800 } |
3810 } | 3801 } |
3811 MaybeObject* raw_result = | 3802 MaybeObject* raw_result = |
3812 this_handle->DeletePropertyPostInterceptor(*name_handle, NORMAL_DELETION); | 3803 this_handle->DeletePropertyPostInterceptor(*name_handle, NORMAL_DELETION); |
3813 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 3804 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
3814 return raw_result; | 3805 return raw_result; |
3815 } | 3806 } |
3816 | 3807 |
3817 | 3808 |
3818 MaybeObject* JSObject::DeleteElementWithInterceptor(uint32_t index) { | 3809 MaybeObject* JSObject::DeleteElementWithInterceptor(uint32_t index) { |
(...skipping 14 matching lines...) Expand all Loading... |
3833 v8::AccessorInfo info(args.end()); | 3824 v8::AccessorInfo info(args.end()); |
3834 v8::Handle<v8::Boolean> result; | 3825 v8::Handle<v8::Boolean> result; |
3835 { | 3826 { |
3836 // Leaving JavaScript. | 3827 // Leaving JavaScript. |
3837 VMState state(isolate, EXTERNAL); | 3828 VMState state(isolate, EXTERNAL); |
3838 result = deleter(index, info); | 3829 result = deleter(index, info); |
3839 } | 3830 } |
3840 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 3831 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
3841 if (!result.IsEmpty()) { | 3832 if (!result.IsEmpty()) { |
3842 ASSERT(result->IsBoolean()); | 3833 ASSERT(result->IsBoolean()); |
3843 return *v8::Utils::OpenHandle(*result); | 3834 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
| 3835 result_internal->VerifyApiCallResultType(); |
| 3836 return *result_internal; |
3844 } | 3837 } |
3845 MaybeObject* raw_result = this_handle->GetElementsAccessor()->Delete( | 3838 MaybeObject* raw_result = this_handle->GetElementsAccessor()->Delete( |
3846 *this_handle, | 3839 *this_handle, |
3847 index, | 3840 index, |
3848 NORMAL_DELETION); | 3841 NORMAL_DELETION); |
3849 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 3842 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
3850 return raw_result; | 3843 return raw_result; |
3851 } | 3844 } |
3852 | 3845 |
3853 | 3846 |
(...skipping 5272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9126 CustomArguments args(isolate, data->data(), *self, *holder_handle); | 9119 CustomArguments args(isolate, data->data(), *self, *holder_handle); |
9127 v8::AccessorInfo info(args.end()); | 9120 v8::AccessorInfo info(args.end()); |
9128 v8::Handle<v8::Value> result; | 9121 v8::Handle<v8::Value> result; |
9129 { | 9122 { |
9130 // Leaving JavaScript. | 9123 // Leaving JavaScript. |
9131 VMState state(isolate, EXTERNAL); | 9124 VMState state(isolate, EXTERNAL); |
9132 result = call_fun(v8::Utils::ToLocal(key), info); | 9125 result = call_fun(v8::Utils::ToLocal(key), info); |
9133 } | 9126 } |
9134 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 9127 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
9135 if (result.IsEmpty()) return isolate->heap()->undefined_value(); | 9128 if (result.IsEmpty()) return isolate->heap()->undefined_value(); |
9136 return *v8::Utils::OpenHandle(*result); | 9129 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
| 9130 result_internal->VerifyApiCallResultType(); |
| 9131 return *result_internal; |
9137 } | 9132 } |
9138 | 9133 |
9139 // __defineGetter__ callback | 9134 // __defineGetter__ callback |
9140 if (structure->IsAccessorPair()) { | 9135 if (structure->IsAccessorPair()) { |
9141 Object* getter = AccessorPair::cast(structure)->getter(); | 9136 Object* getter = AccessorPair::cast(structure)->getter(); |
9142 if (getter->IsSpecFunction()) { | 9137 if (getter->IsSpecFunction()) { |
9143 // TODO(rossberg): nicer would be to cast to some JSCallable here... | 9138 // TODO(rossberg): nicer would be to cast to some JSCallable here... |
9144 return GetPropertyWithDefinedGetter(receiver, JSReceiver::cast(getter)); | 9139 return GetPropertyWithDefinedGetter(receiver, JSReceiver::cast(getter)); |
9145 } | 9140 } |
9146 // Getter is not a function. | 9141 // Getter is not a function. |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9945 ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); | 9940 ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); |
9946 CustomArguments args(isolate, interceptor->data(), receiver, this); | 9941 CustomArguments args(isolate, interceptor->data(), receiver, this); |
9947 v8::AccessorInfo info(args.end()); | 9942 v8::AccessorInfo info(args.end()); |
9948 v8::Handle<v8::Value> result; | 9943 v8::Handle<v8::Value> result; |
9949 { | 9944 { |
9950 // Leaving JavaScript. | 9945 // Leaving JavaScript. |
9951 VMState state(isolate, EXTERNAL); | 9946 VMState state(isolate, EXTERNAL); |
9952 result = getter(index, info); | 9947 result = getter(index, info); |
9953 } | 9948 } |
9954 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 9949 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
9955 if (!result.IsEmpty()) return *v8::Utils::OpenHandle(*result); | 9950 if (!result.IsEmpty()) { |
| 9951 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
| 9952 result_internal->VerifyApiCallResultType(); |
| 9953 return *result_internal; |
| 9954 } |
9956 } | 9955 } |
9957 | 9956 |
9958 Heap* heap = holder_handle->GetHeap(); | 9957 Heap* heap = holder_handle->GetHeap(); |
9959 ElementsAccessor* handler = holder_handle->GetElementsAccessor(); | 9958 ElementsAccessor* handler = holder_handle->GetElementsAccessor(); |
9960 MaybeObject* raw_result = handler->Get(*this_handle, | 9959 MaybeObject* raw_result = handler->Get(*this_handle, |
9961 *holder_handle, | 9960 *holder_handle, |
9962 index); | 9961 index); |
9963 if (raw_result != heap->the_hole_value()) return raw_result; | 9962 if (raw_result != heap->the_hole_value()) return raw_result; |
9964 | 9963 |
9965 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 9964 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10247 v8::AccessorInfo info(args.end()); | 10246 v8::AccessorInfo info(args.end()); |
10248 v8::Handle<v8::Value> result; | 10247 v8::Handle<v8::Value> result; |
10249 { | 10248 { |
10250 // Leaving JavaScript. | 10249 // Leaving JavaScript. |
10251 VMState state(isolate, EXTERNAL); | 10250 VMState state(isolate, EXTERNAL); |
10252 result = getter(v8::Utils::ToLocal(name_handle), info); | 10251 result = getter(v8::Utils::ToLocal(name_handle), info); |
10253 } | 10252 } |
10254 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 10253 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
10255 if (!result.IsEmpty()) { | 10254 if (!result.IsEmpty()) { |
10256 *attributes = NONE; | 10255 *attributes = NONE; |
10257 return *v8::Utils::OpenHandle(*result); | 10256 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
| 10257 result_internal->VerifyApiCallResultType(); |
| 10258 return *result_internal; |
10258 } | 10259 } |
10259 } | 10260 } |
10260 | 10261 |
10261 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( | 10262 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( |
10262 *receiver_handle, | 10263 *receiver_handle, |
10263 *name_handle, | 10264 *name_handle, |
10264 attributes); | 10265 attributes); |
10265 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 10266 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
10266 return result; | 10267 return result; |
10267 } | 10268 } |
(...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13211 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13212 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13212 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13213 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13213 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13214 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13214 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13215 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13215 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13216 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13216 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13217 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13217 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13218 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13218 } | 13219 } |
13219 | 13220 |
13220 } } // namespace v8::internal | 13221 } } // namespace v8::internal |
OLD | NEW |