| 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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 void ScriptCache::Add(Handle<Script> script) { | 604 void ScriptCache::Add(Handle<Script> script) { |
| 605 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 605 GlobalHandles* global_handles = Isolate::Current()->global_handles(); |
| 606 // Create an entry in the hash map for the script. | 606 // Create an entry in the hash map for the script. |
| 607 int id = Smi::cast(script->id())->value(); | 607 int id = Smi::cast(script->id())->value(); |
| 608 HashMap::Entry* entry = | 608 HashMap::Entry* entry = |
| 609 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); | 609 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); |
| 610 if (entry->value != NULL) { | 610 if (entry->value != NULL) { |
| 611 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); | 611 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); |
| 612 return; | 612 return; |
| 613 } | 613 } |
| 614 | |
| 615 // Globalize the script object, make it weak and use the location of the | 614 // Globalize the script object, make it weak and use the location of the |
| 616 // global handle as the value in the hash map. | 615 // global handle as the value in the hash map. |
| 617 Handle<Script> script_ = | 616 Handle<Script> script_ = |
| 618 Handle<Script>::cast( | 617 Handle<Script>::cast( |
| 619 (global_handles->Create(*script))); | 618 (global_handles->Create(*script))); |
| 620 global_handles->MakeWeak(reinterpret_cast<Object**>(script_.location()), | 619 global_handles->MakeWeak(reinterpret_cast<Object**>(script_.location()), |
| 621 this, | 620 this, |
| 622 NULL, | 621 NULL, |
| 623 ScriptCache::HandleWeakScript); | 622 ScriptCache::HandleWeakScript); |
| 624 entry->value = script_.location(); | 623 entry->value = script_.location(); |
| (...skipping 3170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3795 { | 3794 { |
| 3796 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3795 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 3797 isolate_->debugger()->CallMessageDispatchHandler(); | 3796 isolate_->debugger()->CallMessageDispatchHandler(); |
| 3798 } | 3797 } |
| 3799 } | 3798 } |
| 3800 } | 3799 } |
| 3801 | 3800 |
| 3802 #endif // ENABLE_DEBUGGER_SUPPORT | 3801 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3803 | 3802 |
| 3804 } } // namespace v8::internal | 3803 } } // namespace v8::internal |
| OLD | NEW |