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

Side by Side Diff: src/api.cc

Issue 6993057: Version 3.4.2 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 6 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 | « ChangeLog ('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 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after
4257 i::Handle<i::String> obj = Utils::OpenHandle(this); 4257 i::Handle<i::String> obj = Utils::OpenHandle(this);
4258 i::Isolate* isolate = obj->GetIsolate(); 4258 i::Isolate* isolate = obj->GetIsolate();
4259 if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false; 4259 if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
4260 if (i::StringShape(*obj).IsExternalTwoByte()) { 4260 if (i::StringShape(*obj).IsExternalTwoByte()) {
4261 return false; // Already an external string. 4261 return false; // Already an external string.
4262 } 4262 }
4263 ENTER_V8(isolate); 4263 ENTER_V8(isolate);
4264 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { 4264 if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
4265 return false; 4265 return false;
4266 } 4266 }
4267 if (isolate->heap()->IsInGCPostProcessing()) {
4268 return false;
4269 }
4267 bool result = obj->MakeExternal(resource); 4270 bool result = obj->MakeExternal(resource);
4268 if (result && !obj->IsSymbol()) { 4271 if (result && !obj->IsSymbol()) {
4269 isolate->heap()->external_string_table()->AddString(*obj); 4272 isolate->heap()->external_string_table()->AddString(*obj);
4270 } 4273 }
4271 return result; 4274 return result;
4272 } 4275 }
4273 4276
4274 4277
4275 Local<String> v8::String::NewExternal( 4278 Local<String> v8::String::NewExternal(
4276 v8::String::ExternalAsciiStringResource* resource) { 4279 v8::String::ExternalAsciiStringResource* resource) {
(...skipping 12 matching lines...) Expand all
4289 i::Handle<i::String> obj = Utils::OpenHandle(this); 4292 i::Handle<i::String> obj = Utils::OpenHandle(this);
4290 i::Isolate* isolate = obj->GetIsolate(); 4293 i::Isolate* isolate = obj->GetIsolate();
4291 if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false; 4294 if (IsDeadCheck(isolate, "v8::String::MakeExternal()")) return false;
4292 if (i::StringShape(*obj).IsExternalTwoByte()) { 4295 if (i::StringShape(*obj).IsExternalTwoByte()) {
4293 return false; // Already an external string. 4296 return false; // Already an external string.
4294 } 4297 }
4295 ENTER_V8(isolate); 4298 ENTER_V8(isolate);
4296 if (isolate->string_tracker()->IsFreshUnusedString(obj)) { 4299 if (isolate->string_tracker()->IsFreshUnusedString(obj)) {
4297 return false; 4300 return false;
4298 } 4301 }
4302 if (isolate->heap()->IsInGCPostProcessing()) {
4303 return false;
4304 }
4299 bool result = obj->MakeExternal(resource); 4305 bool result = obj->MakeExternal(resource);
4300 if (result && !obj->IsSymbol()) { 4306 if (result && !obj->IsSymbol()) {
4301 isolate->heap()->external_string_table()->AddString(*obj); 4307 isolate->heap()->external_string_table()->AddString(*obj);
4302 } 4308 }
4303 return result; 4309 return result;
4304 } 4310 }
4305 4311
4306 4312
4307 bool v8::String::CanMakeExternal() { 4313 bool v8::String::CanMakeExternal() {
4308 i::Handle<i::String> obj = Utils::OpenHandle(this); 4314 i::Handle<i::String> obj = Utils::OpenHandle(this);
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
5250 Local<Context> Debug::GetDebugContext() { 5256 Local<Context> Debug::GetDebugContext() {
5251 i::Isolate* isolate = i::Isolate::Current(); 5257 i::Isolate* isolate = i::Isolate::Current();
5252 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()"); 5258 EnsureInitializedForIsolate(isolate, "v8::Debug::GetDebugContext()");
5253 ENTER_V8(isolate); 5259 ENTER_V8(isolate);
5254 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext()); 5260 return Utils::ToLocal(i::Isolate::Current()->debugger()->GetDebugContext());
5255 } 5261 }
5256 5262
5257 #endif // ENABLE_DEBUGGER_SUPPORT 5263 #endif // ENABLE_DEBUGGER_SUPPORT
5258 5264
5259 5265
5266 Handle<String> CpuProfileNode::GetFunctionName() const {
5260 #ifdef ENABLE_LOGGING_AND_PROFILING 5267 #ifdef ENABLE_LOGGING_AND_PROFILING
5261
5262 Handle<String> CpuProfileNode::GetFunctionName() const {
5263 i::Isolate* isolate = i::Isolate::Current(); 5268 i::Isolate* isolate = i::Isolate::Current();
5264 IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName"); 5269 IsDeadCheck(isolate, "v8::CpuProfileNode::GetFunctionName");
5265 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 5270 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
5266 const i::CodeEntry* entry = node->entry(); 5271 const i::CodeEntry* entry = node->entry();
5267 if (!entry->has_name_prefix()) { 5272 if (!entry->has_name_prefix()) {
5268 return Handle<String>(ToApi<String>( 5273 return Handle<String>(ToApi<String>(
5269 isolate->factory()->LookupAsciiSymbol(entry->name()))); 5274 isolate->factory()->LookupAsciiSymbol(entry->name())));
5270 } else { 5275 } else {
5271 return Handle<String>(ToApi<String>(isolate->factory()->NewConsString( 5276 return Handle<String>(ToApi<String>(isolate->factory()->NewConsString(
5272 isolate->factory()->LookupAsciiSymbol(entry->name_prefix()), 5277 isolate->factory()->LookupAsciiSymbol(entry->name_prefix()),
5273 isolate->factory()->LookupAsciiSymbol(entry->name())))); 5278 isolate->factory()->LookupAsciiSymbol(entry->name()))));
5274 } 5279 }
5280 #else
5281 return v8::String::Empty();
5282 #endif
5275 } 5283 }
5276 5284
5277 5285
5278 Handle<String> CpuProfileNode::GetScriptResourceName() const { 5286 Handle<String> CpuProfileNode::GetScriptResourceName() const {
5287 #ifdef ENABLE_LOGGING_AND_PROFILING
5279 i::Isolate* isolate = i::Isolate::Current(); 5288 i::Isolate* isolate = i::Isolate::Current();
5280 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName"); 5289 IsDeadCheck(isolate, "v8::CpuProfileNode::GetScriptResourceName");
5281 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); 5290 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
5282 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5291 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5283 node->entry()->resource_name()))); 5292 node->entry()->resource_name())));
5293 #else
5294 return v8::String::Empty();
5295 #endif
5284 } 5296 }
5285 5297
5286 5298
5287 int CpuProfileNode::GetLineNumber() const { 5299 int CpuProfileNode::GetLineNumber() const {
5300 #ifdef ENABLE_LOGGING_AND_PROFILING
5288 i::Isolate* isolate = i::Isolate::Current(); 5301 i::Isolate* isolate = i::Isolate::Current();
5289 IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber"); 5302 IsDeadCheck(isolate, "v8::CpuProfileNode::GetLineNumber");
5290 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); 5303 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number();
5304 #else
5305 return 0;
5306 #endif
5291 } 5307 }
5292 5308
5293 5309
5294 double CpuProfileNode::GetTotalTime() const { 5310 double CpuProfileNode::GetTotalTime() const {
5311 #ifdef ENABLE_LOGGING_AND_PROFILING
5295 i::Isolate* isolate = i::Isolate::Current(); 5312 i::Isolate* isolate = i::Isolate::Current();
5296 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime"); 5313 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalTime");
5297 return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis(); 5314 return reinterpret_cast<const i::ProfileNode*>(this)->GetTotalMillis();
5315 #else
5316 return 0.0;
5317 #endif
5298 } 5318 }
5299 5319
5300 5320
5301 double CpuProfileNode::GetSelfTime() const { 5321 double CpuProfileNode::GetSelfTime() const {
5322 #ifdef ENABLE_LOGGING_AND_PROFILING
5302 i::Isolate* isolate = i::Isolate::Current(); 5323 i::Isolate* isolate = i::Isolate::Current();
5303 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime"); 5324 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfTime");
5304 return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis(); 5325 return reinterpret_cast<const i::ProfileNode*>(this)->GetSelfMillis();
5326 #else
5327 return 0.0;
5328 #endif
5305 } 5329 }
5306 5330
5307 5331
5308 double CpuProfileNode::GetTotalSamplesCount() const { 5332 double CpuProfileNode::GetTotalSamplesCount() const {
5333 #ifdef ENABLE_LOGGING_AND_PROFILING
5309 i::Isolate* isolate = i::Isolate::Current(); 5334 i::Isolate* isolate = i::Isolate::Current();
5310 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount"); 5335 IsDeadCheck(isolate, "v8::CpuProfileNode::GetTotalSamplesCount");
5311 return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks(); 5336 return reinterpret_cast<const i::ProfileNode*>(this)->total_ticks();
5337 #else
5338 return 0.0;
5339 #endif
5312 } 5340 }
5313 5341
5314 5342
5315 double CpuProfileNode::GetSelfSamplesCount() const { 5343 double CpuProfileNode::GetSelfSamplesCount() const {
5344 #ifdef ENABLE_LOGGING_AND_PROFILING
5316 i::Isolate* isolate = i::Isolate::Current(); 5345 i::Isolate* isolate = i::Isolate::Current();
5317 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount"); 5346 IsDeadCheck(isolate, "v8::CpuProfileNode::GetSelfSamplesCount");
5318 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); 5347 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks();
5348 #else
5349 return 0.0;
5350 #endif
5319 } 5351 }
5320 5352
5321 5353
5322 unsigned CpuProfileNode::GetCallUid() const { 5354 unsigned CpuProfileNode::GetCallUid() const {
5355 #ifdef ENABLE_LOGGING_AND_PROFILING
5323 i::Isolate* isolate = i::Isolate::Current(); 5356 i::Isolate* isolate = i::Isolate::Current();
5324 IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid"); 5357 IsDeadCheck(isolate, "v8::CpuProfileNode::GetCallUid");
5325 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid(); 5358 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->GetCallUid();
5359 #else
5360 return 0;
5361 #endif
5326 } 5362 }
5327 5363
5328 5364
5329 int CpuProfileNode::GetChildrenCount() const { 5365 int CpuProfileNode::GetChildrenCount() const {
5366 #ifdef ENABLE_LOGGING_AND_PROFILING
5330 i::Isolate* isolate = i::Isolate::Current(); 5367 i::Isolate* isolate = i::Isolate::Current();
5331 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount"); 5368 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChildrenCount");
5332 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length(); 5369 return reinterpret_cast<const i::ProfileNode*>(this)->children()->length();
5370 #else
5371 return 0;
5372 #endif
5333 } 5373 }
5334 5374
5335 5375
5336 const CpuProfileNode* CpuProfileNode::GetChild(int index) const { 5376 const CpuProfileNode* CpuProfileNode::GetChild(int index) const {
5377 #ifdef ENABLE_LOGGING_AND_PROFILING
5337 i::Isolate* isolate = i::Isolate::Current(); 5378 i::Isolate* isolate = i::Isolate::Current();
5338 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild"); 5379 IsDeadCheck(isolate, "v8::CpuProfileNode::GetChild");
5339 const i::ProfileNode* child = 5380 const i::ProfileNode* child =
5340 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index); 5381 reinterpret_cast<const i::ProfileNode*>(this)->children()->at(index);
5341 return reinterpret_cast<const CpuProfileNode*>(child); 5382 return reinterpret_cast<const CpuProfileNode*>(child);
5383 #else
5384 return NULL;
5385 #endif
5342 } 5386 }
5343 5387
5344 5388
5345 void CpuProfile::Delete() { 5389 void CpuProfile::Delete() {
5390 #ifdef ENABLE_LOGGING_AND_PROFILING
5346 i::Isolate* isolate = i::Isolate::Current(); 5391 i::Isolate* isolate = i::Isolate::Current();
5347 IsDeadCheck(isolate, "v8::CpuProfile::Delete"); 5392 IsDeadCheck(isolate, "v8::CpuProfile::Delete");
5348 i::CpuProfiler::DeleteProfile(reinterpret_cast<i::CpuProfile*>(this)); 5393 i::CpuProfiler::DeleteProfile(reinterpret_cast<i::CpuProfile*>(this));
5349 if (i::CpuProfiler::GetProfilesCount() == 0 && 5394 if (i::CpuProfiler::GetProfilesCount() == 0 &&
5350 !i::CpuProfiler::HasDetachedProfiles()) { 5395 !i::CpuProfiler::HasDetachedProfiles()) {
5351 // If this was the last profile, clean up all accessory data as well. 5396 // If this was the last profile, clean up all accessory data as well.
5352 i::CpuProfiler::DeleteAllProfiles(); 5397 i::CpuProfiler::DeleteAllProfiles();
5353 } 5398 }
5399 #endif
5354 } 5400 }
5355 5401
5356 5402
5357 unsigned CpuProfile::GetUid() const { 5403 unsigned CpuProfile::GetUid() const {
5404 #ifdef ENABLE_LOGGING_AND_PROFILING
5358 i::Isolate* isolate = i::Isolate::Current(); 5405 i::Isolate* isolate = i::Isolate::Current();
5359 IsDeadCheck(isolate, "v8::CpuProfile::GetUid"); 5406 IsDeadCheck(isolate, "v8::CpuProfile::GetUid");
5360 return reinterpret_cast<const i::CpuProfile*>(this)->uid(); 5407 return reinterpret_cast<const i::CpuProfile*>(this)->uid();
5408 #else
5409 return 0;
5410 #endif
5361 } 5411 }
5362 5412
5363 5413
5364 Handle<String> CpuProfile::GetTitle() const { 5414 Handle<String> CpuProfile::GetTitle() const {
5415 #ifdef ENABLE_LOGGING_AND_PROFILING
5365 i::Isolate* isolate = i::Isolate::Current(); 5416 i::Isolate* isolate = i::Isolate::Current();
5366 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle"); 5417 IsDeadCheck(isolate, "v8::CpuProfile::GetTitle");
5367 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5418 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
5368 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5419 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5369 profile->title()))); 5420 profile->title())));
5421 #else
5422 return v8::String::Empty();
5423 #endif
5370 } 5424 }
5371 5425
5372 5426
5373 const CpuProfileNode* CpuProfile::GetBottomUpRoot() const { 5427 const CpuProfileNode* CpuProfile::GetBottomUpRoot() const {
5428 #ifdef ENABLE_LOGGING_AND_PROFILING
5374 i::Isolate* isolate = i::Isolate::Current(); 5429 i::Isolate* isolate = i::Isolate::Current();
5375 IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot"); 5430 IsDeadCheck(isolate, "v8::CpuProfile::GetBottomUpRoot");
5376 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5431 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
5377 return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root()); 5432 return reinterpret_cast<const CpuProfileNode*>(profile->bottom_up()->root());
5433 #else
5434 return NULL;
5435 #endif
5378 } 5436 }
5379 5437
5380 5438
5381 const CpuProfileNode* CpuProfile::GetTopDownRoot() const { 5439 const CpuProfileNode* CpuProfile::GetTopDownRoot() const {
5440 #ifdef ENABLE_LOGGING_AND_PROFILING
5382 i::Isolate* isolate = i::Isolate::Current(); 5441 i::Isolate* isolate = i::Isolate::Current();
5383 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot"); 5442 IsDeadCheck(isolate, "v8::CpuProfile::GetTopDownRoot");
5384 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 5443 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
5385 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); 5444 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root());
5445 #else
5446 return NULL;
5447 #endif
5386 } 5448 }
5387 5449
5388 5450
5389 int CpuProfiler::GetProfilesCount() { 5451 int CpuProfiler::GetProfilesCount() {
5452 #ifdef ENABLE_LOGGING_AND_PROFILING
5390 i::Isolate* isolate = i::Isolate::Current(); 5453 i::Isolate* isolate = i::Isolate::Current();
5391 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount"); 5454 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfilesCount");
5392 return i::CpuProfiler::GetProfilesCount(); 5455 return i::CpuProfiler::GetProfilesCount();
5456 #else
5457 return 0;
5458 #endif
5393 } 5459 }
5394 5460
5395 5461
5396 const CpuProfile* CpuProfiler::GetProfile(int index, 5462 const CpuProfile* CpuProfiler::GetProfile(int index,
5397 Handle<Value> security_token) { 5463 Handle<Value> security_token) {
5464 #ifdef ENABLE_LOGGING_AND_PROFILING
5398 i::Isolate* isolate = i::Isolate::Current(); 5465 i::Isolate* isolate = i::Isolate::Current();
5399 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile"); 5466 IsDeadCheck(isolate, "v8::CpuProfiler::GetProfile");
5400 return reinterpret_cast<const CpuProfile*>( 5467 return reinterpret_cast<const CpuProfile*>(
5401 i::CpuProfiler::GetProfile( 5468 i::CpuProfiler::GetProfile(
5402 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5469 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
5403 index)); 5470 index));
5471 #else
5472 return NULL;
5473 #endif
5404 } 5474 }
5405 5475
5406 5476
5407 const CpuProfile* CpuProfiler::FindProfile(unsigned uid, 5477 const CpuProfile* CpuProfiler::FindProfile(unsigned uid,
5408 Handle<Value> security_token) { 5478 Handle<Value> security_token) {
5479 #ifdef ENABLE_LOGGING_AND_PROFILING
5409 i::Isolate* isolate = i::Isolate::Current(); 5480 i::Isolate* isolate = i::Isolate::Current();
5410 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile"); 5481 IsDeadCheck(isolate, "v8::CpuProfiler::FindProfile");
5411 return reinterpret_cast<const CpuProfile*>( 5482 return reinterpret_cast<const CpuProfile*>(
5412 i::CpuProfiler::FindProfile( 5483 i::CpuProfiler::FindProfile(
5413 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5484 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
5414 uid)); 5485 uid));
5486 #else
5487 return NULL;
5488 #endif
5415 } 5489 }
5416 5490
5417 5491
5418 void CpuProfiler::StartProfiling(Handle<String> title) { 5492 void CpuProfiler::StartProfiling(Handle<String> title) {
5493 #ifdef ENABLE_LOGGING_AND_PROFILING
5419 i::Isolate* isolate = i::Isolate::Current(); 5494 i::Isolate* isolate = i::Isolate::Current();
5420 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling"); 5495 IsDeadCheck(isolate, "v8::CpuProfiler::StartProfiling");
5421 i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title)); 5496 i::CpuProfiler::StartProfiling(*Utils::OpenHandle(*title));
5497 #endif
5422 } 5498 }
5423 5499
5424 5500
5425 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title, 5501 const CpuProfile* CpuProfiler::StopProfiling(Handle<String> title,
5426 Handle<Value> security_token) { 5502 Handle<Value> security_token) {
5503 #ifdef ENABLE_LOGGING_AND_PROFILING
5427 i::Isolate* isolate = i::Isolate::Current(); 5504 i::Isolate* isolate = i::Isolate::Current();
5428 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling"); 5505 IsDeadCheck(isolate, "v8::CpuProfiler::StopProfiling");
5429 return reinterpret_cast<const CpuProfile*>( 5506 return reinterpret_cast<const CpuProfile*>(
5430 i::CpuProfiler::StopProfiling( 5507 i::CpuProfiler::StopProfiling(
5431 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token), 5508 security_token.IsEmpty() ? NULL : *Utils::OpenHandle(*security_token),
5432 *Utils::OpenHandle(*title))); 5509 *Utils::OpenHandle(*title)));
5510 #else
5511 return NULL;
5512 #endif
5433 } 5513 }
5434 5514
5435 5515
5436 void CpuProfiler::DeleteAllProfiles() { 5516 void CpuProfiler::DeleteAllProfiles() {
5517 #ifdef ENABLE_LOGGING_AND_PROFILING
5437 i::Isolate* isolate = i::Isolate::Current(); 5518 i::Isolate* isolate = i::Isolate::Current();
5438 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles"); 5519 IsDeadCheck(isolate, "v8::CpuProfiler::DeleteAllProfiles");
5439 i::CpuProfiler::DeleteAllProfiles(); 5520 i::CpuProfiler::DeleteAllProfiles();
5521 #endif
5440 } 5522 }
5441 5523
5442 5524
5525 #ifdef ENABLE_LOGGING_AND_PROFILING
5443 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 5526 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
5444 return const_cast<i::HeapGraphEdge*>( 5527 return const_cast<i::HeapGraphEdge*>(
5445 reinterpret_cast<const i::HeapGraphEdge*>(edge)); 5528 reinterpret_cast<const i::HeapGraphEdge*>(edge));
5446 } 5529 }
5530 #endif
5531
5447 5532
5448 HeapGraphEdge::Type HeapGraphEdge::GetType() const { 5533 HeapGraphEdge::Type HeapGraphEdge::GetType() const {
5534 #ifdef ENABLE_LOGGING_AND_PROFILING
5449 i::Isolate* isolate = i::Isolate::Current(); 5535 i::Isolate* isolate = i::Isolate::Current();
5450 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType"); 5536 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType");
5451 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type()); 5537 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type());
5538 #else
5539 return static_cast<HeapGraphEdge::Type>(0);
5540 #endif
5452 } 5541 }
5453 5542
5454 5543
5455 Handle<Value> HeapGraphEdge::GetName() const { 5544 Handle<Value> HeapGraphEdge::GetName() const {
5545 #ifdef ENABLE_LOGGING_AND_PROFILING
5456 i::Isolate* isolate = i::Isolate::Current(); 5546 i::Isolate* isolate = i::Isolate::Current();
5457 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName"); 5547 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetName");
5458 i::HeapGraphEdge* edge = ToInternal(this); 5548 i::HeapGraphEdge* edge = ToInternal(this);
5459 switch (edge->type()) { 5549 switch (edge->type()) {
5460 case i::HeapGraphEdge::kContextVariable: 5550 case i::HeapGraphEdge::kContextVariable:
5461 case i::HeapGraphEdge::kInternal: 5551 case i::HeapGraphEdge::kInternal:
5462 case i::HeapGraphEdge::kProperty: 5552 case i::HeapGraphEdge::kProperty:
5463 case i::HeapGraphEdge::kShortcut: 5553 case i::HeapGraphEdge::kShortcut:
5464 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5554 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5465 edge->name()))); 5555 edge->name())));
5466 case i::HeapGraphEdge::kElement: 5556 case i::HeapGraphEdge::kElement:
5467 case i::HeapGraphEdge::kHidden: 5557 case i::HeapGraphEdge::kHidden:
5468 return Handle<Number>(ToApi<Number>(isolate->factory()->NewNumberFromInt( 5558 return Handle<Number>(ToApi<Number>(isolate->factory()->NewNumberFromInt(
5469 edge->index()))); 5559 edge->index())));
5470 default: UNREACHABLE(); 5560 default: UNREACHABLE();
5471 } 5561 }
5562 #endif
5472 return v8::Undefined(); 5563 return v8::Undefined();
5473 } 5564 }
5474 5565
5475 5566
5476 const HeapGraphNode* HeapGraphEdge::GetFromNode() const { 5567 const HeapGraphNode* HeapGraphEdge::GetFromNode() const {
5568 #ifdef ENABLE_LOGGING_AND_PROFILING
5477 i::Isolate* isolate = i::Isolate::Current(); 5569 i::Isolate* isolate = i::Isolate::Current();
5478 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode"); 5570 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode");
5479 const i::HeapEntry* from = ToInternal(this)->From(); 5571 const i::HeapEntry* from = ToInternal(this)->From();
5480 return reinterpret_cast<const HeapGraphNode*>(from); 5572 return reinterpret_cast<const HeapGraphNode*>(from);
5573 #else
5574 return NULL;
5575 #endif
5481 } 5576 }
5482 5577
5483 5578
5484 const HeapGraphNode* HeapGraphEdge::GetToNode() const { 5579 const HeapGraphNode* HeapGraphEdge::GetToNode() const {
5580 #ifdef ENABLE_LOGGING_AND_PROFILING
5485 i::Isolate* isolate = i::Isolate::Current(); 5581 i::Isolate* isolate = i::Isolate::Current();
5486 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode"); 5582 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetToNode");
5487 const i::HeapEntry* to = ToInternal(this)->to(); 5583 const i::HeapEntry* to = ToInternal(this)->to();
5488 return reinterpret_cast<const HeapGraphNode*>(to); 5584 return reinterpret_cast<const HeapGraphNode*>(to);
5585 #else
5586 return NULL;
5587 #endif
5489 } 5588 }
5490 5589
5491 5590
5591 #ifdef ENABLE_LOGGING_AND_PROFILING
5492 static i::HeapEntry* ToInternal(const HeapGraphNode* entry) { 5592 static i::HeapEntry* ToInternal(const HeapGraphNode* entry) {
5493 return const_cast<i::HeapEntry*>( 5593 return const_cast<i::HeapEntry*>(
5494 reinterpret_cast<const i::HeapEntry*>(entry)); 5594 reinterpret_cast<const i::HeapEntry*>(entry));
5495 } 5595 }
5596 #endif
5496 5597
5497 5598
5498 HeapGraphNode::Type HeapGraphNode::GetType() const { 5599 HeapGraphNode::Type HeapGraphNode::GetType() const {
5600 #ifdef ENABLE_LOGGING_AND_PROFILING
5499 i::Isolate* isolate = i::Isolate::Current(); 5601 i::Isolate* isolate = i::Isolate::Current();
5500 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType"); 5602 IsDeadCheck(isolate, "v8::HeapGraphNode::GetType");
5501 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type()); 5603 return static_cast<HeapGraphNode::Type>(ToInternal(this)->type());
5604 #else
5605 return static_cast<HeapGraphNode::Type>(0);
5606 #endif
5502 } 5607 }
5503 5608
5504 5609
5505 Handle<String> HeapGraphNode::GetName() const { 5610 Handle<String> HeapGraphNode::GetName() const {
5611 #ifdef ENABLE_LOGGING_AND_PROFILING
5506 i::Isolate* isolate = i::Isolate::Current(); 5612 i::Isolate* isolate = i::Isolate::Current();
5507 IsDeadCheck(isolate, "v8::HeapGraphNode::GetName"); 5613 IsDeadCheck(isolate, "v8::HeapGraphNode::GetName");
5508 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5614 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5509 ToInternal(this)->name()))); 5615 ToInternal(this)->name())));
5616 #else
5617 return v8::String::Empty();
5618 #endif
5510 } 5619 }
5511 5620
5512 5621
5513 uint64_t HeapGraphNode::GetId() const { 5622 uint64_t HeapGraphNode::GetId() const {
5623 #ifdef ENABLE_LOGGING_AND_PROFILING
5514 i::Isolate* isolate = i::Isolate::Current(); 5624 i::Isolate* isolate = i::Isolate::Current();
5515 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId"); 5625 IsDeadCheck(isolate, "v8::HeapGraphNode::GetId");
5516 ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated); 5626 ASSERT(ToInternal(this)->snapshot()->type() != i::HeapSnapshot::kAggregated);
5517 return ToInternal(this)->id(); 5627 return ToInternal(this)->id();
5628 #else
5629 return 0;
5630 #endif
5518 } 5631 }
5519 5632
5520 5633
5521 int HeapGraphNode::GetInstancesCount() const { 5634 int HeapGraphNode::GetInstancesCount() const {
5635 #ifdef ENABLE_LOGGING_AND_PROFILING
5522 i::Isolate* isolate = i::Isolate::Current(); 5636 i::Isolate* isolate = i::Isolate::Current();
5523 IsDeadCheck(isolate, "v8::HeapGraphNode::GetInstancesCount"); 5637 IsDeadCheck(isolate, "v8::HeapGraphNode::GetInstancesCount");
5524 ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated); 5638 ASSERT(ToInternal(this)->snapshot()->type() == i::HeapSnapshot::kAggregated);
5525 return static_cast<int>(ToInternal(this)->id()); 5639 return static_cast<int>(ToInternal(this)->id());
5640 #else
5641 return 0;
5642 #endif
5526 } 5643 }
5527 5644
5528 5645
5529 int HeapGraphNode::GetSelfSize() const { 5646 int HeapGraphNode::GetSelfSize() const {
5647 #ifdef ENABLE_LOGGING_AND_PROFILING
5530 i::Isolate* isolate = i::Isolate::Current(); 5648 i::Isolate* isolate = i::Isolate::Current();
5531 IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize"); 5649 IsDeadCheck(isolate, "v8::HeapGraphNode::GetSelfSize");
5532 return ToInternal(this)->self_size(); 5650 return ToInternal(this)->self_size();
5651 #else
5652 return 0;
5653 #endif
5533 } 5654 }
5534 5655
5535 5656
5536 int HeapGraphNode::GetRetainedSize(bool exact) const { 5657 int HeapGraphNode::GetRetainedSize(bool exact) const {
5658 #ifdef ENABLE_LOGGING_AND_PROFILING
5537 i::Isolate* isolate = i::Isolate::Current(); 5659 i::Isolate* isolate = i::Isolate::Current();
5538 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainedSize"); 5660 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainedSize");
5539 return ToInternal(this)->RetainedSize(exact); 5661 return ToInternal(this)->RetainedSize(exact);
5662 #else
5663 return 0;
5664 #endif
5540 } 5665 }
5541 5666
5542 5667
5543 int HeapGraphNode::GetChildrenCount() const { 5668 int HeapGraphNode::GetChildrenCount() const {
5669 #ifdef ENABLE_LOGGING_AND_PROFILING
5544 i::Isolate* isolate = i::Isolate::Current(); 5670 i::Isolate* isolate = i::Isolate::Current();
5545 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChildrenCount"); 5671 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChildrenCount");
5546 return ToInternal(this)->children().length(); 5672 return ToInternal(this)->children().length();
5673 #else
5674 return 0;
5675 #endif
5547 } 5676 }
5548 5677
5549 5678
5550 const HeapGraphEdge* HeapGraphNode::GetChild(int index) const { 5679 const HeapGraphEdge* HeapGraphNode::GetChild(int index) const {
5680 #ifdef ENABLE_LOGGING_AND_PROFILING
5551 i::Isolate* isolate = i::Isolate::Current(); 5681 i::Isolate* isolate = i::Isolate::Current();
5552 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild"); 5682 IsDeadCheck(isolate, "v8::HeapSnapshot::GetChild");
5553 return reinterpret_cast<const HeapGraphEdge*>( 5683 return reinterpret_cast<const HeapGraphEdge*>(
5554 &ToInternal(this)->children()[index]); 5684 &ToInternal(this)->children()[index]);
5685 #else
5686 return NULL;
5687 #endif
5555 } 5688 }
5556 5689
5557 5690
5558 int HeapGraphNode::GetRetainersCount() const { 5691 int HeapGraphNode::GetRetainersCount() const {
5692 #ifdef ENABLE_LOGGING_AND_PROFILING
5559 i::Isolate* isolate = i::Isolate::Current(); 5693 i::Isolate* isolate = i::Isolate::Current();
5560 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainersCount"); 5694 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainersCount");
5561 return ToInternal(this)->retainers().length(); 5695 return ToInternal(this)->retainers().length();
5696 #else
5697 return 0;
5698 #endif
5562 } 5699 }
5563 5700
5564 5701
5565 const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const { 5702 const HeapGraphEdge* HeapGraphNode::GetRetainer(int index) const {
5703 #ifdef ENABLE_LOGGING_AND_PROFILING
5566 i::Isolate* isolate = i::Isolate::Current(); 5704 i::Isolate* isolate = i::Isolate::Current();
5567 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer"); 5705 IsDeadCheck(isolate, "v8::HeapSnapshot::GetRetainer");
5568 return reinterpret_cast<const HeapGraphEdge*>( 5706 return reinterpret_cast<const HeapGraphEdge*>(
5569 ToInternal(this)->retainers()[index]); 5707 ToInternal(this)->retainers()[index]);
5708 #else
5709 return NULL;
5710 #endif
5570 } 5711 }
5571 5712
5572 5713
5573 const HeapGraphNode* HeapGraphNode::GetDominatorNode() const { 5714 const HeapGraphNode* HeapGraphNode::GetDominatorNode() const {
5715 #ifdef ENABLE_LOGGING_AND_PROFILING
5574 i::Isolate* isolate = i::Isolate::Current(); 5716 i::Isolate* isolate = i::Isolate::Current();
5575 IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode"); 5717 IsDeadCheck(isolate, "v8::HeapSnapshot::GetDominatorNode");
5576 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator()); 5718 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->dominator());
5719 #else
5720 return NULL;
5721 #endif
5577 } 5722 }
5578 5723
5579 5724
5725 #ifdef ENABLE_LOGGING_AND_PROFILING
5580 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) { 5726 static i::HeapSnapshot* ToInternal(const HeapSnapshot* snapshot) {
5581 return const_cast<i::HeapSnapshot*>( 5727 return const_cast<i::HeapSnapshot*>(
5582 reinterpret_cast<const i::HeapSnapshot*>(snapshot)); 5728 reinterpret_cast<const i::HeapSnapshot*>(snapshot));
5583 } 5729 }
5730 #endif
5584 5731
5585 5732
5586 void HeapSnapshot::Delete() { 5733 void HeapSnapshot::Delete() {
5734 #ifdef ENABLE_LOGGING_AND_PROFILING
5587 i::Isolate* isolate = i::Isolate::Current(); 5735 i::Isolate* isolate = i::Isolate::Current();
5588 IsDeadCheck(isolate, "v8::HeapSnapshot::Delete"); 5736 IsDeadCheck(isolate, "v8::HeapSnapshot::Delete");
5589 if (i::HeapProfiler::GetSnapshotsCount() > 1) { 5737 if (i::HeapProfiler::GetSnapshotsCount() > 1) {
5590 ToInternal(this)->Delete(); 5738 ToInternal(this)->Delete();
5591 } else { 5739 } else {
5592 // If this is the last snapshot, clean up all accessory data as well. 5740 // If this is the last snapshot, clean up all accessory data as well.
5593 i::HeapProfiler::DeleteAllSnapshots(); 5741 i::HeapProfiler::DeleteAllSnapshots();
5594 } 5742 }
5743 #endif
5595 } 5744 }
5596 5745
5597 5746
5598 HeapSnapshot::Type HeapSnapshot::GetType() const { 5747 HeapSnapshot::Type HeapSnapshot::GetType() const {
5748 #ifdef ENABLE_LOGGING_AND_PROFILING
5599 i::Isolate* isolate = i::Isolate::Current(); 5749 i::Isolate* isolate = i::Isolate::Current();
5600 IsDeadCheck(isolate, "v8::HeapSnapshot::GetType"); 5750 IsDeadCheck(isolate, "v8::HeapSnapshot::GetType");
5601 return static_cast<HeapSnapshot::Type>(ToInternal(this)->type()); 5751 return static_cast<HeapSnapshot::Type>(ToInternal(this)->type());
5752 #else
5753 return static_cast<HeapSnapshot::Type>(0);
5754 #endif
5602 } 5755 }
5603 5756
5604 5757
5605 unsigned HeapSnapshot::GetUid() const { 5758 unsigned HeapSnapshot::GetUid() const {
5759 #ifdef ENABLE_LOGGING_AND_PROFILING
5606 i::Isolate* isolate = i::Isolate::Current(); 5760 i::Isolate* isolate = i::Isolate::Current();
5607 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid"); 5761 IsDeadCheck(isolate, "v8::HeapSnapshot::GetUid");
5608 return ToInternal(this)->uid(); 5762 return ToInternal(this)->uid();
5763 #else
5764 return 0;
5765 #endif
5609 } 5766 }
5610 5767
5611 5768
5612 Handle<String> HeapSnapshot::GetTitle() const { 5769 Handle<String> HeapSnapshot::GetTitle() const {
5770 #ifdef ENABLE_LOGGING_AND_PROFILING
5613 i::Isolate* isolate = i::Isolate::Current(); 5771 i::Isolate* isolate = i::Isolate::Current();
5614 IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle"); 5772 IsDeadCheck(isolate, "v8::HeapSnapshot::GetTitle");
5615 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5773 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5616 ToInternal(this)->title()))); 5774 ToInternal(this)->title())));
5775 #else
5776 return v8::String::Empty();
5777 #endif
5617 } 5778 }
5618 5779
5619 5780
5620 const HeapGraphNode* HeapSnapshot::GetRoot() const { 5781 const HeapGraphNode* HeapSnapshot::GetRoot() const {
5782 #ifdef ENABLE_LOGGING_AND_PROFILING
5621 i::Isolate* isolate = i::Isolate::Current(); 5783 i::Isolate* isolate = i::Isolate::Current();
5622 IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead"); 5784 IsDeadCheck(isolate, "v8::HeapSnapshot::GetHead");
5623 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); 5785 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root());
5786 #else
5787 return 0;
5788 #endif
5624 } 5789 }
5625 5790
5626 5791
5627 const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const { 5792 const HeapGraphNode* HeapSnapshot::GetNodeById(uint64_t id) const {
5793 #ifdef ENABLE_LOGGING_AND_PROFILING
5628 i::Isolate* isolate = i::Isolate::Current(); 5794 i::Isolate* isolate = i::Isolate::Current();
5629 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById"); 5795 IsDeadCheck(isolate, "v8::HeapSnapshot::GetNodeById");
5630 return reinterpret_cast<const HeapGraphNode*>( 5796 return reinterpret_cast<const HeapGraphNode*>(
5631 ToInternal(this)->GetEntryById(id)); 5797 ToInternal(this)->GetEntryById(id));
5798 #else
5799 return NULL;
5800 #endif
5632 } 5801 }
5633 5802
5634 5803
5635 void HeapSnapshot::Serialize(OutputStream* stream, 5804 void HeapSnapshot::Serialize(OutputStream* stream,
5636 HeapSnapshot::SerializationFormat format) const { 5805 HeapSnapshot::SerializationFormat format) const {
5806 #ifdef ENABLE_LOGGING_AND_PROFILING
5637 i::Isolate* isolate = i::Isolate::Current(); 5807 i::Isolate* isolate = i::Isolate::Current();
5638 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize"); 5808 IsDeadCheck(isolate, "v8::HeapSnapshot::Serialize");
5639 ApiCheck(format == kJSON, 5809 ApiCheck(format == kJSON,
5640 "v8::HeapSnapshot::Serialize", 5810 "v8::HeapSnapshot::Serialize",
5641 "Unknown serialization format"); 5811 "Unknown serialization format");
5642 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii, 5812 ApiCheck(stream->GetOutputEncoding() == OutputStream::kAscii,
5643 "v8::HeapSnapshot::Serialize", 5813 "v8::HeapSnapshot::Serialize",
5644 "Unsupported output encoding"); 5814 "Unsupported output encoding");
5645 ApiCheck(stream->GetChunkSize() > 0, 5815 ApiCheck(stream->GetChunkSize() > 0,
5646 "v8::HeapSnapshot::Serialize", 5816 "v8::HeapSnapshot::Serialize",
5647 "Invalid stream chunk size"); 5817 "Invalid stream chunk size");
5648 i::HeapSnapshotJSONSerializer serializer(ToInternal(this)); 5818 i::HeapSnapshotJSONSerializer serializer(ToInternal(this));
5649 serializer.Serialize(stream); 5819 serializer.Serialize(stream);
5820 #endif
5650 } 5821 }
5651 5822
5652 5823
5653 int HeapProfiler::GetSnapshotsCount() { 5824 int HeapProfiler::GetSnapshotsCount() {
5825 #ifdef ENABLE_LOGGING_AND_PROFILING
5654 i::Isolate* isolate = i::Isolate::Current(); 5826 i::Isolate* isolate = i::Isolate::Current();
5655 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount"); 5827 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshotsCount");
5656 return i::HeapProfiler::GetSnapshotsCount(); 5828 return i::HeapProfiler::GetSnapshotsCount();
5829 #else
5830 return 0;
5831 #endif
5657 } 5832 }
5658 5833
5659 5834
5660 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) { 5835 const HeapSnapshot* HeapProfiler::GetSnapshot(int index) {
5836 #ifdef ENABLE_LOGGING_AND_PROFILING
5661 i::Isolate* isolate = i::Isolate::Current(); 5837 i::Isolate* isolate = i::Isolate::Current();
5662 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot"); 5838 IsDeadCheck(isolate, "v8::HeapProfiler::GetSnapshot");
5663 return reinterpret_cast<const HeapSnapshot*>( 5839 return reinterpret_cast<const HeapSnapshot*>(
5664 i::HeapProfiler::GetSnapshot(index)); 5840 i::HeapProfiler::GetSnapshot(index));
5841 #else
5842 return NULL;
5843 #endif
5665 } 5844 }
5666 5845
5667 5846
5668 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) { 5847 const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
5848 #ifdef ENABLE_LOGGING_AND_PROFILING
5669 i::Isolate* isolate = i::Isolate::Current(); 5849 i::Isolate* isolate = i::Isolate::Current();
5670 IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot"); 5850 IsDeadCheck(isolate, "v8::HeapProfiler::FindSnapshot");
5671 return reinterpret_cast<const HeapSnapshot*>( 5851 return reinterpret_cast<const HeapSnapshot*>(
5672 i::HeapProfiler::FindSnapshot(uid)); 5852 i::HeapProfiler::FindSnapshot(uid));
5853 #else
5854 return NULL;
5855 #endif
5673 } 5856 }
5674 5857
5675 5858
5676 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title, 5859 const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
5677 HeapSnapshot::Type type, 5860 HeapSnapshot::Type type,
5678 ActivityControl* control) { 5861 ActivityControl* control) {
5862 #ifdef ENABLE_LOGGING_AND_PROFILING
5679 i::Isolate* isolate = i::Isolate::Current(); 5863 i::Isolate* isolate = i::Isolate::Current();
5680 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot"); 5864 IsDeadCheck(isolate, "v8::HeapProfiler::TakeSnapshot");
5681 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull; 5865 i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
5682 switch (type) { 5866 switch (type) {
5683 case HeapSnapshot::kFull: 5867 case HeapSnapshot::kFull:
5684 internal_type = i::HeapSnapshot::kFull; 5868 internal_type = i::HeapSnapshot::kFull;
5685 break; 5869 break;
5686 case HeapSnapshot::kAggregated: 5870 case HeapSnapshot::kAggregated:
5687 internal_type = i::HeapSnapshot::kAggregated; 5871 internal_type = i::HeapSnapshot::kAggregated;
5688 break; 5872 break;
5689 default: 5873 default:
5690 UNREACHABLE(); 5874 UNREACHABLE();
5691 } 5875 }
5692 return reinterpret_cast<const HeapSnapshot*>( 5876 return reinterpret_cast<const HeapSnapshot*>(
5693 i::HeapProfiler::TakeSnapshot( 5877 i::HeapProfiler::TakeSnapshot(
5694 *Utils::OpenHandle(*title), internal_type, control)); 5878 *Utils::OpenHandle(*title), internal_type, control));
5879 #else
5880 return NULL;
5881 #endif
5695 } 5882 }
5696 5883
5697 5884
5698 void HeapProfiler::DeleteAllSnapshots() { 5885 void HeapProfiler::DeleteAllSnapshots() {
5886 #ifdef ENABLE_LOGGING_AND_PROFILING
5699 i::Isolate* isolate = i::Isolate::Current(); 5887 i::Isolate* isolate = i::Isolate::Current();
5700 IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots"); 5888 IsDeadCheck(isolate, "v8::HeapProfiler::DeleteAllSnapshots");
5701 i::HeapProfiler::DeleteAllSnapshots(); 5889 i::HeapProfiler::DeleteAllSnapshots();
5890 #endif
5702 } 5891 }
5703 5892
5704 5893
5705 void HeapProfiler::DefineWrapperClass(uint16_t class_id, 5894 void HeapProfiler::DefineWrapperClass(uint16_t class_id,
5706 WrapperInfoCallback callback) { 5895 WrapperInfoCallback callback) {
5896 #ifdef ENABLE_LOGGING_AND_PROFILING
5707 i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id, 5897 i::Isolate::Current()->heap_profiler()->DefineWrapperClass(class_id,
5708 callback); 5898 callback);
5899 #endif
5709 } 5900 }
5710 5901
5711 #endif // ENABLE_LOGGING_AND_PROFILING
5712 5902
5713 5903
5714 v8::Testing::StressType internal::Testing::stress_type_ = 5904 v8::Testing::StressType internal::Testing::stress_type_ =
5715 v8::Testing::kStressTypeOpt; 5905 v8::Testing::kStressTypeOpt;
5716 5906
5717 5907
5718 void Testing::SetStressRunType(Testing::StressType type) { 5908 void Testing::SetStressRunType(Testing::StressType type) {
5719 internal::Testing::set_stress_type(type); 5909 internal::Testing::set_stress_type(type);
5720 } 5910 }
5721 5911
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
5838 6028
5839 6029
5840 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6030 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5841 HandleScopeImplementer* scope_implementer = 6031 HandleScopeImplementer* scope_implementer =
5842 reinterpret_cast<HandleScopeImplementer*>(storage); 6032 reinterpret_cast<HandleScopeImplementer*>(storage);
5843 scope_implementer->IterateThis(v); 6033 scope_implementer->IterateThis(v);
5844 return storage + ArchiveSpacePerThread(); 6034 return storage + ArchiveSpacePerThread();
5845 } 6035 }
5846 6036
5847 } } // namespace v8::internal 6037 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « ChangeLog ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698