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

Side by Side Diff: src/api.cc

Issue 12475016: Maintain API compatibility with older versions of V8. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 | « include/v8-profiler.h ('k') | src/codegen.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 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 1878
1879 1879
1880 v8::TryCatch::TryCatch() 1880 v8::TryCatch::TryCatch()
1881 : isolate_(i::Isolate::Current()), 1881 : isolate_(i::Isolate::Current()),
1882 next_(isolate_->try_catch_handler_address()), 1882 next_(isolate_->try_catch_handler_address()),
1883 exception_(isolate_->heap()->the_hole_value()), 1883 exception_(isolate_->heap()->the_hole_value()),
1884 message_(i::Smi::FromInt(0)), 1884 message_(i::Smi::FromInt(0)),
1885 is_verbose_(false), 1885 is_verbose_(false),
1886 can_continue_(true), 1886 can_continue_(true),
1887 capture_message_(true), 1887 capture_message_(true),
1888 rethrow_(false), 1888 rethrow_(false) {
1889 has_terminated_(false) {
1890 isolate_->RegisterTryCatchHandler(this); 1889 isolate_->RegisterTryCatchHandler(this);
1891 } 1890 }
1892 1891
1893 1892
1894 v8::TryCatch::~TryCatch() { 1893 v8::TryCatch::~TryCatch() {
1895 ASSERT(isolate_ == i::Isolate::Current()); 1894 ASSERT(isolate_ == i::Isolate::Current());
1896 if (rethrow_) { 1895 if (rethrow_) {
1897 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_)); 1896 v8::HandleScope scope(reinterpret_cast<Isolate*>(isolate_));
1898 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception()); 1897 v8::Local<v8::Value> exc = v8::Local<v8::Value>::New(Exception());
1899 isolate_->UnregisterTryCatchHandler(this); 1898 isolate_->UnregisterTryCatchHandler(this);
1900 v8::ThrowException(exc); 1899 v8::ThrowException(exc);
1901 } else { 1900 } else {
1902 isolate_->UnregisterTryCatchHandler(this); 1901 isolate_->UnregisterTryCatchHandler(this);
1903 } 1902 }
1904 } 1903 }
1905 1904
1906 1905
1907 bool v8::TryCatch::HasCaught() const { 1906 bool v8::TryCatch::HasCaught() const {
1908 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole(); 1907 return !reinterpret_cast<i::Object*>(exception_)->IsTheHole();
1909 } 1908 }
1910 1909
1911 1910
1912 bool v8::TryCatch::CanContinue() const { 1911 bool v8::TryCatch::CanContinue() const {
1913 return can_continue_; 1912 return can_continue_;
1914 } 1913 }
1915 1914
1916 1915
1917 bool v8::TryCatch::HasTerminated() const {
1918 return has_terminated_;
1919 }
1920
1921
1922 v8::Handle<v8::Value> v8::TryCatch::ReThrow() { 1916 v8::Handle<v8::Value> v8::TryCatch::ReThrow() {
1923 if (!HasCaught()) return v8::Local<v8::Value>(); 1917 if (!HasCaught()) return v8::Local<v8::Value>();
1924 rethrow_ = true; 1918 rethrow_ = true;
1925 return v8::Undefined(); 1919 return v8::Undefined();
1926 } 1920 }
1927 1921
1928 1922
1929 v8::Local<Value> v8::TryCatch::Exception() const { 1923 v8::Local<Value> v8::TryCatch::Exception() const {
1930 ASSERT(isolate_ == i::Isolate::Current()); 1924 ASSERT(isolate_ == i::Isolate::Current());
1931 if (HasCaught()) { 1925 if (HasCaught()) {
(...skipping 3874 matching lines...) Expand 10 before | Expand all | Expand 10 after
5806 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 5800 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5807 if (isolate == NULL || !isolate->IsInitialized() || 5801 if (isolate == NULL || !isolate->IsInitialized() ||
5808 IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) { 5802 IsDeadCheck(isolate, "v8::V8::AdjustAmountOfExternalAllocatedMemory()")) {
5809 return 0; 5803 return 0;
5810 } 5804 }
5811 Isolate* isolate_ext = reinterpret_cast<Isolate*>(isolate); 5805 Isolate* isolate_ext = reinterpret_cast<Isolate*>(isolate);
5812 return isolate_ext->AdjustAmountOfExternalAllocatedMemory(change_in_bytes); 5806 return isolate_ext->AdjustAmountOfExternalAllocatedMemory(change_in_bytes);
5813 } 5807 }
5814 5808
5815 5809
5816 HeapProfiler* Isolate::GetHeapProfiler() {
5817 i::HeapProfiler* heap_profiler =
5818 reinterpret_cast<i::Isolate*>(this)->heap_profiler();
5819 return reinterpret_cast<HeapProfiler*>(heap_profiler);
5820 }
5821
5822
5823 CpuProfiler* Isolate::GetCpuProfiler() {
5824 i::CpuProfiler* cpu_profiler =
5825 reinterpret_cast<i::Isolate*>(this)->cpu_profiler();
5826 return reinterpret_cast<CpuProfiler*>(cpu_profiler);
5827 }
5828
5829
5830 void V8::SetGlobalGCPrologueCallback(GCCallback callback) { 5810 void V8::SetGlobalGCPrologueCallback(GCCallback callback) {
5831 i::Isolate* isolate = i::Isolate::Current(); 5811 i::Isolate* isolate = i::Isolate::Current();
5832 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return; 5812 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCPrologueCallback()")) return;
5833 isolate->heap()->SetGlobalGCPrologueCallback(callback); 5813 isolate->heap()->SetGlobalGCPrologueCallback(callback);
5834 } 5814 }
5835 5815
5836 5816
5837 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) { 5817 void V8::SetGlobalGCEpilogueCallback(GCCallback callback) {
5838 i::Isolate* isolate = i::Isolate::Current(); 5818 i::Isolate* isolate = i::Isolate::Current();
5839 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCEpilogueCallback()")) return; 5819 if (IsDeadCheck(isolate, "v8::V8::SetGlobalGCEpilogueCallback()")) return;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
5955 } 5935 }
5956 5936
5957 5937
5958 bool V8::IsExecutionTerminating(Isolate* isolate) { 5938 bool V8::IsExecutionTerminating(Isolate* isolate) {
5959 i::Isolate* i_isolate = isolate != NULL ? 5939 i::Isolate* i_isolate = isolate != NULL ?
5960 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current(); 5940 reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current();
5961 return IsExecutionTerminatingCheck(i_isolate); 5941 return IsExecutionTerminatingCheck(i_isolate);
5962 } 5942 }
5963 5943
5964 5944
5965 void V8::CancelTerminateExecution(Isolate* isolate) {
5966 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
5967 i_isolate->stack_guard()->CancelTerminateExecution();
5968 }
5969
5970
5971 Isolate* Isolate::GetCurrent() { 5945 Isolate* Isolate::GetCurrent() {
5972 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 5946 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5973 return reinterpret_cast<Isolate*>(isolate); 5947 return reinterpret_cast<Isolate*>(isolate);
5974 } 5948 }
5975 5949
5976 5950
5977 Isolate* Isolate::New() { 5951 Isolate* Isolate::New() {
5978 i::Isolate* isolate = new i::Isolate(); 5952 i::Isolate* isolate = new i::Isolate();
5979 return reinterpret_cast<Isolate*>(isolate); 5953 return reinterpret_cast<Isolate*>(isolate);
5980 } 5954 }
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
6473 } 6447 }
6474 6448
6475 6449
6476 unsigned CpuProfileNode::GetCallUid() const { 6450 unsigned CpuProfileNode::GetCallUid() const {
6477 i::Isolate* isolate = i::Isolate::Current(); 6451 i::Isolate* isolate = i::Isolate::Current();
6478 IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid"); 6452 IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid");
6479 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid(); 6453 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid();
6480 } 6454 }
6481 6455
6482 6456
6483 unsigned CpuProfileNode::GetNodeId() const {
6484 return reinterpret_cast<const i::ProfileNode*>(this)->id();
6485 }
6486
6487
6488 int CpuProfileNode::GetChildrenCount() const { 6457 int CpuProfileNode::GetChildrenCount() const {
6489 i::Isolate* isolate = i::Isolate::Current(); 6458 i::Isolate* isolate = i::Isolate::Current();
6490 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount"); 6459 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount");
6491 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length(); 6460 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length();
6492 } 6461 }
6493 6462
6494 6463
6495 const CpuProfileNode* CpuProfileNode::GetChild(int index) const { 6464 const CpuProfileNode* CpuProfileNode::GetChild(int index) const {
6496 i::Isolate* isolate = i::Isolate::Current(); 6465 i::Isolate* isolate = i::Isolate::Current();
6497 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild"); 6466 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild");
6498 const i::ProfileNode* child = 6467 const i::ProfileNode* child =
6499 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); 6468 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index);
6500 return reinterpret_cast<const CpuProfileNode*>(child); 6469 return reinterpret_cast<const CpuProfileNode*>(child);
6501 } 6470 }
6502 6471
6503 6472
6504 void CpuProfile::Delete() { 6473 void CpuProfile::Delete() {
6505 i::Isolate* isolate = i::Isolate::Current(); 6474 i::Isolate* isolate = i::Isolate::Current();
6506 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); 6475 IsDeadCheck(isolate, "v8::CpuProfile::Delete");
6507 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6476 i::CpuProfiler::DeleteProfile(reinterpret_cast<i::CpuProfile*>(this));
6508 ASSERT(profiler != NULL); 6477 if (i::CpuProfiler::GetProfilesCount() == 0 &&
6509 profiler->DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); 6478 !i::CpuProfiler::HasDetachedProfiles()) {
6510 if (profiler->GetProfilesCount() == 0 && !profiler->HasDetachedProfiles()) {
6511 // If this was the last profile, clean up all accessory data as well. 6479 // If this was the last profile, clean up all accessory data as well.
6512 profiler->DeleteAllProfiles(); 6480 i::CpuProfiler::DeleteAllProfiles();
6513 } 6481 }
6514 } 6482 }
6515 6483
6516 6484
6517 unsigned CpuProfile::GetUid() const { 6485 unsigned CpuProfile::GetUid() const {
6518 i::Isolate* isolate = i::Isolate::Current(); 6486 i::Isolate* isolate = i::Isolate::Current();
6519 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); 6487 IsDeadCheck(isolate, "v8::CpuProfile::GetUid");
6520 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); 6488 return reinterpret_cast<const i::CpuProfile*>(this)->uid();
6521 } 6489 }
6522 6490
6523 6491
6524 Handle<String> CpuProfile::GetTitle() const { 6492 Handle<String> CpuProfile::GetTitle() const {
6525 i::Isolate* isolate = i::Isolate::Current(); 6493 i::Isolate* isolate = i::Isolate::Current();
6526 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); 6494 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
6527 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 6495 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
6528 return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String( 6496 return Handle<String>(ToApi<String>(isolate->factory()->InternalizeUtf8String(
6529 profile->title()))); 6497 profile->title())));
6530 } 6498 }
6531 6499
6532 6500
6533 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { 6501 const CpuProfileNode* CpuProfile::GetTopDownRoot() const {
6534 i::Isolate* isolate = i::Isolate::Current(); 6502 i::Isolate* isolate = i::Isolate::Current();
6535 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); 6503 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot");
6536 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 6504 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
6537 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); 6505 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root());
6538 } 6506 }
6539 6507
6540 6508
6541 const CpuProfileNode* CpuProfile::GetSample(int index) const {
6542 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
6543 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index));
6544 }
6545
6546
6547 int CpuProfile::GetSamplesCount() const {
6548 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count();
6549 }
6550
6551
6552 int CpuProfiler::GetProfilesCount() { 6509 int CpuProfiler::GetProfilesCount() {
6553 i::Isolate* isolate = i::Isolate::Current(); 6510 i::Isolate* isolate = i::Isolate::Current();
6554 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount"); 6511 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount");
6555 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6512 return i::CpuProfiler::GetProfilesCount();
6556 ASSERT(profiler != NULL);
6557 return profiler->GetProfilesCount();
6558 } 6513 }
6559 6514
6560 6515
6561 int CpuProfiler::GetProfileCount() {
6562 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount();
6563 }
6564
6565
6566 const CpuProfile* CpuProfiler::GetProfile(int index, 6516 const CpuProfile* CpuProfiler::GetProfile(int index,
6567 Handle<Value> security_token) { 6517 Handle<Value> security_token) {
6568 i::Isolate* isolate = i::Isolate::Current(); 6518 i::Isolate* isolate = i::Isolate::Current();
6569 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile"); 6519 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile");
6570 i::CpuProfiler* profiler = isolate->cpu_profiler();
6571 ASSERT(profiler != NULL);
6572 return reinterpret_cast<const CpuProfile*>( 6520 return reinterpret_cast<const CpuProfile*>(
6573 profiler->GetProfile( 6521 i::CpuProfiler::GetProfile(
6574 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6522 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6575 index)); 6523 index));
6576 } 6524 }
6577
6578
6579 const CpuProfile* CpuProfiler::GetCpuProfile(int index,
6580 Handle<Value> security_token) {
6581 return reinterpret_cast<const CpuProfile*>(
6582 reinterpret_cast<i::CpuProfiler*>(this)->GetProfile(
6583 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6584 index));
6585 }
6586 6525
6587 6526
6588 const CpuProfile* CpuProfiler::FindProfile(unsigned uid, 6527 const CpuProfile* CpuProfiler::FindProfile(unsigned uid,
6589 Handle<Value> security_token) { 6528 Handle<Value> security_token) {
6590 i::Isolate* isolate = i::Isolate::Current(); 6529 i::Isolate* isolate = i::Isolate::Current();
6591 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile"); 6530 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile");
6592 i::CpuProfiler* profiler = isolate->cpu_profiler();
6593 ASSERT(profiler != NULL);
6594 return reinterpret_cast<const CpuProfile*>( 6531 return reinterpret_cast<const CpuProfile*>(
6595 profiler->FindProfile( 6532 i::CpuProfiler::FindProfile(
6596 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6533 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6597 uid)); 6534 uid));
6598 } 6535 }
6599 6536
6600 6537
6601 const CpuProfile* CpuProfiler::FindCpuProfile(unsigned uid, 6538 void CpuProfiler::StartProfiling(Handle<String> title) {
6602 Handle<Value> security_token) { 6539 i::Isolate* isolate = i::Isolate::Current();
6603 return reinterpret_cast<const CpuProfile*>( 6540 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
6604 reinterpret_cast<i::CpuProfiler*>(this)->FindProfile( 6541 i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title));
6605 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6606 uid));
6607 } 6542 }
6608 6543
6609 6544
6610 void CpuProfiler::StartProfiling(Handle<String> title, bool record_samples) {
6611 i::Isolate* isolate = i::Isolate::Current();
6612 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
6613 i::CpuProfiler* profiler = isolate->cpu_profiler();
6614 ASSERT(profiler != NULL);
6615 profiler->StartProfiling(*Utils::OpenHandle(*title), record_samples);
6616 }
6617
6618
6619 void CpuProfiler::StartCpuProfiling(Handle<String> title, bool record_samples) {
6620 reinterpret_cast<i::CpuProfiler*>(this)->StartProfiling(
6621 *Utils::OpenHandle(*title), record_samples);
6622 }
6623
6624
6625 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, 6545 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title,
6626 Handle<Value> security_token) { 6546 Handle<Value> security_token) {
6627 i::Isolate* isolate = i::Isolate::Current(); 6547 i::Isolate* isolate = i::Isolate::Current();
6628 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); 6548 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling");
6629 i::CpuProfiler* profiler = isolate->cpu_profiler();
6630 ASSERT(profiler != NULL);
6631 return reinterpret_cast<const CpuProfile*>( 6549 return reinterpret_cast<const CpuProfile*>(
6632 profiler->StopProfiling( 6550 i::CpuProfiler::StopProfiling(
6633 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 6551 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6634 *Utils::OpenHandle(*title))); 6552 *Utils::OpenHandle(*title)));
6635 } 6553 }
6636
6637
6638 const CpuProfile* CpuProfiler::StopCpuProfiling(Handle<String> title,
6639 Handle<Value> security_token) {
6640 return reinterpret_cast<const CpuProfile*>(
6641 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling(
6642 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
6643 *Utils::OpenHandle(*title)));
6644 }
6645 6554
6646 6555
6647 void CpuProfiler::DeleteAllProfiles() { 6556 void CpuProfiler::DeleteAllProfiles() {
6648 i::Isolate* isolate = i::Isolate::Current(); 6557 i::Isolate* isolate = i::Isolate::Current();
6649 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); 6558 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles");
6650 i::CpuProfiler* profiler = isolate->cpu_profiler(); 6559 i::CpuProfiler::DeleteAllProfiles();
6651 ASSERT(profiler != NULL);
6652 profiler->DeleteAllProfiles();
6653 } 6560 }
6654 6561
6655 6562
6656 void CpuProfiler::DeleteAllCpuProfiles() {
6657 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles();
6658 }
6659
6660
6661 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 6563 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
6662 return const_cast<i::HeapGraphEdge*>( 6564 return const_cast<i::HeapGraphEdge*>(
6663 reinterpret_cast<const i::HeapGraphEdge*>(edge)); 6565 reinterpret_cast<const i::HeapGraphEdge*>(edge));
6664 } 6566 }
6665 6567
6666 6568
6667 HeapGraphEdge::Type HeapGraphEdge::GetType() const { 6569 HeapGraphEdge::Type HeapGraphEdge::GetType() const {
6668 i::Isolate* isolate = i::Isolate::Current(); 6570 i::Isolate* isolate = i::Isolate::Current();
6669 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType"); 6571 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType");
6670 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type()); 6572 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
6770 6672
6771 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { 6673 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) {
6772 return const_cast<i::HeapSnapshot*>( 6674 return const_cast<i::HeapSnapshot*>(
6773 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); 6675 reinterpret_cast<const i::HeapSnapshot*>(snapshot));
6774 } 6676 }
6775 6677
6776 6678
6777 void HeapSnapshot::Delete() { 6679 void HeapSnapshot::Delete() {
6778 i::Isolate* isolate = i::Isolate::Current(); 6680 i::Isolate* isolate = i::Isolate::Current();
6779 IsDeadCheck(isolate, "v8::HeapSnapshot::Delete"); 6681 IsDeadCheck(isolate, "v8::HeapSnapshot::Delete");
6780 if (isolate->heap_profiler()->GetSnapshotsCount() > 1) { 6682 if (i::HeapProfiler::GetSnapshotsCount() > 1) {
6781 ToInternal(this)->Delete(); 6683 ToInternal(this)->Delete();
6782 } else { 6684 } else {
6783 // If this is the last snapshot, clean up all accessory data as well. 6685 // If this is the last snapshot, clean up all accessory data as well.
6784 isolate->heap_profiler()->DeleteAllSnapshots(); 6686 i::HeapProfiler::DeleteAllSnapshots();
6785 } 6687 }
6786 } 6688 }
6787 6689
6788 6690
6789 HeapSnapshot::Type HeapSnapshot::GetType() const { 6691 HeapSnapshot::Type HeapSnapshot::GetType() const {
6790 i::Isolate* isolate = i::Isolate::Current(); 6692 i::Isolate* isolate = i::Isolate::Current();
6791 IsDeadCheck(isolate, "v8::HeapSnapshot::GetType"); 6693 IsDeadCheck(isolate, "v8::HeapSnapshot::GetType");
6792 return kFull; 6694 return static_cast<HeapSnapshot::Type>(ToInternal(this)->type());
6793 } 6695 }
6794 6696
6795 6697
6796 unsigned HeapSnapshot::GetUid() const { 6698 unsigned HeapSnapshot::GetUid() const {
6797 i::Isolate* isolate = i::Isolate::Current(); 6699 i::Isolate* isolate = i::Isolate::Current();
6798 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid"); 6700 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid");
6799 return ToInternal(this)->uid(); 6701 return ToInternal(this)->uid();
6800 } 6702 }
6801 6703
6802 6704
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
6859 "v8::HeapSnapshot::Serialize", 6761 "v8::HeapSnapshot::Serialize",
6860 "Invalid stream chunk size"); 6762 "Invalid stream chunk size");
6861 i::HeapSnapshotJSONSerializer serializer(ToInternal(this)); 6763 i::HeapSnapshotJSONSerializer serializer(ToInternal(this));
6862 serializer.Serialize(stream); 6764 serializer.Serialize(stream);
6863 } 6765 }
6864 6766
6865 6767
6866 int HeapProfiler::GetSnapshotsCount() { 6768 int HeapProfiler::GetSnapshotsCount() {
6867 i::Isolate* isolate = i::Isolate::Current(); 6769 i::Isolate* isolate = i::Isolate::Current();
6868 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount"); 6770 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount");
6869 return isolate->heap_profiler()->GetSnapshotsCount(); 6771 return i::HeapProfiler::GetSnapshotsCount();
6870 } 6772 }
6871 6773
6872 6774
6873 int HeapProfiler::GetSnapshotCount() {
6874 return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotsCount();
6875 }
6876
6877
6878 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) { 6775 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
6879 i::Isolate* isolate = i::Isolate::Current(); 6776 i::Isolate* isolate = i::Isolate::Current();
6880 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot"); 6777 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot");
6881 return reinterpret_cast<const HeapSnapshot*>( 6778 return reinterpret_cast<const HeapSnapshot*>(
6882 isolate->heap_profiler()->GetSnapshot(index)); 6779 i::HeapProfiler::GetSnapshot(index));
6883 } 6780 }
6884 6781
6885 6782
6886 const HeapSnapshot* HeapProfiler::GetHeapSnapshot(int index) {
6887 return reinterpret_cast<const HeapSnapshot*>(
6888 reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshot(index));
6889 }
6890
6891
6892 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { 6783 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
6893 i::Isolate* isolate = i::Isolate::Current(); 6784 i::Isolate* isolate = i::Isolate::Current();
6894 IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot"); 6785 IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot");
6895 return reinterpret_cast<const HeapSnapshot*>( 6786 return reinterpret_cast<const HeapSnapshot*>(
6896 isolate->heap_profiler()->FindSnapshot(uid)); 6787 i::HeapProfiler::FindSnapshot(uid));
6897 } 6788 }
6898 6789
6899 6790
6900 const HeapSnapshot* HeapProfiler::FindHeapSnapshot(unsigned uid) {
6901 return reinterpret_cast<const HeapSnapshot*>(
6902 reinterpret_cast<i::HeapProfiler*>(this)->FindSnapshot(uid));
6903 }
6904
6905
6906 SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Value> value) { 6791 SnapshotObjectId HeapProfiler::GetSnapshotObjectId(Handle<Value> value) {
6907 i::Isolate* isolate = i::Isolate::Current(); 6792 i::Isolate* isolate = i::Isolate::Current();
6908 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotObjectId"); 6793 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotObjectId");
6909 i::Handle<i::Object> obj = Utils::OpenHandle(*value); 6794 i::Handle<i::Object> obj = Utils::OpenHandle(*value);
6910 return isolate->heap_profiler()->GetSnapshotObjectId(obj); 6795 return i::HeapProfiler::GetSnapshotObjectId(obj);
6911 } 6796 }
6912 6797
6913 6798
6914 SnapshotObjectId HeapProfiler::GetObjectId(Handle<Value> value) {
6915 i::Handle<i::Object> obj = Utils::OpenHandle(*value);
6916 return reinterpret_cast<i::HeapProfiler*>(this)->GetSnapshotObjectId(obj);
6917 }
6918
6919
6920 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, 6799 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
6921 HeapSnapshot::Type type, 6800 HeapSnapshot::Type type,
6922 ActivityControl* control, 6801 ActivityControl* control,
6923 ObjectNameResolver* resolver) { 6802 ObjectNameResolver* resolver) {
6924 i::Isolate* isolate = i::Isolate::Current(); 6803 i::Isolate* isolate = i::Isolate::Current();
6925 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot"); 6804 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot");
6805 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
6806 switch (type) {
6807 case HeapSnapshot::kFull:
6808 internal_type = i::HeapSnapshot::kFull;
6809 break;
6810 default:
6811 UNREACHABLE();
6812 }
6926 return reinterpret_cast<const HeapSnapshot*>( 6813 return reinterpret_cast<const HeapSnapshot*>(
6927 isolate->heap_profiler()->TakeSnapshot( 6814 i::HeapProfiler::TakeSnapshot(
6928 *Utils::OpenHandle(*title), control, resolver)); 6815 *Utils::OpenHandle(*title), internal_type, control, resolver));
6929 }
6930
6931
6932 const HeapSnapshot* HeapProfiler::TakeHeapSnapshot(
6933 Handle<String> title,
6934 ActivityControl* control,
6935 ObjectNameResolver* resolver) {
6936 return reinterpret_cast<const HeapSnapshot*>(
6937 reinterpret_cast<i::HeapProfiler*>(this)->TakeSnapshot(
6938 *Utils::OpenHandle(*title), control, resolver));
6939 } 6816 }
6940 6817
6941 6818
6942 void HeapProfiler::StartHeapObjectsTracking() { 6819 void HeapProfiler::StartHeapObjectsTracking() {
6943 i::Isolate* isolate = i::Isolate::Current(); 6820 i::Isolate* isolate = i::Isolate::Current();
6944 IsDeadCheck(isolate, "v8::HeapProfiler::StartHeapObjectsTracking"); 6821 IsDeadCheck(isolate, "v8::HeapProfiler::StartHeapObjectsTracking");
6945 isolate->heap_profiler()->StartHeapObjectsTracking(); 6822 i::HeapProfiler::StartHeapObjectsTracking();
6946 }
6947
6948
6949 void HeapProfiler::StartTrackingHeapObjects() {
6950 reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking();
6951 } 6823 }
6952 6824
6953 6825
6954 void HeapProfiler::StopHeapObjectsTracking() { 6826 void HeapProfiler::StopHeapObjectsTracking() {
6955 i::Isolate* isolate = i::Isolate::Current(); 6827 i::Isolate* isolate = i::Isolate::Current();
6956 IsDeadCheck(isolate, "v8::HeapProfiler::StopHeapObjectsTracking"); 6828 IsDeadCheck(isolate, "v8::HeapProfiler::StopHeapObjectsTracking");
6957 isolate->heap_profiler()->StopHeapObjectsTracking(); 6829 i::HeapProfiler::StopHeapObjectsTracking();
6958 }
6959
6960
6961 void HeapProfiler::StopTrackingHeapObjects() {
6962 reinterpret_cast<i::HeapProfiler*>(this)->StopHeapObjectsTracking();
6963 } 6830 }
6964 6831
6965 6832
6966 SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) { 6833 SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) {
6967 i::Isolate* isolate = i::Isolate::Current(); 6834 i::Isolate* isolate = i::Isolate::Current();
6968 IsDeadCheck(isolate, "v8::HeapProfiler::PushHeapObjectsStats"); 6835 IsDeadCheck(isolate, "v8::HeapProfiler::PushHeapObjectsStats");
6969 return isolate->heap_profiler()->PushHeapObjectsStats(stream); 6836 return i::HeapProfiler::PushHeapObjectsStats(stream);
6970 }
6971
6972
6973 SnapshotObjectId HeapProfiler::GetHeapStats(OutputStream* stream) {
6974 return reinterpret_cast<i::HeapProfiler*>(this)->PushHeapObjectsStats(stream);
6975 } 6837 }
6976 6838
6977 6839
6978 void HeapProfiler::DeleteAllSnapshots() { 6840 void HeapProfiler::DeleteAllSnapshots() {
6979 i::Isolate* isolate = i::Isolate::Current(); 6841 i::Isolate* isolate = i::Isolate::Current();
6980 IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots"); 6842 IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots");
6981 isolate->heap_profiler()->DeleteAllSnapshots(); 6843 i::HeapProfiler::DeleteAllSnapshots();
6982 } 6844 }
6983 6845
6984 6846
6985 void HeapProfiler::DeleteAllHeapSnapshots() {
6986 reinterpret_cast<i::HeapProfiler*>(this)->DeleteAllSnapshots();
6987 }
6988
6989
6990 void HeapProfiler::DefineWrapperClass(uint16_t class_id, 6847 void HeapProfiler::DefineWrapperClass(uint16_t class_id,
6991 WrapperInfoCallback callback) { 6848 WrapperInfoCallback callback) {
6992 i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id, 6849 i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id,
6993 callback); 6850 callback);
6994 } 6851 }
6995 6852
6996 6853
6997 void HeapProfiler::SetWrapperClassInfoProvider(uint16_t class_id,
6998 WrapperInfoCallback callback) {
6999 reinterpret_cast<i::HeapProfiler*>(this)->DefineWrapperClass(class_id,
7000 callback);
7001 }
7002
7003
7004 int HeapProfiler::GetPersistentHandleCount() { 6854 int HeapProfiler::GetPersistentHandleCount() {
7005 i::Isolate* isolate = i::Isolate::Current(); 6855 i::Isolate* isolate = i::Isolate::Current();
7006 return isolate->global_handles()->NumberOfGlobalHandles(); 6856 return isolate->global_handles()->NumberOfGlobalHandles();
7007 } 6857 }
7008 6858
7009 6859
7010 size_t HeapProfiler::GetMemorySizeUsedByProfiler() { 6860 size_t HeapProfiler::GetMemorySizeUsedByProfiler() {
7011 return i::Isolate::Current()->heap_profiler()->GetMemorySizeUsedByProfiler(); 6861 return i::HeapProfiler::GetMemorySizeUsedByProfiler();
7012 } 6862 }
7013 6863
7014 6864
7015 size_t HeapProfiler::GetProfilerMemorySize() {
7016 return reinterpret_cast<i::HeapProfiler*>(this)->
7017 GetMemorySizeUsedByProfiler();
7018 }
7019
7020
7021 v8::Testing::StressType internal::Testing::stress_type_ = 6865 v8::Testing::StressType internal::Testing::stress_type_ =
7022 v8::Testing::kStressTypeOpt; 6866 v8::Testing::kStressTypeOpt;
7023 6867
7024 6868
7025 void Testing::SetStressRunType(Testing::StressType type) { 6869 void Testing::SetStressRunType(Testing::StressType type) {
7026 internal::Testing::set_stress_type(type); 6870 internal::Testing::set_stress_type(type);
7027 } 6871 }
7028 6872
7029 int Testing::GetStressRuns() { 6873 int Testing::GetStressRuns() {
7030 if (internal::FLAG_stress_runs != 0) return internal::FLAG_stress_runs; 6874 if (internal::FLAG_stress_runs != 0) return internal::FLAG_stress_runs;
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
7225 7069
7226 v->VisitPointers(blocks_.first(), first_block_limit_); 7070 v->VisitPointers(blocks_.first(), first_block_limit_);
7227 7071
7228 for (int i = 1; i < blocks_.length(); i++) { 7072 for (int i = 1; i < blocks_.length(); i++) {
7229 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 7073 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
7230 } 7074 }
7231 } 7075 }
7232 7076
7233 7077
7234 } } // namespace v8::internal 7078 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-profiler.h ('k') | src/codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698