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

Unified Diff: src/messages.cc

Issue 2201823002: Make CallSite constructor inaccessible from JS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@get-stack-trace-line
Patch Set: Fix Error.prepareStackTrace test Created 4 years, 4 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
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index 3fc73eb18dc33c790632812e7a963589275f6a53..176b28d40e2ec280553eb24dab17da9218fefd9b 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -509,9 +509,6 @@ MaybeHandle<FixedArray> GetStackFrames(Isolate* isolate,
FixedArray::get(*raw_stack_elements, 0, isolate);
int sloppy_frames = Handle<Smi>::cast(sloppy_frames_obj)->value();
- Handle<JSFunction> callsite_ctor =
- handle(isolate->native_context()->callsite_function(), isolate);
-
int dst_ix = 0;
Handle<FixedArray> frames = isolate->factory()->NewFixedArray(frame_count);
for (int i = 1; i < raw_stack_len; i += 4) {
@@ -533,9 +530,7 @@ MaybeHandle<FixedArray> GetStackFrames(Isolate* isolate,
Handle<Object> callsite;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, callsite,
- CallSiteUtils::Construct(isolate, callsite_ctor, callsite_ctor, recv,
- fun, pos, strict),
- FixedArray);
+ CallSiteUtils::Construct(isolate, recv, fun, pos, strict), FixedArray);
frames->set(dst_ix++, *callsite);
}
@@ -889,19 +884,19 @@ MaybeHandle<String> ErrorUtils::ToString(Isolate* isolate,
target, isolate->factory()->key(), value, DONT_ENUM), \
Object)
-MaybeHandle<Object> CallSiteUtils::Construct(
- Isolate* isolate, Handle<JSFunction> target, Handle<Object> new_target,
- Handle<Object> receiver, Handle<Object> fun, Handle<Object> pos,
- Handle<Object> strict_mode) {
+MaybeHandle<Object> CallSiteUtils::Construct(Isolate* isolate,
+ Handle<Object> receiver,
+ Handle<Object> fun,
+ Handle<Object> pos,
+ Handle<Object> strict_mode) {
// Create the JS object.
- Handle<JSReceiver> new_target_recv =
- new_target->IsJSReceiver() ? Handle<JSReceiver>::cast(new_target)
- : Handle<JSReceiver>::cast(target);
+ Handle<JSFunction> target =
+ handle(isolate->native_context()->callsite_function(), isolate);
Handle<JSObject> obj;
- ASSIGN_RETURN_ON_EXCEPTION(isolate, obj,
- JSObject::New(target, new_target_recv), Object);
+ ASSIGN_RETURN_ON_EXCEPTION(isolate, obj, JSObject::New(target, target),
+ Object);
// For wasm frames, receiver is the wasm object and fun is the function index
// instead of an actual function.
« no previous file with comments | « src/messages.h ('k') | test/mjsunit/stack-traces.js » ('j') | test/mjsunit/stack-traces.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698