| 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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 } | 615 } |
| 616 | 616 |
| 617 | 617 |
| 618 void ScriptCache::Add(Handle<Script> script) { | 618 void ScriptCache::Add(Handle<Script> script) { |
| 619 GlobalHandles* global_handles = isolate_->global_handles(); | 619 GlobalHandles* global_handles = isolate_->global_handles(); |
| 620 // Create an entry in the hash map for the script. | 620 // Create an entry in the hash map for the script. |
| 621 int id = script->id()->value(); | 621 int id = script->id()->value(); |
| 622 HashMap::Entry* entry = | 622 HashMap::Entry* entry = |
| 623 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); | 623 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); |
| 624 if (entry->value != NULL) { | 624 if (entry->value != NULL) { |
| 625 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); | 625 #ifdef DEBUG |
| 626 // The code deserializer may introduce duplicate Script objects. |
| 627 // Assert that the Script objects with the same id have the same name. |
| 628 Handle<Script> found(reinterpret_cast<Script**>(entry->value)); |
| 629 ASSERT(script->id() == found->id()); |
| 630 ASSERT(!script->name()->IsString() || |
| 631 String::cast(script->name())->Equals(String::cast(found->name()))); |
| 632 #endif |
| 626 return; | 633 return; |
| 627 } | 634 } |
| 628 // Globalize the script object, make it weak and use the location of the | 635 // Globalize the script object, make it weak and use the location of the |
| 629 // global handle as the value in the hash map. | 636 // global handle as the value in the hash map. |
| 630 Handle<Script> script_ = | 637 Handle<Script> script_ = |
| 631 Handle<Script>::cast(global_handles->Create(*script)); | 638 Handle<Script>::cast(global_handles->Create(*script)); |
| 632 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(script_.location()), | 639 GlobalHandles::MakeWeak(reinterpret_cast<Object**>(script_.location()), |
| 633 this, | 640 this, |
| 634 ScriptCache::HandleWeakScript); | 641 ScriptCache::HandleWeakScript); |
| 635 entry->value = script_.location(); | 642 entry->value = script_.location(); |
| (...skipping 2764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3400 logger_->DebugEvent("Put", message.text()); | 3407 logger_->DebugEvent("Put", message.text()); |
| 3401 } | 3408 } |
| 3402 | 3409 |
| 3403 | 3410 |
| 3404 void LockingCommandMessageQueue::Clear() { | 3411 void LockingCommandMessageQueue::Clear() { |
| 3405 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 3412 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 3406 queue_.Clear(); | 3413 queue_.Clear(); |
| 3407 } | 3414 } |
| 3408 | 3415 |
| 3409 } } // namespace v8::internal | 3416 } } // namespace v8::internal |
| OLD | NEW |