OLD | NEW |
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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 i::Handle<i::Object> source_map_url(script->source_mapping_url(), isolate); | 256 i::Handle<i::Object> source_map_url(script->source_mapping_url(), isolate); |
257 v8::Isolate* v8_isolate = | 257 v8::Isolate* v8_isolate = |
258 reinterpret_cast<v8::Isolate*>(script->GetIsolate()); | 258 reinterpret_cast<v8::Isolate*>(script->GetIsolate()); |
259 ScriptOriginOptions options(script->origin_options()); | 259 ScriptOriginOptions options(script->origin_options()); |
260 v8::ScriptOrigin origin( | 260 v8::ScriptOrigin origin( |
261 Utils::ToLocal(scriptName), | 261 Utils::ToLocal(scriptName), |
262 v8::Integer::New(v8_isolate, script->line_offset()), | 262 v8::Integer::New(v8_isolate, script->line_offset()), |
263 v8::Integer::New(v8_isolate, script->column_offset()), | 263 v8::Integer::New(v8_isolate, script->column_offset()), |
264 v8::Boolean::New(v8_isolate, options.IsSharedCrossOrigin()), | 264 v8::Boolean::New(v8_isolate, options.IsSharedCrossOrigin()), |
265 v8::Integer::New(v8_isolate, script->id()), | 265 v8::Integer::New(v8_isolate, script->id()), |
266 v8::Boolean::New(v8_isolate, options.IsEmbedderDebugScript()), | |
267 Utils::ToLocal(source_map_url), | 266 Utils::ToLocal(source_map_url), |
268 v8::Boolean::New(v8_isolate, options.IsOpaque())); | 267 v8::Boolean::New(v8_isolate, options.IsOpaque())); |
269 return origin; | 268 return origin; |
270 } | 269 } |
271 | 270 |
272 | 271 |
273 // --- E x c e p t i o n B e h a v i o r --- | 272 // --- E x c e p t i o n B e h a v i o r --- |
274 | 273 |
275 | 274 |
276 void i::FatalProcessOutOfMemory(const char* location) { | 275 void i::FatalProcessOutOfMemory(const char* location) { |
(...skipping 8752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9029 line_offset = GetSmiValue(line_ends, current_line_end_index - 1) + 1; | 9028 line_offset = GetSmiValue(line_ends, current_line_end_index - 1) + 1; |
9030 } | 9029 } |
9031 locations->push_back(Location( | 9030 locations->push_back(Location( |
9032 current_line_end_index + script->line_offset(), | 9031 current_line_end_index + script->line_offset(), |
9033 offset - line_offset + | 9032 offset - line_offset + |
9034 (current_line_end_index == 0 ? script->column_offset() : 0))); | 9033 (current_line_end_index == 0 ? script->column_offset() : 0))); |
9035 } | 9034 } |
9036 return true; | 9035 return true; |
9037 } | 9036 } |
9038 | 9037 |
| 9038 bool DebugInterface::Script::IsInspectorScript() const { |
| 9039 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 9040 i::HandleScope handle_scope(isolate); |
| 9041 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9042 i::Script::Type type = static_cast<i::Script::Type>(script->type()); |
| 9043 return type == i::Script::TYPE_INSPECTOR; |
| 9044 } |
| 9045 |
9039 int DebugInterface::Script::GetSourcePosition(const Location& location) const { | 9046 int DebugInterface::Script::GetSourcePosition(const Location& location) const { |
9040 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9047 i::Handle<i::Script> script = Utils::OpenHandle(this); |
9041 | 9048 |
9042 int line = std::max(location.GetLineNumber() - script->line_offset(), 0); | 9049 int line = std::max(location.GetLineNumber() - script->line_offset(), 0); |
9043 int column = location.GetColumnNumber(); | 9050 int column = location.GetColumnNumber(); |
9044 if (line == 0) { | 9051 if (line == 0) { |
9045 column = std::max(0, column - script->column_offset()); | 9052 column = std::max(0, column - script->column_offset()); |
9046 } | 9053 } |
9047 | 9054 |
9048 i::Script::InitLineEnds(script); | 9055 i::Script::InitLineEnds(script); |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9821 Address callback_address = | 9828 Address callback_address = |
9822 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 9829 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
9823 VMState<EXTERNAL> state(isolate); | 9830 VMState<EXTERNAL> state(isolate); |
9824 ExternalCallbackScope call_scope(isolate, callback_address); | 9831 ExternalCallbackScope call_scope(isolate, callback_address); |
9825 callback(info); | 9832 callback(info); |
9826 } | 9833 } |
9827 | 9834 |
9828 | 9835 |
9829 } // namespace internal | 9836 } // namespace internal |
9830 } // namespace v8 | 9837 } // namespace v8 |
OLD | NEW |