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

Side by Side Diff: src/api.cc

Issue 7350014: Remove the ability to compile without logging and profiling (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 9 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/SConscript ('k') | src/arm/code-stubs-arm.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "snapshot.h" 47 #include "snapshot.h"
48 #include "v8threads.h" 48 #include "v8threads.h"
49 #include "version.h" 49 #include "version.h"
50 #include "vm-state-inl.h" 50 #include "vm-state-inl.h"
51 51
52 #include "../include/v8-profiler.h" 52 #include "../include/v8-profiler.h"
53 #include "../include/v8-testing.h" 53 #include "../include/v8-testing.h"
54 54
55 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr)) 55 #define LOG_API(isolate, expr) LOG(isolate, ApiEntryCall(expr))
56 56
57 #ifdef ENABLE_VMSTATE_TRACKING
58 #define ENTER_V8(isolate) \ 57 #define ENTER_V8(isolate) \
59 ASSERT((isolate)->IsInitialized()); \ 58 ASSERT((isolate)->IsInitialized()); \
60 i::VMState __state__((isolate), i::OTHER) 59 i::VMState __state__((isolate), i::OTHER)
61 #define LEAVE_V8(isolate) \ 60 #define LEAVE_V8(isolate) \
62 i::VMState __state__((isolate), i::EXTERNAL) 61 i::VMState __state__((isolate), i::EXTERNAL)
63 #else
64 #define ENTER_V8(isolate) ((void) 0)
65 #define LEAVE_V8(isolate) ((void) 0)
66 #endif
67 62
68 namespace v8 { 63 namespace v8 {
69 64
70 #define ON_BAILOUT(isolate, location, code) \ 65 #define ON_BAILOUT(isolate, location, code) \
71 if (IsDeadCheck(isolate, location) || \ 66 if (IsDeadCheck(isolate, location) || \
72 IsExecutionTerminatingCheck(isolate)) { \ 67 IsExecutionTerminatingCheck(isolate)) { \
73 code; \ 68 code; \
74 UNREACHABLE(); \ 69 UNREACHABLE(); \
75 } 70 }
76 71
(...skipping 30 matching lines...) Expand all
107 "Entering the V8 API without proper locking in place"); \ 102 "Entering the V8 API without proper locking in place"); \
108 } \ 103 } \
109 } while (false) 104 } while (false)
110 105
111 106
112 // --- E x c e p t i o n B e h a v i o r --- 107 // --- E x c e p t i o n B e h a v i o r ---
113 108
114 109
115 static void DefaultFatalErrorHandler(const char* location, 110 static void DefaultFatalErrorHandler(const char* location,
116 const char* message) { 111 const char* message) {
117 #ifdef ENABLE_VMSTATE_TRACKING
118 i::VMState __state__(i::Isolate::Current(), i::OTHER); 112 i::VMState __state__(i::Isolate::Current(), i::OTHER);
119 #endif
120 API_Fatal(location, message); 113 API_Fatal(location, message);
121 } 114 }
122 115
123 116
124 static FatalErrorCallback GetFatalErrorHandler() { 117 static FatalErrorCallback GetFatalErrorHandler() {
125 i::Isolate* isolate = i::Isolate::Current(); 118 i::Isolate* isolate = i::Isolate::Current();
126 if (isolate->exception_behavior() == NULL) { 119 if (isolate->exception_behavior() == NULL) {
127 isolate->set_exception_behavior(DefaultFatalErrorHandler); 120 isolate->set_exception_behavior(DefaultFatalErrorHandler);
128 } 121 }
129 return isolate->exception_behavior(); 122 return isolate->exception_behavior();
(...skipping 4663 matching lines...) Expand 10 before | Expand all | Expand 10 after
4793 4786
4794 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) { 4787 void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) {
4795 i::Isolate* isolate = i::Isolate::Current(); 4788 i::Isolate* isolate = i::Isolate::Current();
4796 if (IsDeadCheck(isolate, "v8::V8::RemoveMemoryAllocationCallback()")) return; 4789 if (IsDeadCheck(isolate, "v8::V8::RemoveMemoryAllocationCallback()")) return;
4797 isolate->memory_allocator()->RemoveMemoryAllocationCallback( 4790 isolate->memory_allocator()->RemoveMemoryAllocationCallback(
4798 callback); 4791 callback);
4799 } 4792 }
4800 4793
4801 4794
4802 void V8::PauseProfiler() { 4795 void V8::PauseProfiler() {
4803 #ifdef ENABLE_LOGGING_AND_PROFILING
4804 i::Isolate* isolate = i::Isolate::Current(); 4796 i::Isolate* isolate = i::Isolate::Current();
4805 isolate->logger()->PauseProfiler(); 4797 isolate->logger()->PauseProfiler();
4806 #endif
4807 } 4798 }
4808 4799
4809 4800
4810 void V8::ResumeProfiler() { 4801 void V8::ResumeProfiler() {
4811 #ifdef ENABLE_LOGGING_AND_PROFILING
4812 i::Isolate* isolate = i::Isolate::Current(); 4802 i::Isolate* isolate = i::Isolate::Current();
4813 isolate->logger()->ResumeProfiler(); 4803 isolate->logger()->ResumeProfiler();
4814 #endif
4815 } 4804 }
4816 4805
4817 4806
4818 bool V8::IsProfilerPaused() { 4807 bool V8::IsProfilerPaused() {
4819 #ifdef ENABLE_LOGGING_AND_PROFILING
4820 i::Isolate* isolate = i::Isolate::Current(); 4808 i::Isolate* isolate = i::Isolate::Current();
4821 return isolate->logger()->IsProfilerPaused(); 4809 return isolate->logger()->IsProfilerPaused();
4822 #else
4823 return true;
4824 #endif
4825 } 4810 }
4826 4811
4827 4812
4828 int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) { 4813 int V8::GetLogLines(int from_pos, char* dest_buf, int max_size) {
4829 #ifdef ENABLE_LOGGING_AND_PROFILING
4830 ASSERT(max_size >= kMinimumSizeForLogLinesBuffer); 4814 ASSERT(max_size >= kMinimumSizeForLogLinesBuffer);
4831 return LOGGER->GetLogLines(from_pos, dest_buf, max_size); 4815 return LOGGER->GetLogLines(from_pos, dest_buf, max_size);
4832 #endif
4833 return 0;
4834 } 4816 }
4835 4817
4836 4818
4837 int V8::GetCurrentThreadId() { 4819 int V8::GetCurrentThreadId() {
4838 i::Isolate* isolate = i::Isolate::Current(); 4820 i::Isolate* isolate = i::Isolate::Current();
4839 EnsureInitializedForIsolate(isolate, "V8::GetCurrentThreadId()"); 4821 EnsureInitializedForIsolate(isolate, "V8::GetCurrentThreadId()");
4840 return isolate->thread_id().ToInteger(); 4822 return isolate->thread_id().ToInteger();
4841 } 4823 }
4842 4824
4843 4825
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
5288 i::Isolate* isolate = i::Isolate::Current(); 5270 i::Isolate* isolate = i::Isolate::Current();
5289 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()"); 5271 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()");
5290 ENTER_V8(isolate); 5272 ENTER_V8(isolate);
5291 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); 5273 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext());
5292 } 5274 }
5293 5275
5294 #endif // ENABLE_DEBUGGER_SUPPORT 5276 #endif // ENABLE_DEBUGGER_SUPPORT
5295 5277
5296 5278
5297 Handle<String> CpuProfileNode::GetFunctionName() const { 5279 Handle<String> CpuProfileNode::GetFunctionName() const {
5298 #ifdef ENABLE_LOGGING_AND_PROFILING
5299 i::Isolate* isolate = i::Isolate::Current(); 5280 i::Isolate* isolate = i::Isolate::Current();
5300 IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName"); 5281 IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName");
5301 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 5282 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
5302 const i::CodeEntry* entry = node->entry(); 5283 const i::CodeEntry* entry = node->entry();
5303 if (!entry->has_name_prefix()) { 5284 if (!entry->has_name_prefix()) {
5304 return Handle<String>(ToApi<String>( 5285 return Handle<String>(ToApi<String>(
5305 isolate->factory()->LookupAsciiSymbol(entry->name()))); 5286 isolate->factory()->LookupAsciiSymbol(entry->name())));
5306 } else { 5287 } else {
5307 return Handle<String>(ToApi<String>(isolate->factory()->NewConsString( 5288 return Handle<String>(ToApi<String>(isolate->factory()->NewConsString(
5308 isolate->factory()->LookupAsciiSymbol(entry->name_prefix()), 5289 isolate->factory()->LookupAsciiSymbol(entry->name_prefix()),
5309 isolate->factory()->LookupAsciiSymbol(entry->name())))); 5290 isolate->factory()->LookupAsciiSymbol(entry->name()))));
5310 } 5291 }
5311 #else
5312 return v8::String::Empty();
5313 #endif
5314 } 5292 }
5315 5293
5316 5294
5317 Handle<String> CpuProfileNode::GetScriptResourceName() const { 5295 Handle<String> CpuProfileNode::GetScriptResourceName() const {
5318 #ifdef ENABLE_LOGGING_AND_PROFILING
5319 i::Isolate* isolate = i::Isolate::Current(); 5296 i::Isolate* isolate = i::Isolate::Current();
5320 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); 5297 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
5321 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 5298 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
5322 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5299 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5323 node->entry()->resource_name()))); 5300 node->entry()->resource_name())));
5324 #else
5325 return v8::String::Empty();
5326 #endif
5327 } 5301 }
5328 5302
5329 5303
5330 int CpuProfileNode::GetLineNumber() const { 5304 int CpuProfileNode::GetLineNumber() const {
5331 #ifdef ENABLE_LOGGING_AND_PROFILING
5332 i::Isolate* isolate = i::Isolate::Current(); 5305 i::Isolate* isolate = i::Isolate::Current();
5333 IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber"); 5306 IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber");
5334 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); 5307 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number();
5335 #else
5336 return 0;
5337 #endif
5338 } 5308 }
5339 5309
5340 5310
5341 double CpuProfileNode::GetTotalTime() const { 5311 double CpuProfileNode::GetTotalTime() const {
5342 #ifdef ENABLE_LOGGING_AND_PROFILING
5343 i::Isolate* isolate = i::Isolate::Current(); 5312 i::Isolate* isolate = i::Isolate::Current();
5344 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime"); 5313 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime");
5345 return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis(); 5314 return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis();
5346 #else
5347 return 0.0;
5348 #endif
5349 } 5315 }
5350 5316
5351 5317
5352 double CpuProfileNode::GetSelfTime() const { 5318 double CpuProfileNode::GetSelfTime() const {
5353 #ifdef ENABLE_LOGGING_AND_PROFILING
5354 i::Isolate* isolate = i::Isolate::Current(); 5319 i::Isolate* isolate = i::Isolate::Current();
5355 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime"); 5320 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime");
5356 return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis(); 5321 return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis();
5357 #else
5358 return 0.0;
5359 #endif
5360 } 5322 }
5361 5323
5362 5324
5363 double CpuProfileNode::GetTotalSamplesCount() const { 5325 double CpuProfileNode::GetTotalSamplesCount() const {
5364 #ifdef ENABLE_LOGGING_AND_PROFILING
5365 i::Isolate* isolate = i::Isolate::Current(); 5326 i::Isolate* isolate = i::Isolate::Current();
5366 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount"); 5327 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount");
5367 return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks(); 5328 return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks();
5368 #else
5369 return 0.0;
5370 #endif
5371 } 5329 }
5372 5330
5373 5331
5374 double CpuProfileNode::GetSelfSamplesCount() const { 5332 double CpuProfileNode::GetSelfSamplesCount() const {
5375 #ifdef ENABLE_LOGGING_AND_PROFILING
5376 i::Isolate* isolate = i::Isolate::Current(); 5333 i::Isolate* isolate = i::Isolate::Current();
5377 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount"); 5334 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount");
5378 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); 5335 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks();
5379 #else
5380 return 0.0;
5381 #endif
5382 } 5336 }
5383 5337
5384 5338
5385 unsigned CpuProfileNode::GetCallUid() const { 5339 unsigned CpuProfileNode::GetCallUid() const {
5386 #ifdef ENABLE_LOGGING_AND_PROFILING
5387 i::Isolate* isolate = i::Isolate::Current(); 5340 i::Isolate* isolate = i::Isolate::Current();
5388 IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid"); 5341 IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid");
5389 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid(); 5342 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid();
5390 #else
5391 return 0;
5392 #endif
5393 } 5343 }
5394 5344
5395 5345
5396 int CpuProfileNode::GetChildrenCount() const { 5346 int CpuProfileNode::GetChildrenCount() const {
5397 #ifdef ENABLE_LOGGING_AND_PROFILING
5398 i::Isolate* isolate = i::Isolate::Current(); 5347 i::Isolate* isolate = i::Isolate::Current();
5399 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount"); 5348 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount");
5400 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length(); 5349 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length();
5401 #else
5402 return 0;
5403 #endif
5404 } 5350 }
5405 5351
5406 5352
5407 const CpuProfileNode* CpuProfileNode::GetChild(int index) const { 5353 const CpuProfileNode* CpuProfileNode::GetChild(int index) const {
5408 #ifdef ENABLE_LOGGING_AND_PROFILING
5409 i::Isolate* isolate = i::Isolate::Current(); 5354 i::Isolate* isolate = i::Isolate::Current();
5410 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild"); 5355 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild");
5411 const i::ProfileNode* child = 5356 const i::ProfileNode* child =
5412 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); 5357 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index);
5413 return reinterpret_cast<const CpuProfileNode*>(child); 5358 return reinterpret_cast<const CpuProfileNode*>(child);
5414 #else
5415 return NULL;
5416 #endif
5417 } 5359 }
5418 5360
5419 5361
5420 void CpuProfile::Delete() { 5362 void CpuProfile::Delete() {
5421 #ifdef ENABLE_LOGGING_AND_PROFILING
5422 i::Isolate* isolate = i::Isolate::Current(); 5363 i::Isolate* isolate = i::Isolate::Current();
5423 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); 5364 IsDeadCheck(isolate, "v8::CpuProfile::Delete");
5424 i::CpuProfiler::DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); 5365 i::CpuProfiler::DeleteProfile(reinterpret_cast<i::CpuProfile*>(this));
5425 if (i::CpuProfiler::GetProfilesCount() == 0 && 5366 if (i::CpuProfiler::GetProfilesCount() == 0 &&
5426 !i::CpuProfiler::HasDetachedProfiles()) { 5367 !i::CpuProfiler::HasDetachedProfiles()) {
5427 // If this was the last profile, clean up all accessory data as well. 5368 // If this was the last profile, clean up all accessory data as well.
5428 i::CpuProfiler::DeleteAllProfiles(); 5369 i::CpuProfiler::DeleteAllProfiles();
5429 } 5370 }
5430 #endif
5431 } 5371 }
5432 5372
5433 5373
5434 unsigned CpuProfile::GetUid() const { 5374 unsigned CpuProfile::GetUid() const {
5435 #ifdef ENABLE_LOGGING_AND_PROFILING
5436 i::Isolate* isolate = i::Isolate::Current(); 5375 i::Isolate* isolate = i::Isolate::Current();
5437 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); 5376 IsDeadCheck(isolate, "v8::CpuProfile::GetUid");
5438 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); 5377 return reinterpret_cast<const i::CpuProfile*>(this)->uid();
5439 #else
5440 return 0;
5441 #endif
5442 } 5378 }
5443 5379
5444 5380
5445 Handle<String> CpuProfile::GetTitle() const { 5381 Handle<String> CpuProfile::GetTitle() const {
5446 #ifdef ENABLE_LOGGING_AND_PROFILING
5447 i::Isolate* isolate = i::Isolate::Current(); 5382 i::Isolate* isolate = i::Isolate::Current();
5448 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); 5383 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
5449 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5384 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
5450 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5385 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5451 profile->title()))); 5386 profile->title())));
5452 #else
5453 return v8::String::Empty();
5454 #endif
5455 } 5387 }
5456 5388
5457 5389
5458 const CpuProfileNode* CpuProfile::GetBottomUpRoot() const { 5390 const CpuProfileNode* CpuProfile::GetBottomUpRoot() const {
5459 #ifdef ENABLE_LOGGING_AND_PROFILING
5460 i::Isolate* isolate = i::Isolate::Current(); 5391 i::Isolate* isolate = i::Isolate::Current();
5461 IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot"); 5392 IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot");
5462 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5393 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
5463 return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root()); 5394 return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root());
5464 #else
5465 return NULL;
5466 #endif
5467 } 5395 }
5468 5396
5469 5397
5470 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { 5398 const CpuProfileNode* CpuProfile::GetTopDownRoot() const {
5471 #ifdef ENABLE_LOGGING_AND_PROFILING
5472 i::Isolate* isolate = i::Isolate::Current(); 5399 i::Isolate* isolate = i::Isolate::Current();
5473 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); 5400 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot");
5474 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5401 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
5475 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); 5402 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root());
5476 #else
5477 return NULL;
5478 #endif
5479 } 5403 }
5480 5404
5481 5405
5482 int CpuProfiler::GetProfilesCount() { 5406 int CpuProfiler::GetProfilesCount() {
5483 #ifdef ENABLE_LOGGING_AND_PROFILING
5484 i::Isolate* isolate = i::Isolate::Current(); 5407 i::Isolate* isolate = i::Isolate::Current();
5485 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount"); 5408 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount");
5486 return i::CpuProfiler::GetProfilesCount(); 5409 return i::CpuProfiler::GetProfilesCount();
5487 #else
5488 return 0;
5489 #endif
5490 } 5410 }
5491 5411
5492 5412
5493 const CpuProfile* CpuProfiler::GetProfile(int index, 5413 const CpuProfile* CpuProfiler::GetProfile(int index,
5494 Handle<Value> security_token) { 5414 Handle<Value> security_token) {
5495 #ifdef ENABLE_LOGGING_AND_PROFILING
5496 i::Isolate* isolate = i::Isolate::Current(); 5415 i::Isolate* isolate = i::Isolate::Current();
5497 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile"); 5416 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile");
5498 return reinterpret_cast<const CpuProfile*>( 5417 return reinterpret_cast<const CpuProfile*>(
5499 i::CpuProfiler::GetProfile( 5418 i::CpuProfiler::GetProfile(
5500 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5419 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
5501 index)); 5420 index));
5502 #else
5503 return NULL;
5504 #endif
5505 } 5421 }
5506 5422
5507 5423
5508 const CpuProfile* CpuProfiler::FindProfile(unsigned uid, 5424 const CpuProfile* CpuProfiler::FindProfile(unsigned uid,
5509 Handle<Value> security_token) { 5425 Handle<Value> security_token) {
5510 #ifdef ENABLE_LOGGING_AND_PROFILING
5511 i::Isolate* isolate = i::Isolate::Current(); 5426 i::Isolate* isolate = i::Isolate::Current();
5512 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile"); 5427 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile");
5513 return reinterpret_cast<const CpuProfile*>( 5428 return reinterpret_cast<const CpuProfile*>(
5514 i::CpuProfiler::FindProfile( 5429 i::CpuProfiler::FindProfile(
5515 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5430 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
5516 uid)); 5431 uid));
5517 #else
5518 return NULL;
5519 #endif
5520 } 5432 }
5521 5433
5522 5434
5523 void CpuProfiler::StartProfiling(Handle<String> title) { 5435 void CpuProfiler::StartProfiling(Handle<String> title) {
5524 #ifdef ENABLE_LOGGING_AND_PROFILING
5525 i::Isolate* isolate = i::Isolate::Current(); 5436 i::Isolate* isolate = i::Isolate::Current();
5526 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); 5437 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
5527 i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title)); 5438 i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title));
5528 #endif
5529 } 5439 }
5530 5440
5531 5441
5532 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, 5442 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title,
5533 Handle<Value> security_token) { 5443 Handle<Value> security_token) {
5534 #ifdef ENABLE_LOGGING_AND_PROFILING
5535 i::Isolate* isolate = i::Isolate::Current(); 5444 i::Isolate* isolate = i::Isolate::Current();
5536 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); 5445 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling");
5537 return reinterpret_cast<const CpuProfile*>( 5446 return reinterpret_cast<const CpuProfile*>(
5538 i::CpuProfiler::StopProfiling( 5447 i::CpuProfiler::StopProfiling(
5539 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5448 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
5540 *Utils::OpenHandle(*title))); 5449 *Utils::OpenHandle(*title)));
5541 #else
5542 return NULL;
5543 #endif
5544 } 5450 }
5545 5451
5546 5452
5547 void CpuProfiler::DeleteAllProfiles() { 5453 void CpuProfiler::DeleteAllProfiles() {
5548 #ifdef ENABLE_LOGGING_AND_PROFILING
5549 i::Isolate* isolate = i::Isolate::Current(); 5454 i::Isolate* isolate = i::Isolate::Current();
5550 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); 5455 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles");
5551 i::CpuProfiler::DeleteAllProfiles(); 5456 i::CpuProfiler::DeleteAllProfiles();
5552 #endif
5553 } 5457 }
5554 5458
5555 5459
5556 #ifdef ENABLE_LOGGING_AND_PROFILING
5557 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 5460 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
5558 return const_cast<i::HeapGraphEdge*>( 5461 return const_cast<i::HeapGraphEdge*>(
5559 reinterpret_cast<const i::HeapGraphEdge*>(edge)); 5462 reinterpret_cast<const i::HeapGraphEdge*>(edge));
5560 } 5463 }
5561 #endif
5562 5464
5563 5465
5564 HeapGraphEdge::Type HeapGraphEdge::GetType() const { 5466 HeapGraphEdge::Type HeapGraphEdge::GetType() const {
5565 #ifdef ENABLE_LOGGING_AND_PROFILING
5566 i::Isolate* isolate = i::Isolate::Current(); 5467 i::Isolate* isolate = i::Isolate::Current();
5567 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType"); 5468 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType");
5568 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type()); 5469 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type());
5569 #else
5570 return static_cast<HeapGraphEdge::Type>(0);
5571 #endif
5572 } 5470 }
5573 5471
5574 5472
5575 Handle<Value> HeapGraphEdge::GetName() const { 5473 Handle<Value> HeapGraphEdge::GetName() const {
5576 #ifdef ENABLE_LOGGING_AND_PROFILING
5577 i::Isolate* isolate = i::Isolate::Current(); 5474 i::Isolate* isolate = i::Isolate::Current();
5578 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName"); 5475 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName");
5579 i::HeapGraphEdge* edge = ToInternal(this); 5476 i::HeapGraphEdge* edge = ToInternal(this);
5580 switch (edge->type()) { 5477 switch (edge->type()) {
5581 case i::HeapGraphEdge::kContextVariable: 5478 case i::HeapGraphEdge::kContextVariable:
5582 case i::HeapGraphEdge::kInternal: 5479 case i::HeapGraphEdge::kInternal:
5583 case i::HeapGraphEdge::kProperty: 5480 case i::HeapGraphEdge::kProperty:
5584 case i::HeapGraphEdge::kShortcut: 5481 case i::HeapGraphEdge::kShortcut:
5585 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5482 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5586 edge->name()))); 5483 edge->name())));
5587 case i::HeapGraphEdge::kElement: 5484 case i::HeapGraphEdge::kElement:
5588 case i::HeapGraphEdge::kHidden: 5485 case i::HeapGraphEdge::kHidden:
5589 return Handle<Number>(ToApi<Number>(isolate->factory()->NewNumberFromInt( 5486 return Handle<Number>(ToApi<Number>(isolate->factory()->NewNumberFromInt(
5590 edge->index()))); 5487 edge->index())));
5591 default: UNREACHABLE(); 5488 default: UNREACHABLE();
5592 } 5489 }
5593 #endif
5594 return v8::Undefined(); 5490 return v8::Undefined();
5595 } 5491 }
5596 5492
5597 5493
5598 const HeapGraphNode* HeapGraphEdge::GetFromNode() const { 5494 const HeapGraphNode* HeapGraphEdge::GetFromNode() const {
5599 #ifdef ENABLE_LOGGING_AND_PROFILING
5600 i::Isolate* isolate = i::Isolate::Current(); 5495 i::Isolate* isolate = i::Isolate::Current();
5601 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode"); 5496 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode");
5602 const i::HeapEntry* from = ToInternal(this)->From(); 5497 const i::HeapEntry* from = ToInternal(this)->From();
5603 return reinterpret_cast<const HeapGraphNode*>(from); 5498 return reinterpret_cast<const HeapGraphNode*>(from);
5604 #else
5605 return NULL;
5606 #endif
5607 } 5499 }
5608 5500
5609 5501
5610 const HeapGraphNode* HeapGraphEdge::GetToNode() const { 5502 const HeapGraphNode* HeapGraphEdge::GetToNode() const {
5611 #ifdef ENABLE_LOGGING_AND_PROFILING
5612 i::Isolate* isolate = i::Isolate::Current(); 5503 i::Isolate* isolate = i::Isolate::Current();
5613 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode"); 5504 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode");
5614 const i::HeapEntry* to = ToInternal(this)->to(); 5505 const i::HeapEntry* to = ToInternal(this)->to();
5615 return reinterpret_cast<const HeapGraphNode*>(to); 5506 return reinterpret_cast<const HeapGraphNode*>(to);
5616 #else
5617 return NULL;
5618 #endif
5619 } 5507 }
5620 5508
5621 5509
5622 #ifdef ENABLE_LOGGING_AND_PROFILING
5623 static i::HeapEntry* ToInternal(const HeapGraphNode* entry) { 5510 static i::HeapEntry* ToInternal(const HeapGraphNode* entry) {
5624 return const_cast<i::HeapEntry*>( 5511 return const_cast<i::HeapEntry*>(
5625 reinterpret_cast<const i::HeapEntry*>(entry)); 5512 reinterpret_cast<const i::HeapEntry*>(entry));
5626 } 5513 }
5627 #endif
5628 5514
5629 5515
5630 HeapGraphNode::Type HeapGraphNode::GetType() const { 5516 HeapGraphNode::Type HeapGraphNode::GetType() const {
5631 #ifdef ENABLE_LOGGING_AND_PROFILING
5632 i::Isolate* isolate = i::Isolate::Current(); 5517 i::Isolate* isolate = i::Isolate::Current();
5633 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType"); 5518 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType");
5634 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type()); 5519 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type());
5635 #else
5636 return static_cast<HeapGraphNode::Type>(0);
5637 #endif
5638 } 5520 }
5639 5521
5640 5522
5641 Handle<String> HeapGraphNode::GetName() const { 5523 Handle<String> HeapGraphNode::GetName() const {
5642 #ifdef ENABLE_LOGGING_AND_PROFILING
5643 i::Isolate* isolate = i::Isolate::Current(); 5524 i::Isolate* isolate = i::Isolate::Current();
5644 IsDeadCheck(isolate, "v8::HeapGraphNode::GetName"); 5525 IsDeadCheck(isolate, "v8::HeapGraphNode::GetName");
5645 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5526 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5646 ToInternal(this)->name()))); 5527 ToInternal(this)->name())));
5647 #else
5648 return v8::String::Empty();
5649 #endif
5650 } 5528 }
5651 5529
5652 5530
5653 uint64_t HeapGraphNode::GetId() const { 5531 uint64_t HeapGraphNode::GetId() const {
5654 #ifdef ENABLE_LOGGING_AND_PROFILING
5655 i::Isolate* isolate = i::Isolate::Current(); 5532 i::Isolate* isolate = i::Isolate::Current();
5656 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId"); 5533 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId");
5657 return ToInternal(this)->id(); 5534 return ToInternal(this)->id();
5658 #else
5659 return 0;
5660 #endif
5661 } 5535 }
5662 5536
5663 5537
5664 int HeapGraphNode::GetSelfSize() const { 5538 int HeapGraphNode::GetSelfSize() const {
5665 #ifdef ENABLE_LOGGING_AND_PROFILING
5666 i::Isolate* isolate = i::Isolate::Current(); 5539 i::Isolate* isolate = i::Isolate::Current();
5667 IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize"); 5540 IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize");
5668 return ToInternal(this)->self_size(); 5541 return ToInternal(this)->self_size();
5669 #else
5670 return 0;
5671 #endif
5672 } 5542 }
5673 5543
5674 5544
5675 int HeapGraphNode::GetRetainedSize(bool exact) const { 5545 int HeapGraphNode::GetRetainedSize(bool exact) const {
5676 #ifdef ENABLE_LOGGING_AND_PROFILING
5677 i::Isolate* isolate = i::Isolate::Current(); 5546 i::Isolate* isolate = i::Isolate::Current();
5678 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainedSize"); 5547 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainedSize");
5679 return ToInternal(this)->RetainedSize(exact); 5548 return ToInternal(this)->RetainedSize(exact);
5680 #else
5681 return 0;
5682 #endif
5683 } 5549 }
5684 5550
5685 5551
5686 int HeapGraphNode::GetChildrenCount() const { 5552 int HeapGraphNode::GetChildrenCount() const {
5687 #ifdef ENABLE_LOGGING_AND_PROFILING
5688 i::Isolate* isolate = i::Isolate::Current(); 5553 i::Isolate* isolate = i::Isolate::Current();
5689 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChildrenCount"); 5554 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChildrenCount");
5690 return ToInternal(this)->children().length(); 5555 return ToInternal(this)->children().length();
5691 #else
5692 return 0;
5693 #endif
5694 } 5556 }
5695 5557
5696 5558
5697 const HeapGraphEdge* HeapGraphNode::GetChild(int index) const { 5559 const HeapGraphEdge* HeapGraphNode::GetChild(int index) const {
5698 #ifdef ENABLE_LOGGING_AND_PROFILING
5699 i::Isolate* isolate = i::Isolate::Current(); 5560 i::Isolate* isolate = i::Isolate::Current();
5700 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild"); 5561 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild");
5701 return reinterpret_cast<const HeapGraphEdge*>( 5562 return reinterpret_cast<const HeapGraphEdge*>(
5702 &ToInternal(this)->children()[index]); 5563 &ToInternal(this)->children()[index]);
5703 #else
5704 return NULL;
5705 #endif
5706 } 5564 }
5707 5565
5708 5566
5709 int HeapGraphNode::GetRetainersCount() const { 5567 int HeapGraphNode::GetRetainersCount() const {
5710 #ifdef ENABLE_LOGGING_AND_PROFILING
5711 i::Isolate* isolate = i::Isolate::Current(); 5568 i::Isolate* isolate = i::Isolate::Current();
5712 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainersCount"); 5569 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainersCount");
5713 return ToInternal(this)->retainers().length(); 5570 return ToInternal(this)->retainers().length();
5714 #else
5715 return 0;
5716 #endif
5717 } 5571 }
5718 5572
5719 5573
5720 const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const { 5574 const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const {
5721 #ifdef ENABLE_LOGGING_AND_PROFILING
5722 i::Isolate* isolate = i::Isolate::Current(); 5575 i::Isolate* isolate = i::Isolate::Current();
5723 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer"); 5576 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer");
5724 return reinterpret_cast<const HeapGraphEdge*>( 5577 return reinterpret_cast<const HeapGraphEdge*>(
5725 ToInternal(this)->retainers()[index]); 5578 ToInternal(this)->retainers()[index]);
5726 #else
5727 return NULL;
5728 #endif
5729 } 5579 }
5730 5580
5731 5581
5732 const HeapGraphNode* HeapGraphNode::GetDominatorNode() const { 5582 const HeapGraphNode* HeapGraphNode::GetDominatorNode() const {
5733 #ifdef ENABLE_LOGGING_AND_PROFILING
5734 i::Isolate* isolate = i::Isolate::Current(); 5583 i::Isolate* isolate = i::Isolate::Current();
5735 IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode"); 5584 IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode");
5736 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator()); 5585 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator());
5737 #else
5738 return NULL;
5739 #endif
5740 } 5586 }
5741 5587
5742 5588
5743 #ifdef ENABLE_LOGGING_AND_PROFILING
5744 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { 5589 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) {
5745 return const_cast<i::HeapSnapshot*>( 5590 return const_cast<i::HeapSnapshot*>(
5746 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); 5591 reinterpret_cast<const i::HeapSnapshot*>(snapshot));
5747 } 5592 }
5748 #endif
5749 5593
5750 5594
5751 void HeapSnapshot::Delete() { 5595 void HeapSnapshot::Delete() {
5752 #ifdef ENABLE_LOGGING_AND_PROFILING
5753 i::Isolate* isolate = i::Isolate::Current(); 5596 i::Isolate* isolate = i::Isolate::Current();
5754 IsDeadCheck(isolate, "v8::HeapSnapshot::Delete"); 5597 IsDeadCheck(isolate, "v8::HeapSnapshot::Delete");
5755 if (i::HeapProfiler::GetSnapshotsCount() > 1) { 5598 if (i::HeapProfiler::GetSnapshotsCount() > 1) {
5756 ToInternal(this)->Delete(); 5599 ToInternal(this)->Delete();
5757 } else { 5600 } else {
5758 // If this is the last snapshot, clean up all accessory data as well. 5601 // If this is the last snapshot, clean up all accessory data as well.
5759 i::HeapProfiler::DeleteAllSnapshots(); 5602 i::HeapProfiler::DeleteAllSnapshots();
5760 } 5603 }
5761 #endif
5762 } 5604 }
5763 5605
5764 5606
5765 HeapSnapshot::Type HeapSnapshot::GetType() const { 5607 HeapSnapshot::Type HeapSnapshot::GetType() const {
5766 #ifdef ENABLE_LOGGING_AND_PROFILING
5767 i::Isolate* isolate = i::Isolate::Current(); 5608 i::Isolate* isolate = i::Isolate::Current();
5768 IsDeadCheck(isolate, "v8::HeapSnapshot::GetType"); 5609 IsDeadCheck(isolate, "v8::HeapSnapshot::GetType");
5769 return static_cast<HeapSnapshot::Type>(ToInternal(this)->type()); 5610 return static_cast<HeapSnapshot::Type>(ToInternal(this)->type());
5770 #else
5771 return static_cast<HeapSnapshot::Type>(0);
5772 #endif
5773 } 5611 }
5774 5612
5775 5613
5776 unsigned HeapSnapshot::GetUid() const { 5614 unsigned HeapSnapshot::GetUid() const {
5777 #ifdef ENABLE_LOGGING_AND_PROFILING
5778 i::Isolate* isolate = i::Isolate::Current(); 5615 i::Isolate* isolate = i::Isolate::Current();
5779 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid"); 5616 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid");
5780 return ToInternal(this)->uid(); 5617 return ToInternal(this)->uid();
5781 #else
5782 return 0;
5783 #endif
5784 } 5618 }
5785 5619
5786 5620
5787 Handle<String> HeapSnapshot::GetTitle() const { 5621 Handle<String> HeapSnapshot::GetTitle() const {
5788 #ifdef ENABLE_LOGGING_AND_PROFILING
5789 i::Isolate* isolate = i::Isolate::Current(); 5622 i::Isolate* isolate = i::Isolate::Current();
5790 IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle"); 5623 IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle");
5791 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5624 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5792 ToInternal(this)->title()))); 5625 ToInternal(this)->title())));
5793 #else
5794 return v8::String::Empty();
5795 #endif
5796 } 5626 }
5797 5627
5798 5628
5799 const HeapGraphNode* HeapSnapshot::GetRoot() const { 5629 const HeapGraphNode* HeapSnapshot::GetRoot() const {
5800 #ifdef ENABLE_LOGGING_AND_PROFILING
5801 i::Isolate* isolate = i::Isolate::Current(); 5630 i::Isolate* isolate = i::Isolate::Current();
5802 IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead"); 5631 IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead");
5803 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); 5632 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root());
5804 #else
5805 return 0;
5806 #endif
5807 } 5633 }
5808 5634
5809 5635
5810 const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const { 5636 const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const {
5811 #ifdef ENABLE_LOGGING_AND_PROFILING
5812 i::Isolate* isolate = i::Isolate::Current(); 5637 i::Isolate* isolate = i::Isolate::Current();
5813 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById"); 5638 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById");
5814 return reinterpret_cast<const HeapGraphNode*>( 5639 return reinterpret_cast<const HeapGraphNode*>(
5815 ToInternal(this)->GetEntryById(id)); 5640 ToInternal(this)->GetEntryById(id));
5816 #else
5817 return NULL;
5818 #endif
5819 } 5641 }
5820 5642
5821 5643
5822 int HeapSnapshot::GetNodesCount() const { 5644 int HeapSnapshot::GetNodesCount() const {
5823 #ifdef ENABLE_LOGGING_AND_PROFILING
5824 i::Isolate* isolate = i::Isolate::Current(); 5645 i::Isolate* isolate = i::Isolate::Current();
5825 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodesCount"); 5646 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodesCount");
5826 return ToInternal(this)->entries()->length(); 5647 return ToInternal(this)->entries()->length();
5827 #else
5828 return 0;
5829 #endif
5830 } 5648 }
5831 5649
5832 5650
5833 const HeapGraphNode* HeapSnapshot::GetNode(int index) const { 5651 const HeapGraphNode* HeapSnapshot::GetNode(int index) const {
5834 #ifdef ENABLE_LOGGING_AND_PROFILING
5835 i::Isolate* isolate = i::Isolate::Current(); 5652 i::Isolate* isolate = i::Isolate::Current();
5836 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNode"); 5653 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNode");
5837 return reinterpret_cast<const HeapGraphNode*>( 5654 return reinterpret_cast<const HeapGraphNode*>(
5838 ToInternal(this)->entries()->at(index)); 5655 ToInternal(this)->entries()->at(index));
5839 #else
5840 return 0;
5841 #endif
5842 } 5656 }
5843 5657
5844 5658
5845 void HeapSnapshot::Serialize(OutputStream* stream, 5659 void HeapSnapshot::Serialize(OutputStream* stream,
5846 HeapSnapshot::SerializationFormat format) const { 5660 HeapSnapshot::SerializationFormat format) const {
5847 #ifdef ENABLE_LOGGING_AND_PROFILING
5848 i::Isolate* isolate = i::Isolate::Current(); 5661 i::Isolate* isolate = i::Isolate::Current();
5849 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize"); 5662 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize");
5850 ApiCheck(format == kJSON, 5663 ApiCheck(format == kJSON,
5851 "v8::HeapSnapshot::Serialize", 5664 "v8::HeapSnapshot::Serialize",
5852 "Unknown serialization format"); 5665 "Unknown serialization format");
5853 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii, 5666 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii,
5854 "v8::HeapSnapshot::Serialize", 5667 "v8::HeapSnapshot::Serialize",
5855 "Unsupported output encoding"); 5668 "Unsupported output encoding");
5856 ApiCheck(stream->GetChunkSize() > 0, 5669 ApiCheck(stream->GetChunkSize() > 0,
5857 "v8::HeapSnapshot::Serialize", 5670 "v8::HeapSnapshot::Serialize",
5858 "Invalid stream chunk size"); 5671 "Invalid stream chunk size");
5859 i::HeapSnapshotJSONSerializer serializer(ToInternal(this)); 5672 i::HeapSnapshotJSONSerializer serializer(ToInternal(this));
5860 serializer.Serialize(stream); 5673 serializer.Serialize(stream);
5861 #endif
5862 } 5674 }
5863 5675
5864 5676
5865 int HeapProfiler::GetSnapshotsCount() { 5677 int HeapProfiler::GetSnapshotsCount() {
5866 #ifdef ENABLE_LOGGING_AND_PROFILING
5867 i::Isolate* isolate = i::Isolate::Current(); 5678 i::Isolate* isolate = i::Isolate::Current();
5868 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount"); 5679 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount");
5869 return i::HeapProfiler::GetSnapshotsCount(); 5680 return i::HeapProfiler::GetSnapshotsCount();
5870 #else
5871 return 0;
5872 #endif
5873 } 5681 }
5874 5682
5875 5683
5876 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) { 5684 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
5877 #ifdef ENABLE_LOGGING_AND_PROFILING
5878 i::Isolate* isolate = i::Isolate::Current(); 5685 i::Isolate* isolate = i::Isolate::Current();
5879 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot"); 5686 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot");
5880 return reinterpret_cast<const HeapSnapshot*>( 5687 return reinterpret_cast<const HeapSnapshot*>(
5881 i::HeapProfiler::GetSnapshot(index)); 5688 i::HeapProfiler::GetSnapshot(index));
5882 #else
5883 return NULL;
5884 #endif
5885 } 5689 }
5886 5690
5887 5691
5888 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { 5692 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
5889 #ifdef ENABLE_LOGGING_AND_PROFILING
5890 i::Isolate* isolate = i::Isolate::Current(); 5693 i::Isolate* isolate = i::Isolate::Current();
5891 IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot"); 5694 IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot");
5892 return reinterpret_cast<const HeapSnapshot*>( 5695 return reinterpret_cast<const HeapSnapshot*>(
5893 i::HeapProfiler::FindSnapshot(uid)); 5696 i::HeapProfiler::FindSnapshot(uid));
5894 #else
5895 return NULL;
5896 #endif
5897 } 5697 }
5898 5698
5899 5699
5900 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, 5700 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
5901 HeapSnapshot::Type type, 5701 HeapSnapshot::Type type,
5902 ActivityControl* control) { 5702 ActivityControl* control) {
5903 #ifdef ENABLE_LOGGING_AND_PROFILING
5904 i::Isolate* isolate = i::Isolate::Current(); 5703 i::Isolate* isolate = i::Isolate::Current();
5905 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot"); 5704 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot");
5906 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; 5705 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
5907 switch (type) { 5706 switch (type) {
5908 case HeapSnapshot::kFull: 5707 case HeapSnapshot::kFull:
5909 internal_type = i::HeapSnapshot::kFull; 5708 internal_type = i::HeapSnapshot::kFull;
5910 break; 5709 break;
5911 default: 5710 default:
5912 UNREACHABLE(); 5711 UNREACHABLE();
5913 } 5712 }
5914 return reinterpret_cast<const HeapSnapshot*>( 5713 return reinterpret_cast<const HeapSnapshot*>(
5915 i::HeapProfiler::TakeSnapshot( 5714 i::HeapProfiler::TakeSnapshot(
5916 *Utils::OpenHandle(*title), internal_type, control)); 5715 *Utils::OpenHandle(*title), internal_type, control));
5917 #else
5918 return NULL;
5919 #endif
5920 } 5716 }
5921 5717
5922 5718
5923 void HeapProfiler::DeleteAllSnapshots() { 5719 void HeapProfiler::DeleteAllSnapshots() {
5924 #ifdef ENABLE_LOGGING_AND_PROFILING
5925 i::Isolate* isolate = i::Isolate::Current(); 5720 i::Isolate* isolate = i::Isolate::Current();
5926 IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots"); 5721 IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots");
5927 i::HeapProfiler::DeleteAllSnapshots(); 5722 i::HeapProfiler::DeleteAllSnapshots();
5928 #endif
5929 } 5723 }
5930 5724
5931 5725
5932 void HeapProfiler::DefineWrapperClass(uint16_t class_id, 5726 void HeapProfiler::DefineWrapperClass(uint16_t class_id,
5933 WrapperInfoCallback callback) { 5727 WrapperInfoCallback callback) {
5934 #ifdef ENABLE_LOGGING_AND_PROFILING
5935 i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id, 5728 i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id,
5936 callback); 5729 callback);
5937 #endif
5938 } 5730 }
5939 5731
5940 5732
5941 5733
5942 v8::Testing::StressType internal::Testing::stress_type_ = 5734 v8::Testing::StressType internal::Testing::stress_type_ =
5943 v8::Testing::kStressTypeOpt; 5735 v8::Testing::kStressTypeOpt;
5944 5736
5945 5737
5946 void Testing::SetStressRunType(Testing::StressType type) { 5738 void Testing::SetStressRunType(Testing::StressType type) {
5947 internal::Testing::set_stress_type(type); 5739 internal::Testing::set_stress_type(type);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
6066 5858
6067 5859
6068 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5860 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6069 HandleScopeImplementer* scope_implementer = 5861 HandleScopeImplementer* scope_implementer =
6070 reinterpret_cast<HandleScopeImplementer*>(storage); 5862 reinterpret_cast<HandleScopeImplementer*>(storage);
6071 scope_implementer->IterateThis(v); 5863 scope_implementer->IterateThis(v);
6072 return storage + ArchiveSpacePerThread(); 5864 return storage + ArchiveSpacePerThread();
6073 } 5865 }
6074 5866
6075 } } // namespace v8::internal 5867 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/SConscript ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698