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

Unified Diff: src/api.cc

Issue 2772093002: [inspector] exposed builtins for injected script source (Closed)
Patch Set: Created 3 years, 9 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 | src/debug/debug-interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 7e699f4595adae04745f07746f7918dba31aeb25..744c20f6029b852d6f88355829b84cf03ad75fec 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -9556,6 +9556,40 @@ v8::MaybeLocal<v8::Array> debug::EntriesPreview(Isolate* v8_isolate,
return v8::MaybeLocal<v8::Array>();
}
+Local<Function> debug::GetBuiltin(Isolate* v8_isolate, Builtin builtin) {
+ i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
+ ENTER_V8(isolate);
+ i::HandleScope handle_scope(isolate);
+ i::Builtins::Name name;
+ int len = 1;
+ switch (builtin) {
+ case kObjectKeys:
+ name = i::Builtins::kObjectKeys;
+ break;
+ case kObjectGetPrototypeOf:
+ name = i::Builtins::kObjectGetPrototypeOf;
+ break;
+ case kObjectGetOwnPropertyDescriptor:
+ name = i::Builtins::kObjectGetOwnPropertyDescriptor;
+ len = 2;
+ break;
+ case kObjectGetOwnPropertyNames:
+ name = i::Builtins::kObjectGetOwnPropertyNames;
+ break;
+ case kObjectGetOwnPropertySymbols:
+ name = i::Builtins::kObjectGetOwnPropertySymbols;
+ break;
+ }
+ i::Handle<i::Code> call_code(isolate->builtins()->builtin(name));
+ i::Handle<i::JSFunction> fun =
+ isolate->factory()->NewFunctionWithoutPrototype(
+ isolate->factory()->empty_string(), call_code, false);
+ fun->shared()->set_native(true);
Yang 2017/03/24 21:19:31 No need to set this native. We only need this for
kozy 2017/03/24 21:39:55 Done.
+ fun->shared()->DontAdaptArguments();
+ fun->shared()->set_length(len);
Yang 2017/03/24 21:19:31 Also no need to set length, I think.
kozy 2017/03/24 21:39:55 Done.
+ return Utils::ToLocal(handle_scope.CloseAndEscape(fun));
+}
+
MaybeLocal<debug::Script> debug::GeneratorObject::Script() {
i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this);
i::Object* maybe_script = obj->function()->shared()->script();
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698