| 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 9479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9490 int debug::WasmScript::NumImportedFunctions() const { | 9490 int debug::WasmScript::NumImportedFunctions() const { |
| 9491 i::DisallowHeapAllocation no_gc; | 9491 i::DisallowHeapAllocation no_gc; |
| 9492 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9492 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9493 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); | 9493 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); |
| 9494 i::WasmCompiledModule* compiled_module = | 9494 i::WasmCompiledModule* compiled_module = |
| 9495 i::WasmCompiledModule::cast(script->wasm_compiled_module()); | 9495 i::WasmCompiledModule::cast(script->wasm_compiled_module()); |
| 9496 DCHECK_GE(i::kMaxInt, compiled_module->module()->num_imported_functions); | 9496 DCHECK_GE(i::kMaxInt, compiled_module->module()->num_imported_functions); |
| 9497 return static_cast<int>(compiled_module->module()->num_imported_functions); | 9497 return static_cast<int>(compiled_module->module()->num_imported_functions); |
| 9498 } | 9498 } |
| 9499 | 9499 |
| 9500 Maybe<int> debug::WasmScript::ContextId() const { |
| 9501 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 9502 i::HandleScope handle_scope(isolate); |
| 9503 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9504 i::Object* value = script->context_data(); |
| 9505 if (value->IsSmi()) return Just(i::Smi::cast(value)->value()); |
| 9506 return Nothing<int>(); |
| 9507 } |
| 9508 |
| 9500 std::pair<int, int> debug::WasmScript::GetFunctionRange( | 9509 std::pair<int, int> debug::WasmScript::GetFunctionRange( |
| 9501 int function_index) const { | 9510 int function_index) const { |
| 9502 i::DisallowHeapAllocation no_gc; | 9511 i::DisallowHeapAllocation no_gc; |
| 9503 i::Handle<i::Script> script = Utils::OpenHandle(this); | 9512 i::Handle<i::Script> script = Utils::OpenHandle(this); |
| 9504 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); | 9513 DCHECK_EQ(i::Script::TYPE_WASM, script->type()); |
| 9505 i::WasmCompiledModule* compiled_module = | 9514 i::WasmCompiledModule* compiled_module = |
| 9506 i::WasmCompiledModule::cast(script->wasm_compiled_module()); | 9515 i::WasmCompiledModule::cast(script->wasm_compiled_module()); |
| 9507 DCHECK_LE(0, function_index); | 9516 DCHECK_LE(0, function_index); |
| 9508 DCHECK_GT(compiled_module->module()->functions.size(), function_index); | 9517 DCHECK_GT(compiled_module->module()->functions.size(), function_index); |
| 9509 i::wasm::WasmFunction& func = | 9518 i::wasm::WasmFunction& func = |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10468 Address callback_address = | 10477 Address callback_address = |
| 10469 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 10478 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 10470 VMState<EXTERNAL> state(isolate); | 10479 VMState<EXTERNAL> state(isolate); |
| 10471 ExternalCallbackScope call_scope(isolate, callback_address); | 10480 ExternalCallbackScope call_scope(isolate, callback_address); |
| 10472 callback(info); | 10481 callback(info); |
| 10473 } | 10482 } |
| 10474 | 10483 |
| 10475 | 10484 |
| 10476 } // namespace internal | 10485 } // namespace internal |
| 10477 } // namespace v8 | 10486 } // namespace v8 |
| OLD | NEW |