| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 void ScriptCache::Add(Handle<Script> script) { | 605 void ScriptCache::Add(Handle<Script> script) { |
| 606 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 606 GlobalHandles* global_handles = Isolate::Current()->global_handles(); |
| 607 // Create an entry in the hash map for the script. | 607 // Create an entry in the hash map for the script. |
| 608 int id = Smi::cast(script->id())->value(); | 608 int id = Smi::cast(script->id())->value(); |
| 609 HashMap::Entry* entry = | 609 HashMap::Entry* entry = |
| 610 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); | 610 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); |
| 611 if (entry->value != NULL) { | 611 if (entry->value != NULL) { |
| 612 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); | 612 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); |
| 613 return; | 613 return; |
| 614 } | 614 } |
| 615 | |
| 616 // Globalize the script object, make it weak and use the location of the | 615 // Globalize the script object, make it weak and use the location of the |
| 617 // global handle as the value in the hash map. | 616 // global handle as the value in the hash map. |
| 618 Handle<Script> script_ = | 617 Handle<Script> script_ = |
| 619 Handle<Script>::cast( | 618 Handle<Script>::cast( |
| 620 (global_handles->Create(*script))); | 619 (global_handles->Create(*script))); |
| 621 global_handles->MakeWeak(reinterpret_cast<Object**>(script_.location()), | 620 global_handles->MakeWeak(reinterpret_cast<Object**>(script_.location()), |
| 622 this, | 621 this, |
| 623 NULL, | 622 NULL, |
| 624 ScriptCache::HandleWeakScript); | 623 ScriptCache::HandleWeakScript); |
| 625 entry->value = script_.location(); | 624 entry->value = script_.location(); |
| (...skipping 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3796 { | 3795 { |
| 3797 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3796 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 3798 isolate_->debugger()->CallMessageDispatchHandler(); | 3797 isolate_->debugger()->CallMessageDispatchHandler(); |
| 3799 } | 3798 } |
| 3800 } | 3799 } |
| 3801 } | 3800 } |
| 3802 | 3801 |
| 3803 #endif // ENABLE_DEBUGGER_SUPPORT | 3802 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3804 | 3803 |
| 3805 } } // namespace v8::internal | 3804 } } // namespace v8::internal |
| OLD | NEW |