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

Side by Side Diff: src/stub-cache.cc

Issue 10928083: Add more checks for native callback results. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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/objects-inl.h ('k') | no next file » | 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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 HandleScope scope(isolate); 998 HandleScope scope(isolate);
999 v8::Handle<v8::Value> result; 999 v8::Handle<v8::Value> result;
1000 { 1000 {
1001 // Leaving JavaScript. 1001 // Leaving JavaScript.
1002 VMState state(isolate, EXTERNAL); 1002 VMState state(isolate, EXTERNAL);
1003 ExternalCallbackScope call_scope(isolate, getter_address); 1003 ExternalCallbackScope call_scope(isolate, getter_address);
1004 result = fun(v8::Utils::ToLocal(args.at<String>(5)), info); 1004 result = fun(v8::Utils::ToLocal(args.at<String>(5)), info);
1005 } 1005 }
1006 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1006 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1007 if (result.IsEmpty()) return HEAP->undefined_value(); 1007 if (result.IsEmpty()) return HEAP->undefined_value();
1008 return *v8::Utils::OpenHandle(*result); 1008 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
1009 result_internal->VerifyApiCallResultType();
1010 return *result_internal;
1009 } 1011 }
1010 1012
1011 1013
1012 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { 1014 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) {
1013 JSObject* recv = JSObject::cast(args[0]); 1015 JSObject* recv = JSObject::cast(args[0]);
1014 AccessorInfo* callback = AccessorInfo::cast(args[1]); 1016 AccessorInfo* callback = AccessorInfo::cast(args[1]);
1015 Address setter_address = v8::ToCData<Address>(callback->setter()); 1017 Address setter_address = v8::ToCData<Address>(callback->setter());
1016 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); 1018 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address);
1017 ASSERT(fun != NULL); 1019 ASSERT(fun != NULL);
1018 ASSERT(callback->IsCompatibleReceiver(recv)); 1020 ASSERT(callback->IsCompatibleReceiver(recv));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 kAccessorInfoOffsetInInterceptorArgs); 1065 kAccessorInfoOffsetInInterceptorArgs);
1064 HandleScope scope(isolate); 1066 HandleScope scope(isolate);
1065 v8::Handle<v8::Value> r; 1067 v8::Handle<v8::Value> r;
1066 { 1068 {
1067 // Leaving JavaScript. 1069 // Leaving JavaScript.
1068 VMState state(isolate, EXTERNAL); 1070 VMState state(isolate, EXTERNAL);
1069 r = getter(v8::Utils::ToLocal(name_handle), info); 1071 r = getter(v8::Utils::ToLocal(name_handle), info);
1070 } 1072 }
1071 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1073 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1072 if (!r.IsEmpty()) { 1074 if (!r.IsEmpty()) {
1075 Handle<Object> result = v8::Utils::OpenHandle(*r);
1076 result->VerifyApiCallResultType();
1073 return *v8::Utils::OpenHandle(*r); 1077 return *v8::Utils::OpenHandle(*r);
1074 } 1078 }
1075 } 1079 }
1076 1080
1077 return isolate->heap()->no_interceptor_result_sentinel(); 1081 return isolate->heap()->no_interceptor_result_sentinel();
1078 } 1082 }
1079 1083
1080 1084
1081 static MaybeObject* ThrowReferenceError(String* name) { 1085 static MaybeObject* ThrowReferenceError(String* name) {
1082 // If the load is non-contextual, just return the undefined result. 1086 // If the load is non-contextual, just return the undefined result.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 HandleScope scope(isolate); 1123 HandleScope scope(isolate);
1120 v8::Handle<v8::Value> r; 1124 v8::Handle<v8::Value> r;
1121 { 1125 {
1122 // Leaving JavaScript. 1126 // Leaving JavaScript.
1123 VMState state(isolate, EXTERNAL); 1127 VMState state(isolate, EXTERNAL);
1124 r = getter(v8::Utils::ToLocal(name_handle), info); 1128 r = getter(v8::Utils::ToLocal(name_handle), info);
1125 } 1129 }
1126 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1130 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1127 if (!r.IsEmpty()) { 1131 if (!r.IsEmpty()) {
1128 *attrs = NONE; 1132 *attrs = NONE;
1129 return *v8::Utils::OpenHandle(*r); 1133 Handle<Object> result = v8::Utils::OpenHandle(*r);
1134 result->VerifyApiCallResultType();
1135 return *result;
1130 } 1136 }
1131 } 1137 }
1132 1138
1133 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( 1139 MaybeObject* result = holder_handle->GetPropertyPostInterceptor(
1134 *receiver_handle, 1140 *receiver_handle,
1135 *name_handle, 1141 *name_handle,
1136 attrs); 1142 attrs);
1137 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1143 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1138 return result; 1144 return result;
1139 } 1145 }
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 Handle<FunctionTemplateInfo>( 1581 Handle<FunctionTemplateInfo>(
1576 FunctionTemplateInfo::cast(signature->receiver())); 1582 FunctionTemplateInfo::cast(signature->receiver()));
1577 } 1583 }
1578 } 1584 }
1579 1585
1580 is_simple_api_call_ = true; 1586 is_simple_api_call_ = true;
1581 } 1587 }
1582 1588
1583 1589
1584 } } // namespace v8::internal 1590 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698