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

Side by Side Diff: src/api.cc

Issue 59373003: AllocationProfiler: introduce allocation_profiler flag in V8 api. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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
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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 static inline bool EmptyCheck(const char* location, const v8::Data* obj) { 277 static inline bool EmptyCheck(const char* location, const v8::Data* obj) {
278 return (obj == 0) ? ReportEmptyHandle(location) : false; 278 return (obj == 0) ? ReportEmptyHandle(location) : false;
279 } 279 }
280 280
281 281
282 // --- S t a t i c s --- 282 // --- S t a t i c s ---
283 283
284 284
285 static bool InitializeHelper(i::Isolate* isolate) { 285 static bool InitializeHelper(i::Isolate* isolate) {
286 // If the isolate has a function entry hook, it needs to re-build all its 286 // If the isolate has a function entry hook or enabled allocation profiler,
287 // code stubs with entry hooks embedded, so let's deserialize a snapshot. 287 // it needs to re-build all its code stubs with embedded entry hooks
288 if (isolate == NULL || isolate->function_entry_hook() == NULL) { 288 // or RecordObjectAllocation calls, so let's skip snapshot deserialization.
289 if (isolate == NULL || (
290 isolate->function_entry_hook() == NULL &&
291 !isolate->is_allocation_profiler_enabled())) {
289 if (i::Snapshot::Initialize()) 292 if (i::Snapshot::Initialize())
290 return true; 293 return true;
291 } 294 }
292 return i::V8::Initialize(NULL); 295 return i::V8::Initialize(NULL);
293 } 296 }
294 297
295 298
296 static inline bool EnsureInitializedForIsolate(i::Isolate* isolate, 299 static inline bool EnsureInitializedForIsolate(i::Isolate* isolate,
297 const char* location) { 300 const char* location) {
298 if (isolate != NULL) { 301 if (isolate != NULL) {
(...skipping 4687 matching lines...) Expand 10 before | Expand all | Expand 10 after
4986 i::RandomNumberGenerator::SetEntropySource(entropy_source); 4989 i::RandomNumberGenerator::SetEntropySource(entropy_source);
4987 } 4990 }
4988 4991
4989 4992
4990 void v8::V8::SetReturnAddressLocationResolver( 4993 void v8::V8::SetReturnAddressLocationResolver(
4991 ReturnAddressLocationResolver return_address_resolver) { 4994 ReturnAddressLocationResolver return_address_resolver) {
4992 i::V8::SetReturnAddressLocationResolver(return_address_resolver); 4995 i::V8::SetReturnAddressLocationResolver(return_address_resolver);
4993 } 4996 }
4994 4997
4995 4998
4999 bool v8::V8::EnableAllocationProfiler(Isolate* ext_isolate) {
5000 ASSERT(ext_isolate != NULL);
5001 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate);
5002 return isolate->enable_allocation_profiler();
5003 }
5004
5005
5006 bool v8::V8::IsAllocationProfilerEnabled(Isolate* ext_isolate) {
5007 ASSERT(ext_isolate != NULL);
5008 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate);
5009 return isolate->is_allocation_profiler_enabled();
5010 }
5011
5012
4996 bool v8::V8::SetFunctionEntryHook(Isolate* ext_isolate, 5013 bool v8::V8::SetFunctionEntryHook(Isolate* ext_isolate,
4997 FunctionEntryHook entry_hook) { 5014 FunctionEntryHook entry_hook) {
4998 ASSERT(ext_isolate != NULL); 5015 ASSERT(ext_isolate != NULL);
4999 ASSERT(entry_hook != NULL); 5016 ASSERT(entry_hook != NULL);
5000 5017
5001 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate); 5018 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate);
5002 5019
5003 // The entry hook can only be set before the Isolate is initialized, as 5020 // The entry hook can only be set before the Isolate is initialized, as
5004 // otherwise the Isolate's code stubs generated at initialization won't 5021 // otherwise the Isolate's code stubs generated at initialization won't
5005 // contain entry hooks. 5022 // contain entry hooks.
(...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after
7571 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7588 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7572 Address callback_address = 7589 Address callback_address =
7573 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7590 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7574 VMState<EXTERNAL> state(isolate); 7591 VMState<EXTERNAL> state(isolate);
7575 ExternalCallbackScope call_scope(isolate, callback_address); 7592 ExternalCallbackScope call_scope(isolate, callback_address);
7576 callback(info); 7593 callback(info);
7577 } 7594 }
7578 7595
7579 7596
7580 } } // namespace v8::internal 7597 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698