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

Side by Side Diff: src/builtins.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 | « no previous file | src/handles.cc » ('j') | 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 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 // Leaving JavaScript. 1142 // Leaving JavaScript.
1143 VMState state(isolate, EXTERNAL); 1143 VMState state(isolate, EXTERNAL);
1144 ExternalCallbackScope call_scope(isolate, 1144 ExternalCallbackScope call_scope(isolate,
1145 v8::ToCData<Address>(callback_obj)); 1145 v8::ToCData<Address>(callback_obj));
1146 value = callback(new_args); 1146 value = callback(new_args);
1147 } 1147 }
1148 if (value.IsEmpty()) { 1148 if (value.IsEmpty()) {
1149 result = heap->undefined_value(); 1149 result = heap->undefined_value();
1150 } else { 1150 } else {
1151 result = *reinterpret_cast<Object**>(*value); 1151 result = *reinterpret_cast<Object**>(*value);
1152 result->VerifyApiCallResultType();
1152 } 1153 }
1153 1154
1154 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1155 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1155 if (!is_construct || result->IsJSObject()) return result; 1156 if (!is_construct || result->IsJSObject()) return result;
1156 } 1157 }
1157 1158
1158 return *args.receiver(); 1159 return *args.receiver();
1159 } 1160 }
1160 1161
1161 1162
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 // Leaving JavaScript. 1219 // Leaving JavaScript.
1219 VMState state(isolate, EXTERNAL); 1220 VMState state(isolate, EXTERNAL);
1220 ExternalCallbackScope call_scope(isolate, 1221 ExternalCallbackScope call_scope(isolate,
1221 v8::ToCData<Address>(callback_obj)); 1222 v8::ToCData<Address>(callback_obj));
1222 value = callback(new_args); 1223 value = callback(new_args);
1223 } 1224 }
1224 if (value.IsEmpty()) { 1225 if (value.IsEmpty()) {
1225 result = heap->undefined_value(); 1226 result = heap->undefined_value();
1226 } else { 1227 } else {
1227 result = *reinterpret_cast<Object**>(*value); 1228 result = *reinterpret_cast<Object**>(*value);
1229 result->VerifyApiCallResultType();
1228 } 1230 }
1229 } 1231 }
1230 // Check for exceptions and return result. 1232 // Check for exceptions and return result.
1231 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 1233 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
1232 return result; 1234 return result;
1233 } 1235 }
1234 1236
1235 1237
1236 // Handle calls to non-function objects created through the API. This delegate 1238 // Handle calls to non-function objects created through the API. This delegate
1237 // function is used when the call is a normal function call. 1239 // function is used when the call is a normal function call.
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 return Handle<Code>(code_address); \ 1716 return Handle<Code>(code_address); \
1715 } 1717 }
1716 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1718 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1717 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1719 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1718 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1720 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1719 #undef DEFINE_BUILTIN_ACCESSOR_C 1721 #undef DEFINE_BUILTIN_ACCESSOR_C
1720 #undef DEFINE_BUILTIN_ACCESSOR_A 1722 #undef DEFINE_BUILTIN_ACCESSOR_A
1721 1723
1722 1724
1723 } } // namespace v8::internal 1725 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698