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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2452 | 2452 |
2453 bool Debug::IsDebugGlobal(GlobalObject* global) { | 2453 bool Debug::IsDebugGlobal(GlobalObject* global) { |
2454 return is_loaded() && global == debug_context()->global_object(); | 2454 return is_loaded() && global == debug_context()->global_object(); |
2455 } | 2455 } |
2456 | 2456 |
2457 | 2457 |
2458 void Debug::ClearMirrorCache() { | 2458 void Debug::ClearMirrorCache() { |
2459 PostponeInterruptsScope postpone(isolate_); | 2459 PostponeInterruptsScope postpone(isolate_); |
2460 HandleScope scope(isolate_); | 2460 HandleScope scope(isolate_); |
2461 ASSERT(isolate_->context() == *Debug::debug_context()); | 2461 ASSERT(isolate_->context() == *Debug::debug_context()); |
2462 | 2462 Factory* factory = isolate_->factory(); |
yurys
2014/06/03 13:27:18
Just curious why is the advantage of this implemen
Yang
2014/06/03 14:22:05
Less overhead, and I think that two SetProperty is
| |
2463 // Clear the mirror cache. | 2463 JSObject::SetProperty(isolate_->global_object(), |
2464 Handle<Object> fun = Object::GetProperty( | 2464 factory->NewStringFromAsciiChecked("next_handle_"), |
2465 isolate_, | 2465 handle(Smi::FromInt(0), isolate_), |
2466 isolate_->global_object(), | 2466 NONE, |
2467 "ClearMirrorCache").ToHandleChecked(); | 2467 SLOPPY); |
2468 ASSERT(fun->IsJSFunction()); | 2468 JSObject::SetProperty(isolate_->global_object(), |
2469 Execution::TryCall(Handle<JSFunction>::cast(fun), | 2469 factory->NewStringFromAsciiChecked("mirror_cache_"), |
2470 Handle<JSObject>(Debug::debug_context()->global_object()), | 2470 factory->NewJSArray(0, FAST_ELEMENTS), |
2471 0, | 2471 NONE, |
2472 NULL); | 2472 SLOPPY); |
2473 } | 2473 } |
2474 | 2474 |
2475 | 2475 |
2476 Handle<FixedArray> Debug::GetLoadedScripts() { | 2476 Handle<FixedArray> Debug::GetLoadedScripts() { |
2477 // Create and fill the script cache when the loaded scripts is requested for | 2477 // Create and fill the script cache when the loaded scripts is requested for |
2478 // the first time. | 2478 // the first time. |
2479 if (script_cache_ == NULL) script_cache_ = new ScriptCache(isolate_); | 2479 if (script_cache_ == NULL) script_cache_ = new ScriptCache(isolate_); |
2480 | 2480 |
2481 // Perform GC to get unreferenced scripts evicted from the cache before | 2481 // Perform GC to get unreferenced scripts evicted from the cache before |
2482 // returning the content. | 2482 // returning the content. |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3411 logger_->DebugEvent("Put", message.text()); | 3411 logger_->DebugEvent("Put", message.text()); |
3412 } | 3412 } |
3413 | 3413 |
3414 | 3414 |
3415 void LockingCommandMessageQueue::Clear() { | 3415 void LockingCommandMessageQueue::Clear() { |
3416 LockGuard<Mutex> lock_guard(&mutex_); | 3416 LockGuard<Mutex> lock_guard(&mutex_); |
3417 queue_.Clear(); | 3417 queue_.Clear(); |
3418 } | 3418 } |
3419 | 3419 |
3420 } } // namespace v8::internal | 3420 } } // namespace v8::internal |
OLD | NEW |