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

Side by Side Diff: src/api.cc

Issue 2772093002: [inspector] exposed builtins for injected script source (Closed)
Patch Set: removed unused variable 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/debug/debug-interface.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 9550 matching lines...) Expand 10 before | Expand all | Expand 10 after
9561 if (object->IsJSSetIterator()) { 9561 if (object->IsJSSetIterator()) {
9562 i::Handle<i::JSSetIterator> it = i::Handle<i::JSSetIterator>::cast(object); 9562 i::Handle<i::JSSetIterator> it = i::Handle<i::JSSetIterator>::cast(object);
9563 *is_key_value = false; 9563 *is_key_value = false;
9564 if (!it->HasMore()) return v8::Array::New(v8_isolate); 9564 if (!it->HasMore()) return v8::Array::New(v8_isolate);
9565 return Utils::ToLocal( 9565 return Utils::ToLocal(
9566 SetAsArray(isolate, it->table(), i::Smi::cast(it->index())->value())); 9566 SetAsArray(isolate, it->table(), i::Smi::cast(it->index())->value()));
9567 } 9567 }
9568 return v8::MaybeLocal<v8::Array>(); 9568 return v8::MaybeLocal<v8::Array>();
9569 } 9569 }
9570 9570
9571 Local<Function> debug::GetBuiltin(Isolate* v8_isolate, Builtin builtin) {
9572 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
9573 ENTER_V8(isolate);
9574 i::HandleScope handle_scope(isolate);
9575 i::Builtins::Name name;
9576 switch (builtin) {
9577 case kObjectKeys:
9578 name = i::Builtins::kObjectKeys;
9579 break;
9580 case kObjectGetPrototypeOf:
9581 name = i::Builtins::kObjectGetPrototypeOf;
9582 break;
9583 case kObjectGetOwnPropertyDescriptor:
9584 name = i::Builtins::kObjectGetOwnPropertyDescriptor;
9585 break;
9586 case kObjectGetOwnPropertyNames:
9587 name = i::Builtins::kObjectGetOwnPropertyNames;
9588 break;
9589 case kObjectGetOwnPropertySymbols:
9590 name = i::Builtins::kObjectGetOwnPropertySymbols;
9591 break;
9592 }
9593 i::Handle<i::Code> call_code(isolate->builtins()->builtin(name));
9594 i::Handle<i::JSFunction> fun =
9595 isolate->factory()->NewFunctionWithoutPrototype(
9596 isolate->factory()->empty_string(), call_code, false);
9597 fun->shared()->DontAdaptArguments();
9598 return Utils::ToLocal(handle_scope.CloseAndEscape(fun));
9599 }
9600
9571 MaybeLocal<debug::Script> debug::GeneratorObject::Script() { 9601 MaybeLocal<debug::Script> debug::GeneratorObject::Script() {
9572 i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this); 9602 i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this);
9573 i::Object* maybe_script = obj->function()->shared()->script(); 9603 i::Object* maybe_script = obj->function()->shared()->script();
9574 if (!maybe_script->IsScript()) return MaybeLocal<debug::Script>(); 9604 if (!maybe_script->IsScript()) return MaybeLocal<debug::Script>();
9575 i::Handle<i::Script> script(i::Script::cast(maybe_script), obj->GetIsolate()); 9605 i::Handle<i::Script> script(i::Script::cast(maybe_script), obj->GetIsolate());
9576 return ToApiHandle<debug::Script>(script); 9606 return ToApiHandle<debug::Script>(script);
9577 } 9607 }
9578 9608
9579 Local<Function> debug::GeneratorObject::Function() { 9609 Local<Function> debug::GeneratorObject::Function() {
9580 i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this); 9610 i::Handle<i::JSGeneratorObject> obj = Utils::OpenHandle(this);
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
10328 Address callback_address = 10358 Address callback_address =
10329 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 10359 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
10330 VMState<EXTERNAL> state(isolate); 10360 VMState<EXTERNAL> state(isolate);
10331 ExternalCallbackScope call_scope(isolate, callback_address); 10361 ExternalCallbackScope call_scope(isolate, callback_address);
10332 callback(info); 10362 callback(info);
10333 } 10363 }
10334 10364
10335 10365
10336 } // namespace internal 10366 } // namespace internal
10337 } // namespace v8 10367 } // namespace v8
OLDNEW
« 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