Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: src/debug.cc

Issue 17600006: CPUProfiler: It is not clear why we are using Handle<Object> for scriptId. Lets flip it into Smi/in… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: comments addressed Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.cc ('k') | src/factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 return reinterpret_cast<Object**>(&Memory::Object_at( 599 return reinterpret_cast<Object**>(&Memory::Object_at(
600 fp + StandardFrameConstants::kContextOffset)); 600 fp + StandardFrameConstants::kContextOffset));
601 } 601 }
602 602
603 const int Debug::kFrameDropperFrameSize = 4; 603 const int Debug::kFrameDropperFrameSize = 4;
604 604
605 605
606 void ScriptCache::Add(Handle<Script> script) { 606 void ScriptCache::Add(Handle<Script> script) {
607 GlobalHandles* global_handles = Isolate::Current()->global_handles(); 607 GlobalHandles* global_handles = Isolate::Current()->global_handles();
608 // Create an entry in the hash map for the script. 608 // Create an entry in the hash map for the script.
609 int id = Smi::cast(script->id())->value(); 609 int id = script->id()->value();
610 HashMap::Entry* entry = 610 HashMap::Entry* entry =
611 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); 611 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true);
612 if (entry->value != NULL) { 612 if (entry->value != NULL) {
613 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); 613 ASSERT(*script == *reinterpret_cast<Script**>(entry->value));
614 return; 614 return;
615 } 615 }
616 // Globalize the script object, make it weak and use the location of the 616 // Globalize the script object, make it weak and use the location of the
617 // global handle as the value in the hash map. 617 // global handle as the value in the hash map.
618 Handle<Script> script_ = 618 Handle<Script> script_ =
619 Handle<Script>::cast( 619 Handle<Script>::cast(
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 void ScriptCache::HandleWeakScript(v8::Isolate* isolate, 667 void ScriptCache::HandleWeakScript(v8::Isolate* isolate,
668 v8::Persistent<v8::Value>* obj, 668 v8::Persistent<v8::Value>* obj,
669 void* data) { 669 void* data) {
670 ScriptCache* script_cache = reinterpret_cast<ScriptCache*>(data); 670 ScriptCache* script_cache = reinterpret_cast<ScriptCache*>(data);
671 // Find the location of the global handle. 671 // Find the location of the global handle.
672 Script** location = 672 Script** location =
673 reinterpret_cast<Script**>(Utils::OpenPersistent(*obj).location()); 673 reinterpret_cast<Script**>(Utils::OpenPersistent(*obj).location());
674 ASSERT((*location)->IsScript()); 674 ASSERT((*location)->IsScript());
675 675
676 // Remove the entry from the cache. 676 // Remove the entry from the cache.
677 int id = Smi::cast((*location)->id())->value(); 677 int id = (*location)->id()->value();
678 script_cache->Remove(reinterpret_cast<void*>(id), Hash(id)); 678 script_cache->Remove(reinterpret_cast<void*>(id), Hash(id));
679 script_cache->collected_scripts_.Add(id); 679 script_cache->collected_scripts_.Add(id);
680 680
681 // Clear the weak handle. 681 // Clear the weak handle.
682 obj->Dispose(isolate); 682 obj->Dispose(isolate);
683 } 683 }
684 684
685 685
686 void Debug::SetUp(bool create_heap_objects) { 686 void Debug::SetUp(bool create_heap_objects) {
687 ThreadInit(); 687 ThreadInit();
(...skipping 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after
3800 { 3800 {
3801 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); 3801 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_));
3802 isolate_->debugger()->CallMessageDispatchHandler(); 3802 isolate_->debugger()->CallMessageDispatchHandler();
3803 } 3803 }
3804 } 3804 }
3805 } 3805 }
3806 3806
3807 #endif // ENABLE_DEBUGGER_SUPPORT 3807 #endif // ENABLE_DEBUGGER_SUPPORT
3808 3808
3809 } } // namespace v8::internal 3809 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698