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

Side by Side Diff: src/api.cc

Issue 2499273003: [inspector] introduced Script::TYPE_INSPECTOR (Closed)
Patch Set: Created 4 years, 1 month 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/compiler.cc » ('j') | src/inspector/v8-inspector-impl.cc » ('J')
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 HandleScopeClass, do_callback) \ 90 HandleScopeClass, do_callback) \
91 if (IsExecutionTerminatingCheck(isolate)) { \ 91 if (IsExecutionTerminatingCheck(isolate)) { \
92 return bailout_value; \ 92 return bailout_value; \
93 } \ 93 } \
94 HandleScopeClass handle_scope(isolate); \ 94 HandleScopeClass handle_scope(isolate); \
95 CallDepthScope<do_callback> call_depth_scope(isolate, context); \ 95 CallDepthScope<do_callback> call_depth_scope(isolate, context); \
96 LOG_API(isolate, class_name, function_name); \ 96 LOG_API(isolate, class_name, function_name); \
97 ENTER_V8(isolate); \ 97 ENTER_V8(isolate); \
98 bool has_pending_exception = false 98 bool has_pending_exception = false
99 99
100 #define PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, T) \
101 if (IsExecutionTerminatingCheck(isolate)) { \
102 return MaybeLocal<T>(); \
103 } \
104 InternalEscapableScope handle_scope(isolate); \
105 CallDepthScope<false> call_depth_scope(isolate, v8::Local<v8::Context>()); \
106 ENTER_V8(isolate); \
107 bool has_pending_exception = false
108
100 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \ 109 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT(context, class_name, function_name, \
101 bailout_value, HandleScopeClass, \ 110 bailout_value, HandleScopeClass, \
102 do_callback) \ 111 do_callback) \
103 auto isolate = context.IsEmpty() \ 112 auto isolate = context.IsEmpty() \
104 ? i::Isolate::Current() \ 113 ? i::Isolate::Current() \
105 : reinterpret_cast<i::Isolate*>(context->GetIsolate()); \ 114 : reinterpret_cast<i::Isolate*>(context->GetIsolate()); \
106 PREPARE_FOR_EXECUTION_GENERIC(isolate, context, class_name, function_name, \ 115 PREPARE_FOR_EXECUTION_GENERIC(isolate, context, class_name, function_name, \
107 bailout_value, HandleScopeClass, do_callback); 116 bailout_value, HandleScopeClass, do_callback);
108 117
109 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( \ 118 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( \
(...skipping 8995 matching lines...) Expand 10 before | Expand all | Expand 10 after
9105 if (script->type() != i::Script::TYPE_NORMAL) continue; 9114 if (script->type() != i::Script::TYPE_NORMAL) continue;
9106 if (script->HasValidSource()) { 9115 if (script->HasValidSource()) {
9107 i::HandleScope handle_scope(isolate); 9116 i::HandleScope handle_scope(isolate);
9108 i::Handle<i::Script> script_handle(script, isolate); 9117 i::Handle<i::Script> script_handle(script, isolate);
9109 scripts.Append(ToApiHandle<Script>(script_handle)); 9118 scripts.Append(ToApiHandle<Script>(script_handle));
9110 } 9119 }
9111 } 9120 }
9112 } 9121 }
9113 } 9122 }
9114 9123
9124 MaybeLocal<UnboundScript> DebugInterface::CompileInspectorScript(
9125 Isolate* v8_isolate, Local<String> source) {
9126 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
9127 PREPARE_FOR_DEBUG_INTERFACE_EXECUTION_WITH_ISOLATE(isolate, UnboundScript);
9128 i::ScriptData* script_data = NULL;
9129 i::Handle<i::String> str = Utils::OpenHandle(*source);
9130 i::Handle<i::SharedFunctionInfo> result;
9131 {
9132 ScriptOriginOptions origin_options;
9133 result = i::Compiler::GetSharedFunctionInfoForScript(
9134 str, i::Handle<i::Object>(), 0, 0, origin_options,
9135 i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data,
9136 ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE, false);
9137 has_pending_exception = result.is_null();
9138 RETURN_ON_FAILED_EXECUTION(UnboundScript);
9139 }
9140 RETURN_ESCAPED(ToApiHandle<UnboundScript>(result));
9141 }
9142
9115 Local<String> CpuProfileNode::GetFunctionName() const { 9143 Local<String> CpuProfileNode::GetFunctionName() const {
9116 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 9144 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
9117 i::Isolate* isolate = node->isolate(); 9145 i::Isolate* isolate = node->isolate();
9118 const i::CodeEntry* entry = node->entry(); 9146 const i::CodeEntry* entry = node->entry();
9119 i::Handle<i::String> name = 9147 i::Handle<i::String> name =
9120 isolate->factory()->InternalizeUtf8String(entry->name()); 9148 isolate->factory()->InternalizeUtf8String(entry->name());
9121 if (!entry->has_name_prefix()) { 9149 if (!entry->has_name_prefix()) {
9122 return ToApiHandle<String>(name); 9150 return ToApiHandle<String>(name);
9123 } else { 9151 } else {
9124 // We do not expect this to fail. Change this if it does. 9152 // We do not expect this to fail. Change this if it does.
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
9793 Address callback_address = 9821 Address callback_address =
9794 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9822 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9795 VMState<EXTERNAL> state(isolate); 9823 VMState<EXTERNAL> state(isolate);
9796 ExternalCallbackScope call_scope(isolate, callback_address); 9824 ExternalCallbackScope call_scope(isolate, callback_address);
9797 callback(info); 9825 callback(info);
9798 } 9826 }
9799 9827
9800 9828
9801 } // namespace internal 9829 } // namespace internal
9802 } // namespace v8 9830 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | src/inspector/v8-inspector-impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698