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

Side by Side Diff: src/debug.cc

Issue 406253004: Do not reverse lookup code stubs dictionary to find stub key. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/compiler.cc ('k') | src/disassembler.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 // 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
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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 if (is_at_restarted_function) { 1482 if (is_at_restarted_function) {
1476 Handle<JSFunction> restarted_function( 1483 Handle<JSFunction> restarted_function(
1477 JSFunction::cast(*thread_local_.restarter_frame_function_pointer_)); 1484 JSFunction::cast(*thread_local_.restarter_frame_function_pointer_));
1478 FloodWithOneShot(restarted_function); 1485 FloodWithOneShot(restarted_function);
1479 } else if (!call_function_stub.is_null()) { 1486 } else if (!call_function_stub.is_null()) {
1480 // If it's CallFunction stub ensure target function is compiled and flood 1487 // If it's CallFunction stub ensure target function is compiled and flood
1481 // it with one shot breakpoints. 1488 // it with one shot breakpoints.
1482 bool is_call_ic = call_function_stub->kind() == Code::CALL_IC; 1489 bool is_call_ic = call_function_stub->kind() == Code::CALL_IC;
1483 1490
1484 // Find out number of arguments from the stub minor key. 1491 // Find out number of arguments from the stub minor key.
1485 // Reverse lookup required as the minor key cannot be retrieved 1492 uint32_t key = call_function_stub->stub_key();
1486 // from the code object.
1487 Handle<Object> obj(
1488 isolate_->heap()->code_stubs()->SlowReverseLookup(
1489 *call_function_stub),
1490 isolate_);
1491 ASSERT(!obj.is_null());
1492 ASSERT(!(*obj)->IsUndefined());
1493 ASSERT(obj->IsSmi());
1494 // Get the STUB key and extract major and minor key.
1495 uint32_t key = Smi::cast(*obj)->value();
1496 // Argc in the stub is the number of arguments passed - not the 1493 // Argc in the stub is the number of arguments passed - not the
1497 // expected arguments of the called function. 1494 // expected arguments of the called function.
1498 int call_function_arg_count = is_call_ic 1495 int call_function_arg_count = is_call_ic
1499 ? CallICStub::ExtractArgcFromMinorKey(CodeStub::MinorKeyFromKey(key)) 1496 ? CallICStub::ExtractArgcFromMinorKey(CodeStub::MinorKeyFromKey(key))
1500 : CallFunctionStub::ExtractArgcFromMinorKey( 1497 : CallFunctionStub::ExtractArgcFromMinorKey(
1501 CodeStub::MinorKeyFromKey(key)); 1498 CodeStub::MinorKeyFromKey(key));
1502 1499
1503 ASSERT(is_call_ic || 1500 ASSERT(is_call_ic ||
1504 CodeStub::GetMajorKey(*call_function_stub) == 1501 CodeStub::GetMajorKey(*call_function_stub) ==
1505 CodeStub::MajorKeyFromKey(key)); 1502 CodeStub::MajorKeyFromKey(key));
(...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after
3400 logger_->DebugEvent("Put", message.text()); 3397 logger_->DebugEvent("Put", message.text());
3401 } 3398 }
3402 3399
3403 3400
3404 void LockingCommandMessageQueue::Clear() { 3401 void LockingCommandMessageQueue::Clear() {
3405 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3402 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3406 queue_.Clear(); 3403 queue_.Clear();
3407 } 3404 }
3408 3405
3409 } } // namespace v8::internal 3406 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/disassembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698