Chromium Code Reviews| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 | 68 |
| 69 | 69 |
| 70 namespace v8 { | 70 namespace v8 { |
| 71 | 71 |
| 72 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr)) | 72 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr)) |
| 73 | 73 |
| 74 | 74 |
| 75 #define ENTER_V8(isolate) i::VMState<v8::OTHER> __state__((isolate)) | 75 #define ENTER_V8(isolate) i::VMState<v8::OTHER> __state__((isolate)) |
| 76 | 76 |
| 77 | 77 |
| 78 #define PREPARE_FOR_EXECUTION_GENERIC(isolate, context, function_name, \ | 78 #define PREPARE_FOR_EXECUTION_GENERIC(isolate, context, function_name, \ |
| 79 bailout_value, HandleScopeClass, \ | 79 bailout_value, HandleScopeClass, \ |
| 80 do_callback) \ | 80 do_callback) \ |
| 81 if (IsExecutionTerminatingCheck(isolate)) { \ | 81 if (IsExecutionTerminatingCheck(isolate)) { \ |
| 82 return bailout_value; \ | 82 return bailout_value; \ |
| 83 } \ | 83 } \ |
| 84 TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate); \ | 84 TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate); \ |
| 85 HandleScopeClass handle_scope(isolate); \ | 85 HandleScopeClass handle_scope(isolate); \ |
| 86 CallDepthScope call_depth_scope(isolate, context, do_callback); \ | 86 isolate->IncrementJsCallsFromApiCounter(); \ |
| 87 LOG_API(isolate, function_name); \ | 87 CallDepthScope call_depth_scope(isolate, context, do_callback, false);\ |
| 88 ENTER_V8(isolate); \ | 88 LOG_API(isolate, function_name); \ |
| 89 ENTER_V8(isolate); \ | |
| 89 bool has_pending_exception = false | 90 bool has_pending_exception = false |
| 90 | 91 |
| 91 | 92 |
| 92 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT( \ | 93 #define PREPARE_FOR_EXECUTION_WITH_CONTEXT( \ |
| 93 context, function_name, bailout_value, HandleScopeClass, do_callback) \ | 94 context, function_name, bailout_value, HandleScopeClass, do_callback) \ |
| 94 auto isolate = context.IsEmpty() \ | 95 auto isolate = context.IsEmpty() \ |
| 95 ? i::Isolate::Current() \ | 96 ? i::Isolate::Current() \ |
| 96 : reinterpret_cast<i::Isolate*>(context->GetIsolate()); \ | 97 : reinterpret_cast<i::Isolate*>(context->GetIsolate()); \ |
| 97 PREPARE_FOR_EXECUTION_GENERIC(isolate, context, function_name, \ | 98 PREPARE_FOR_EXECUTION_GENERIC(isolate, context, function_name, \ |
| 98 bailout_value, HandleScopeClass, do_callback); | 99 bailout_value, HandleScopeClass, do_callback); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 ->GetCurrentContext(); | 151 ->GetCurrentContext(); |
| 151 } | 152 } |
| 152 | 153 |
| 153 class InternalEscapableScope : public v8::EscapableHandleScope { | 154 class InternalEscapableScope : public v8::EscapableHandleScope { |
| 154 public: | 155 public: |
| 155 explicit inline InternalEscapableScope(i::Isolate* isolate) | 156 explicit inline InternalEscapableScope(i::Isolate* isolate) |
| 156 : v8::EscapableHandleScope(reinterpret_cast<v8::Isolate*>(isolate)) {} | 157 : v8::EscapableHandleScope(reinterpret_cast<v8::Isolate*>(isolate)) {} |
| 157 }; | 158 }; |
| 158 | 159 |
| 159 | 160 |
| 161 inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) { | |
| 162 if (isolate->has_scheduled_exception()) { | |
| 163 return isolate->scheduled_exception() == | |
| 164 isolate->heap()->termination_exception(); | |
| 165 } | |
| 166 return false; | |
| 167 } | |
| 168 | |
| 169 | |
| 160 class CallDepthScope { | 170 class CallDepthScope { |
| 161 public: | 171 public: |
| 162 explicit CallDepthScope(i::Isolate* isolate, Local<Context> context, | 172 CallDepthScope(i::Isolate* isolate, |
| 163 bool do_callback) | 173 Local<Context> context, |
| 174 bool do_callback_and_microtasks, | |
| 175 bool is_external) | |
| 164 : isolate_(isolate), | 176 : isolate_(isolate), |
| 165 context_(context), | 177 context_(context), |
| 166 escaped_(false), | 178 handle_exception_(!is_external), |
| 167 do_callback_(do_callback) { | 179 do_callback_(do_callback_and_microtasks && !is_external) { |
| 168 // TODO(dcarney): remove this when blink stops crashing. | 180 bool affects_microtasks = is_external || |
| 169 DCHECK(!isolate_->external_caught_exception()); | 181 isolate_->handle_scope_implementer()->microtasks_policy() == |
| 170 isolate_->IncrementJsCallsFromApiCounter(); | 182 i::kAutoMicrotasksInvocation; |
| 171 isolate_->handle_scope_implementer()->IncrementCallDepth(); | 183 run_microtasks_ = affects_microtasks && do_callback_and_microtasks; |
| 184 #ifdef V8_ENABLE_CHECKS | |
| 185 debug_microtasks_ = affects_microtasks && !do_callback_and_microtasks; | |
| 186 #endif | |
| 187 auto handle_scope_implementer = isolate_->handle_scope_implementer(); | |
| 188 if (handle_exception_) { | |
| 189 // TODO(dcarney): remove this when blink stops crashing. | |
| 190 DCHECK(!isolate_->external_caught_exception()); | |
| 191 handle_scope_implementer->IncrementInternalCallDepth(); | |
| 192 } | |
| 193 if (run_microtasks_) handle_scope_implementer->IncrementCallDepth(); | |
| 194 #ifdef V8_ENABLE_CHECKS | |
| 195 if (debug_microtasks_) handle_scope_implementer->IncrementDebugCallDepth(); | |
| 196 #endif | |
| 172 if (!context_.IsEmpty()) context_->Enter(); | 197 if (!context_.IsEmpty()) context_->Enter(); |
| 173 if (do_callback_) isolate_->FireBeforeCallEnteredCallback(); | 198 if (do_callback_) isolate_->FireBeforeCallEnteredCallback(); |
| 174 } | 199 } |
| 200 | |
| 175 ~CallDepthScope() { | 201 ~CallDepthScope() { |
| 176 if (!context_.IsEmpty()) context_->Exit(); | 202 if (!context_.IsEmpty()) context_->Exit(); |
| 177 if (!escaped_) isolate_->handle_scope_implementer()->DecrementCallDepth(); | 203 auto handle_scope_implementer = isolate_->handle_scope_implementer(); |
| 204 if (handle_exception_) | |
| 205 handle_scope_implementer->DecrementInternalCallDepth(); | |
| 178 if (do_callback_) isolate_->FireCallCompletedCallback(); | 206 if (do_callback_) isolate_->FireCallCompletedCallback(); |
| 207 #ifdef V8_ENABLE_CHECKS | |
| 208 bool scoped_policy = handle_scope_implementer->microtasks_policy() == | |
| 209 i::kScopedMicrotasksInvocation; | |
| 210 DCHECK(!(scoped_policy && do_callback_ | |
| 211 && !handle_scope_implementer->GetCallDepth() | |
| 212 && !handle_scope_implementer->GetDebugCallDepth())); | |
| 213 #endif | |
| 214 if (run_microtasks_) { | |
| 215 handle_scope_implementer->DecrementCallDepth(); | |
| 216 PerformCheckpoint(isolate_); | |
| 217 } | |
| 218 #ifdef V8_ENABLE_CHECKS | |
| 219 if (debug_microtasks_) handle_scope_implementer->DecrementDebugCallDepth(); | |
| 220 #endif | |
| 179 } | 221 } |
| 180 | 222 |
| 181 void Escape() { | 223 void Escape() { |
| 182 DCHECK(!escaped_); | 224 DCHECK(handle_exception_); |
| 183 escaped_ = true; | 225 handle_exception_ = false; |
| 184 auto handle_scope_implementer = isolate_->handle_scope_implementer(); | 226 auto handle_scope_implementer = isolate_->handle_scope_implementer(); |
| 185 handle_scope_implementer->DecrementCallDepth(); | 227 handle_scope_implementer->DecrementInternalCallDepth(); |
| 186 bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); | 228 bool call_depth_is_zero = !handle_scope_implementer->GetInternalCallDepth(); |
| 187 isolate_->OptionalRescheduleException(call_depth_is_zero); | 229 isolate_->OptionalRescheduleException(call_depth_is_zero); |
| 188 } | 230 } |
| 189 | 231 |
| 232 static void PerformCheckpoint(i::Isolate* isolate) { | |
| 233 if (IsExecutionTerminatingCheck(isolate)) return; | |
| 234 if (!isolate->handle_scope_implementer()->GetCallDepth() && | |
| 235 !isolate->handle_scope_implementer()->GetMicrotasksSuppression()) { | |
| 236 isolate->RunMicrotasks(); | |
| 237 } | |
| 238 } | |
| 239 | |
| 190 private: | 240 private: |
| 191 i::Isolate* const isolate_; | 241 i::Isolate* const isolate_; |
| 192 Local<Context> context_; | 242 Local<Context> context_; |
| 193 bool escaped_; | 243 bool handle_exception_; |
| 194 bool do_callback_; | 244 bool do_callback_; |
| 245 bool run_microtasks_; | |
| 246 bool debug_microtasks_; | |
| 195 }; | 247 }; |
| 196 | 248 |
| 197 } // namespace | 249 } // namespace |
| 198 | 250 |
| 199 | 251 |
| 200 static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate, | 252 static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate, |
| 201 i::Handle<i::Script> script) { | 253 i::Handle<i::Script> script) { |
| 202 TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate); | 254 TRACE_EVENT_SCOPED_CONTEXT("v8", "Isolate", isolate); |
| 203 i::Handle<i::Object> scriptName(i::Script::GetNameOrSourceURL(script)); | 255 i::Handle<i::Object> scriptName(i::Script::GetNameOrSourceURL(script)); |
| 204 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); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 303 base::OS::PrintError("\n#\n# Fatal error in %s\n# %s\n#\n\n", location, | 355 base::OS::PrintError("\n#\n# Fatal error in %s\n# %s\n#\n\n", location, |
| 304 message); | 356 message); |
| 305 base::OS::Abort(); | 357 base::OS::Abort(); |
| 306 } else { | 358 } else { |
| 307 callback(location, message); | 359 callback(location, message); |
| 308 } | 360 } |
| 309 isolate->SignalFatalError(); | 361 isolate->SignalFatalError(); |
| 310 } | 362 } |
| 311 | 363 |
| 312 | 364 |
| 313 static inline bool IsExecutionTerminatingCheck(i::Isolate* isolate) { | |
| 314 if (isolate->has_scheduled_exception()) { | |
| 315 return isolate->scheduled_exception() == | |
| 316 isolate->heap()->termination_exception(); | |
| 317 } | |
| 318 return false; | |
| 319 } | |
| 320 | |
| 321 | |
| 322 void V8::SetNativesDataBlob(StartupData* natives_blob) { | 365 void V8::SetNativesDataBlob(StartupData* natives_blob) { |
| 323 i::V8::SetNativesBlob(natives_blob); | 366 i::V8::SetNativesBlob(natives_blob); |
| 324 } | 367 } |
| 325 | 368 |
| 326 | 369 |
| 327 void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { | 370 void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) { |
| 328 i::V8::SetSnapshotBlob(snapshot_blob); | 371 i::V8::SetSnapshotBlob(snapshot_blob); |
| 329 } | 372 } |
| 330 | 373 |
| 331 | 374 |
| (...skipping 6951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7283 | 7326 |
| 7284 Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() { | 7327 Isolate::AllowJavascriptExecutionScope::~AllowJavascriptExecutionScope() { |
| 7285 delete reinterpret_cast<i::AllowJavascriptExecution*>(internal_assert_); | 7328 delete reinterpret_cast<i::AllowJavascriptExecution*>(internal_assert_); |
| 7286 delete reinterpret_cast<i::NoThrowOnJavascriptExecution*>(internal_throws_); | 7329 delete reinterpret_cast<i::NoThrowOnJavascriptExecution*>(internal_throws_); |
| 7287 } | 7330 } |
| 7288 | 7331 |
| 7289 | 7332 |
| 7290 Isolate::SuppressMicrotaskExecutionScope::SuppressMicrotaskExecutionScope( | 7333 Isolate::SuppressMicrotaskExecutionScope::SuppressMicrotaskExecutionScope( |
| 7291 Isolate* isolate) | 7334 Isolate* isolate) |
| 7292 : isolate_(reinterpret_cast<i::Isolate*>(isolate)) { | 7335 : isolate_(reinterpret_cast<i::Isolate*>(isolate)) { |
| 7293 isolate_->handle_scope_implementer()->IncrementCallDepth(); | 7336 isolate_->handle_scope_implementer()->IncrementMicrotasksSuppression(); |
| 7294 } | 7337 } |
| 7295 | 7338 |
| 7296 | 7339 |
| 7297 Isolate::SuppressMicrotaskExecutionScope::~SuppressMicrotaskExecutionScope() { | 7340 Isolate::SuppressMicrotaskExecutionScope::~SuppressMicrotaskExecutionScope() { |
| 7298 isolate_->handle_scope_implementer()->DecrementCallDepth(); | 7341 isolate_->handle_scope_implementer()->DecrementMicrotasksSuppression(); |
| 7299 } | 7342 } |
| 7300 | 7343 |
| 7301 | 7344 |
| 7302 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { | 7345 void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) { |
| 7303 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7346 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7304 i::Heap* heap = isolate->heap(); | 7347 i::Heap* heap = isolate->heap(); |
| 7305 heap_statistics->total_heap_size_ = heap->CommittedMemory(); | 7348 heap_statistics->total_heap_size_ = heap->CommittedMemory(); |
| 7306 heap_statistics->total_heap_size_executable_ = | 7349 heap_statistics->total_heap_size_executable_ = |
| 7307 heap->CommittedMemoryExecutable(); | 7350 heap->CommittedMemoryExecutable(); |
| 7308 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); | 7351 heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory(); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7429 | 7472 |
| 7430 | 7473 |
| 7431 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { | 7474 void Isolate::SetPromiseRejectCallback(PromiseRejectCallback callback) { |
| 7432 if (callback == NULL) return; | 7475 if (callback == NULL) return; |
| 7433 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7476 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7434 isolate->SetPromiseRejectCallback(callback); | 7477 isolate->SetPromiseRejectCallback(callback); |
| 7435 } | 7478 } |
| 7436 | 7479 |
| 7437 | 7480 |
| 7438 void Isolate::RunMicrotasks() { | 7481 void Isolate::RunMicrotasks() { |
| 7482 DCHECK_EQ(Isolate::kExplicitMicrotasksInvocation, GetMicrotasksPolicy()); | |
| 7439 reinterpret_cast<i::Isolate*>(this)->RunMicrotasks(); | 7483 reinterpret_cast<i::Isolate*>(this)->RunMicrotasks(); |
| 7440 } | 7484 } |
| 7441 | 7485 |
| 7442 | 7486 |
| 7443 void Isolate::EnqueueMicrotask(Local<Function> microtask) { | 7487 void Isolate::EnqueueMicrotask(Local<Function> microtask) { |
| 7444 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7488 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7445 isolate->EnqueueMicrotask(Utils::OpenHandle(*microtask)); | 7489 isolate->EnqueueMicrotask(Utils::OpenHandle(*microtask)); |
| 7446 } | 7490 } |
| 7447 | 7491 |
| 7448 | 7492 |
| 7449 void Isolate::EnqueueMicrotask(MicrotaskCallback microtask, void* data) { | 7493 void Isolate::EnqueueMicrotask(MicrotaskCallback microtask, void* data) { |
| 7450 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7494 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7451 i::HandleScope scope(isolate); | 7495 i::HandleScope scope(isolate); |
| 7452 i::Handle<i::CallHandlerInfo> callback_info = | 7496 i::Handle<i::CallHandlerInfo> callback_info = |
| 7453 i::Handle<i::CallHandlerInfo>::cast( | 7497 i::Handle<i::CallHandlerInfo>::cast( |
| 7454 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE)); | 7498 isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE)); |
| 7455 SET_FIELD_WRAPPED(callback_info, set_callback, microtask); | 7499 SET_FIELD_WRAPPED(callback_info, set_callback, microtask); |
| 7456 SET_FIELD_WRAPPED(callback_info, set_data, data); | 7500 SET_FIELD_WRAPPED(callback_info, set_data, data); |
| 7457 isolate->EnqueueMicrotask(callback_info); | 7501 isolate->EnqueueMicrotask(callback_info); |
| 7458 } | 7502 } |
| 7459 | 7503 |
| 7460 | 7504 |
| 7461 void Isolate::SetAutorunMicrotasks(bool autorun) { | 7505 void Isolate::SetAutorunMicrotasks(bool autorun) { |
| 7462 reinterpret_cast<i::Isolate*>(this)->set_autorun_microtasks(autorun); | 7506 SetMicrotasksPolicy(kAutoMicrotasksInvocation); |
| 7463 } | 7507 } |
| 7464 | 7508 |
| 7465 | 7509 |
| 7466 bool Isolate::WillAutorunMicrotasks() const { | 7510 bool Isolate::WillAutorunMicrotasks() const { |
| 7467 return reinterpret_cast<const i::Isolate*>(this)->autorun_microtasks(); | 7511 return GetMicrotasksPolicy() == kAutoMicrotasksInvocation; |
| 7468 } | 7512 } |
| 7469 | 7513 |
| 7470 | 7514 |
| 7515 void Isolate::SetMicrotasksPolicy(MicrotasksPolicy policy) { | |
| 7516 reinterpret_cast<i::Isolate*>(this)->handle_scope_implementer()-> | |
| 7517 set_microtasks_policy(static_cast<i::MicrotasksPolicy>(policy)); | |
| 7518 } | |
| 7519 | |
| 7520 | |
| 7521 Isolate::MicrotasksPolicy Isolate::GetMicrotasksPolicy() const { | |
| 7522 return static_cast<MicrotasksPolicy>( | |
| 7523 reinterpret_cast<i::Isolate*>(const_cast<Isolate*>(this))-> | |
| 7524 handle_scope_implementer()->microtasks_policy()); | |
| 7525 } | |
| 7526 | |
| 7527 | |
| 7471 void Isolate::AddMicrotasksCompletedCallback( | 7528 void Isolate::AddMicrotasksCompletedCallback( |
| 7472 MicrotasksCompletedCallback callback) { | 7529 MicrotasksCompletedCallback callback) { |
| 7473 DCHECK(callback); | 7530 DCHECK(callback); |
| 7474 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7531 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7475 isolate->AddMicrotasksCompletedCallback(callback); | 7532 isolate->AddMicrotasksCompletedCallback(callback); |
| 7476 } | 7533 } |
| 7477 | 7534 |
| 7478 | 7535 |
| 7479 void Isolate::RemoveMicrotasksCompletedCallback( | 7536 void Isolate::RemoveMicrotasksCompletedCallback( |
| 7480 MicrotasksCompletedCallback callback) { | 7537 MicrotasksCompletedCallback callback) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7696 | 7753 |
| 7697 void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) { | 7754 void Isolate::VisitWeakHandles(PersistentHandleVisitor* visitor) { |
| 7698 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 7755 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 7699 i::DisallowHeapAllocation no_allocation; | 7756 i::DisallowHeapAllocation no_allocation; |
| 7700 VisitorAdapter visitor_adapter(visitor); | 7757 VisitorAdapter visitor_adapter(visitor); |
| 7701 isolate->global_handles()->IterateWeakRootsInNewSpaceWithClassIds( | 7758 isolate->global_handles()->IterateWeakRootsInNewSpaceWithClassIds( |
| 7702 &visitor_adapter); | 7759 &visitor_adapter); |
| 7703 } | 7760 } |
| 7704 | 7761 |
| 7705 | 7762 |
| 7763 MicrotasksScope::MicrotasksScope(Isolate* isolate, MicrotasksScope::Type type) { | |
| 7764 DCHECK_EQ(Isolate::kScopedMicrotasksInvocation, | |
| 7765 isolate->GetMicrotasksPolicy()); | |
| 7766 internal_ = reinterpret_cast<void*>(new CallDepthScope( | |
|
adamk
2016/03/01 19:10:34
I'm a little bit worried about the added heap allo
dgozman
2016/03/03 01:22:06
I think this patch would be easier to understand w
| |
| 7767 reinterpret_cast<i::Isolate*>(isolate), | |
| 7768 Local<Context>(), | |
| 7769 type == MicrotasksScope::kRunMicrotasks, | |
| 7770 true)); | |
| 7771 } | |
| 7772 | |
| 7773 | |
| 7774 MicrotasksScope::~MicrotasksScope() { | |
| 7775 delete reinterpret_cast<CallDepthScope*>(internal_); | |
| 7776 } | |
| 7777 | |
| 7778 | |
| 7779 void MicrotasksScope::PerformCheckpoint(Isolate* isolate) { | |
| 7780 CallDepthScope::PerformCheckpoint(reinterpret_cast<i::Isolate*>(isolate)); | |
| 7781 } | |
| 7782 | |
| 7783 | |
| 7784 int MicrotasksScope::GetRecursionLevel(Isolate* isolate) { | |
| 7785 return reinterpret_cast<i::Isolate*>(isolate)->handle_scope_implementer()-> | |
| 7786 GetCallDepth(); | |
| 7787 } | |
| 7788 | |
| 7789 | |
| 7706 String::Utf8Value::Utf8Value(v8::Local<v8::Value> obj) | 7790 String::Utf8Value::Utf8Value(v8::Local<v8::Value> obj) |
| 7707 : str_(NULL), length_(0) { | 7791 : str_(NULL), length_(0) { |
| 7708 if (obj.IsEmpty()) return; | 7792 if (obj.IsEmpty()) return; |
| 7709 i::Isolate* isolate = i::Isolate::Current(); | 7793 i::Isolate* isolate = i::Isolate::Current(); |
| 7710 Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate); | 7794 Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate); |
| 7711 ENTER_V8(isolate); | 7795 ENTER_V8(isolate); |
| 7712 i::HandleScope scope(isolate); | 7796 i::HandleScope scope(isolate); |
| 7713 Local<Context> context = v8_isolate->GetCurrentContext(); | 7797 Local<Context> context = v8_isolate->GetCurrentContext(); |
| 7714 TryCatch try_catch(v8_isolate); | 7798 TryCatch try_catch(v8_isolate); |
| 7715 Local<String> str; | 7799 Local<String> str; |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8614 Address callback_address = | 8698 Address callback_address = |
| 8615 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 8699 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 8616 VMState<EXTERNAL> state(isolate); | 8700 VMState<EXTERNAL> state(isolate); |
| 8617 ExternalCallbackScope call_scope(isolate, callback_address); | 8701 ExternalCallbackScope call_scope(isolate, callback_address); |
| 8618 callback(info); | 8702 callback(info); |
| 8619 } | 8703 } |
| 8620 | 8704 |
| 8621 | 8705 |
| 8622 } // namespace internal | 8706 } // namespace internal |
| 8623 } // namespace v8 | 8707 } // namespace v8 |
| OLD | NEW |