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

Side by Side Diff: src/snapshot/serialize.cc

Issue 1728593002: [Interpreter] Add support for cpu profiler logging. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
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/snapshot/serialize.h" 5 #include "src/snapshot/serialize.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/platform/platform.h" 9 #include "src/base/platform/platform.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 public: 380 public:
381 explicit CodeAddressMap(Isolate* isolate) 381 explicit CodeAddressMap(Isolate* isolate)
382 : isolate_(isolate) { 382 : isolate_(isolate) {
383 isolate->logger()->addCodeEventListener(this); 383 isolate->logger()->addCodeEventListener(this);
384 } 384 }
385 385
386 ~CodeAddressMap() override { 386 ~CodeAddressMap() override {
387 isolate_->logger()->removeCodeEventListener(this); 387 isolate_->logger()->removeCodeEventListener(this);
388 } 388 }
389 389
390 void CodeMoveEvent(Address from, Address to) override { 390 void CodeMoveEvent(AbstractCode* from, Address to) override {
391 address_to_name_map_.Move(from, to); 391 address_to_name_map_.Move(from->address(), to);
392 } 392 }
393 393
394 void CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) override {} 394 void CodeDisableOptEvent(AbstractCode* code,
395 SharedFunctionInfo* shared) override {}
395 396
396 void CodeDeleteEvent(Address from) override { 397 void CodeDeleteEvent(AbstractCode* from) override {
397 address_to_name_map_.Remove(from); 398 address_to_name_map_.Remove(from->address());
398 } 399 }
399 400
400 const char* Lookup(Address address) { 401 const char* Lookup(Address address) {
401 return address_to_name_map_.Lookup(address); 402 return address_to_name_map_.Lookup(address);
402 } 403 }
403 404
404 private: 405 private:
405 class NameMap { 406 class NameMap {
406 public: 407 public:
407 NameMap() : impl_(HashMap::PointersMatch) {} 408 NameMap() : impl_(HashMap::PointersMatch) {}
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 467
467 void RemoveEntry(HashMap::Entry* entry) { 468 void RemoveEntry(HashMap::Entry* entry) {
468 impl_.Remove(entry->key, entry->hash); 469 impl_.Remove(entry->key, entry->hash);
469 } 470 }
470 471
471 HashMap impl_; 472 HashMap impl_;
472 473
473 DISALLOW_COPY_AND_ASSIGN(NameMap); 474 DISALLOW_COPY_AND_ASSIGN(NameMap);
474 }; 475 };
475 476
476 void LogRecordedBuffer(Code* code, SharedFunctionInfo*, const char* name, 477 void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo*,
477 int length) override { 478 const char* name, int length) override {
478 address_to_name_map_.Insert(code->address(), name, length); 479 address_to_name_map_.Insert(code->address(), name, length);
479 } 480 }
480 481
481 NameMap address_to_name_map_; 482 NameMap address_to_name_map_;
482 Isolate* isolate_; 483 Isolate* isolate_;
483 }; 484 };
484 485
485 486
486 void Deserializer::DecodeReservation( 487 void Deserializer::DecodeReservation(
487 Vector<const SerializedData::Reservation> res) { 488 Vector<const SerializedData::Reservation> res) {
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 } 2629 }
2629 result->set_deserialized(true); 2630 result->set_deserialized(true);
2630 2631
2631 if (isolate->logger()->is_logging_code_events() || 2632 if (isolate->logger()->is_logging_code_events() ||
2632 isolate->cpu_profiler()->is_profiling()) { 2633 isolate->cpu_profiler()->is_profiling()) {
2633 String* name = isolate->heap()->empty_string(); 2634 String* name = isolate->heap()->empty_string();
2634 if (result->script()->IsScript()) { 2635 if (result->script()->IsScript()) {
2635 Script* script = Script::cast(result->script()); 2636 Script* script = Script::cast(result->script());
2636 if (script->name()->IsString()) name = String::cast(script->name()); 2637 if (script->name()->IsString()) name = String::cast(script->name());
2637 } 2638 }
2638 isolate->logger()->CodeCreateEvent(Logger::SCRIPT_TAG, result->code(), 2639 isolate->logger()->CodeCreateEvent(Logger::SCRIPT_TAG,
2640 AbstractCode::cast(result->code()),
2639 *result, NULL, name); 2641 *result, NULL, name);
2640 } 2642 }
2641 return scope.CloseAndEscape(result); 2643 return scope.CloseAndEscape(result);
2642 } 2644 }
2643 2645
2644 2646
2645 void SerializedData::AllocateData(int size) { 2647 void SerializedData::AllocateData(int size) {
2646 DCHECK(!owns_data_); 2648 DCHECK(!owns_data_);
2647 data_ = NewArray<byte>(size); 2649 data_ = NewArray<byte>(size);
2648 size_ = size; 2650 size_ = size;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2868 SerializedCodeData* scd = new SerializedCodeData(cached_data); 2870 SerializedCodeData* scd = new SerializedCodeData(cached_data);
2869 SanityCheckResult r = scd->SanityCheck(isolate, source); 2871 SanityCheckResult r = scd->SanityCheck(isolate, source);
2870 if (r == CHECK_SUCCESS) return scd; 2872 if (r == CHECK_SUCCESS) return scd;
2871 cached_data->Reject(); 2873 cached_data->Reject();
2872 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r); 2874 source->GetIsolate()->counters()->code_cache_reject_reason()->AddSample(r);
2873 delete scd; 2875 delete scd;
2874 return NULL; 2876 return NULL;
2875 } 2877 }
2876 } // namespace internal 2878 } // namespace internal
2877 } // namespace v8 2879 } // namespace v8
OLDNEW
« src/isolate.h ('K') | « src/runtime/runtime-function.cc ('k') | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698