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 9269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9280 | 9280 |
9281 ScriptOriginOptions debug::Script::OriginOptions() const { | 9281 ScriptOriginOptions debug::Script::OriginOptions() const { |
9282 return Utils::OpenHandle(this)->origin_options(); | 9282 return Utils::OpenHandle(this)->origin_options(); |
9283 } | 9283 } |
9284 | 9284 |
9285 bool debug::Script::WasCompiled() const { | 9285 bool debug::Script::WasCompiled() const { |
9286 return Utils::OpenHandle(this)->compilation_state() == | 9286 return Utils::OpenHandle(this)->compilation_state() == |
9287 i::Script::COMPILATION_STATE_COMPILED; | 9287 i::Script::COMPILATION_STATE_COMPILED; |
9288 } | 9288 } |
9289 | 9289 |
| 9290 bool debug::Script::IsEmbedded() const { |
| 9291 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9292 return script->context_data() == script->GetHeap()->uninitialized_symbol(); |
| 9293 } |
| 9294 |
9290 int debug::Script::Id() const { return Utils::OpenHandle(this)->id(); } | 9295 int debug::Script::Id() const { return Utils::OpenHandle(this)->id(); } |
9291 | 9296 |
9292 int debug::Script::LineOffset() const { | 9297 int debug::Script::LineOffset() const { |
9293 return Utils::OpenHandle(this)->line_offset(); | 9298 return Utils::OpenHandle(this)->line_offset(); |
9294 } | 9299 } |
9295 | 9300 |
9296 int debug::Script::ColumnOffset() const { | 9301 int debug::Script::ColumnOffset() const { |
9297 return Utils::OpenHandle(this)->column_offset(); | 9302 return Utils::OpenHandle(this)->column_offset(); |
9298 } | 9303 } |
9299 | 9304 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9336 MaybeLocal<String> debug::Script::SourceMappingURL() const { | 9341 MaybeLocal<String> debug::Script::SourceMappingURL() const { |
9337 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 9342 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
9338 i::HandleScope handle_scope(isolate); | 9343 i::HandleScope handle_scope(isolate); |
9339 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9344 i::Handle<i::Script> script = Utils::OpenHandle(this); |
9340 i::Handle<i::Object> value(script->source_mapping_url(), isolate); | 9345 i::Handle<i::Object> value(script->source_mapping_url(), isolate); |
9341 if (!value->IsString()) return MaybeLocal<String>(); | 9346 if (!value->IsString()) return MaybeLocal<String>(); |
9342 return Utils::ToLocal( | 9347 return Utils::ToLocal( |
9343 handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value))); | 9348 handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value))); |
9344 } | 9349 } |
9345 | 9350 |
9346 MaybeLocal<Value> debug::Script::ContextData() const { | 9351 Maybe<int> debug::Script::ContextId() const { |
9347 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 9352 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
9348 i::HandleScope handle_scope(isolate); | 9353 i::HandleScope handle_scope(isolate); |
9349 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9354 i::Handle<i::Script> script = Utils::OpenHandle(this); |
9350 i::Handle<i::Object> value(script->context_data(), isolate); | 9355 i::Object* value = script->context_data(); |
9351 return Utils::ToLocal(handle_scope.CloseAndEscape(value)); | 9356 if (value->IsSmi()) return Just(i::Smi::cast(value)->value()); |
| 9357 return Nothing<int>(); |
9352 } | 9358 } |
9353 | 9359 |
9354 MaybeLocal<String> debug::Script::Source() const { | 9360 MaybeLocal<String> debug::Script::Source() const { |
9355 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 9361 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
9356 i::HandleScope handle_scope(isolate); | 9362 i::HandleScope handle_scope(isolate); |
9357 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9363 i::Handle<i::Script> script = Utils::OpenHandle(this); |
9358 i::Handle<i::Object> value(script->source(), isolate); | 9364 i::Handle<i::Object> value(script->source(), isolate); |
9359 if (!value->IsString()) return MaybeLocal<String>(); | 9365 if (!value->IsString()) return MaybeLocal<String>(); |
9360 return Utils::ToLocal( | 9366 return Utils::ToLocal( |
9361 handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value))); | 9367 handle_scope.CloseAndEscape(i::Handle<i::String>::cast(value))); |
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10467 Address callback_address = | 10473 Address callback_address = |
10468 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10474 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
10469 VMState<EXTERNAL> state(isolate); | 10475 VMState<EXTERNAL> state(isolate); |
10470 ExternalCallbackScope call_scope(isolate, callback_address); | 10476 ExternalCallbackScope call_scope(isolate, callback_address); |
10471 callback(info); | 10477 callback(info); |
10472 } | 10478 } |
10473 | 10479 |
10474 | 10480 |
10475 } // namespace internal | 10481 } // namespace internal |
10476 } // namespace v8 | 10482 } // namespace v8 |
OLD | NEW |