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

Unified Diff: src/builtins/builtins-callsite.cc

Issue 2199673002: Properly set function index in CallSite constructor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove tests passing invalid parameters to the callsite constructor Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/callsite.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-callsite.cc
diff --git a/src/builtins/builtins-callsite.cc b/src/builtins/builtins-callsite.cc
index 2038f28f680aa215f15d220e44dcc1f6849f2a7a..c2cd22f09077781237370751406ccd930965ccd1 100644
--- a/src/builtins/builtins-callsite.cc
+++ b/src/builtins/builtins-callsite.cc
@@ -58,12 +58,11 @@ BUILTIN(CallSiteConstructor) {
}
if (is_wasm_object) {
- DCHECK(!fun->IsJSFunction());
- SET_CALLSITE_PROPERTY(obj, call_site_wasm_obj_symbol, receiver);
+ DCHECK(fun->IsSmi());
+ DCHECK(wasm::GetNumberOfFunctions(JSObject::cast(*receiver)) >
+ Smi::cast(*fun)->value());
- Handle<Object> fun_index;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, fun_index,
- Object::ToUint32(isolate, fun));
+ SET_CALLSITE_PROPERTY(obj, call_site_wasm_obj_symbol, receiver);
SET_CALLSITE_PROPERTY(obj, call_site_wasm_func_index_symbol, fun);
} else {
DCHECK(fun->IsJSFunction());
@@ -71,10 +70,8 @@ BUILTIN(CallSiteConstructor) {
SET_CALLSITE_PROPERTY(obj, call_site_function_symbol, fun);
}
- Handle<Object> pos_int32;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, pos_int32,
- Object::ToInt32(isolate, pos));
- SET_CALLSITE_PROPERTY(obj, call_site_position_symbol, pos_int32);
+ DCHECK(pos->IsSmi());
+ SET_CALLSITE_PROPERTY(obj, call_site_position_symbol, pos);
SET_CALLSITE_PROPERTY(
obj, call_site_strict_symbol,
isolate->factory()->ToBoolean(strict_mode->BooleanValue()));
« no previous file with comments | « no previous file | test/mjsunit/callsite.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698