Chromium Code Reviews| 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(); |