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