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/v8.cc

Issue 10706002: Implements a new API to set a function entry hook for profiling. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 bool V8::has_been_set_up_ = false; 53 bool V8::has_been_set_up_ = false;
54 bool V8::has_been_disposed_ = false; 54 bool V8::has_been_disposed_ = false;
55 bool V8::has_fatal_error_ = false; 55 bool V8::has_fatal_error_ = false;
56 bool V8::use_crankshaft_ = true; 56 bool V8::use_crankshaft_ = true;
57 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL; 57 List<CallCompletedCallback>* V8::call_completed_callbacks_ = NULL;
58 58
59 static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER; 59 static LazyMutex entropy_mutex = LAZY_MUTEX_INITIALIZER;
60 60
61 static EntropySource entropy_source; 61 static EntropySource entropy_source;
62 62
63 static uintptr_t profiler_entry_hook = 0;
64
63 65
64 bool V8::Initialize(Deserializer* des) { 66 bool V8::Initialize(Deserializer* des) {
65 FlagList::EnforceFlagImplications(); 67 FlagList::EnforceFlagImplications();
66 68
67 InitializeOncePerProcess(); 69 InitializeOncePerProcess();
68 70
69 // The current thread may not yet had entered an isolate to run. 71 // The current thread may not yet had entered an isolate to run.
70 // Note the Isolate::Current() may be non-null because for various 72 // Note the Isolate::Current() may be non-null because for various
71 // initialization purposes an initializing thread may be assigned an isolate 73 // initialization purposes an initializing thread may be assigned an isolate
72 // but not actually enter it. 74 // but not actually enter it.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 entropy_source = source; 159 entropy_source = source;
158 } 160 }
159 161
160 162
161 void V8::SetReturnAddressLocationResolver( 163 void V8::SetReturnAddressLocationResolver(
162 ReturnAddressLocationResolver resolver) { 164 ReturnAddressLocationResolver resolver) {
163 StackFrame::SetReturnAddressLocationResolver(resolver); 165 StackFrame::SetReturnAddressLocationResolver(resolver);
164 } 166 }
165 167
166 168
169 void V8::SetFunctionEntryHook(uintptr_t entry_hook) {
170 profiler_entry_hook = entry_hook;
171 }
172
173
174 uintptr_t V8::GetFunctionEntryHook() {
175 return profiler_entry_hook;
176 }
177
178
167 // Used by JavaScript APIs 179 // Used by JavaScript APIs
168 uint32_t V8::Random(Context* context) { 180 uint32_t V8::Random(Context* context) {
169 ASSERT(context->IsGlobalContext()); 181 ASSERT(context->IsGlobalContext());
170 ByteArray* seed = context->random_seed(); 182 ByteArray* seed = context->random_seed();
171 return random_base(reinterpret_cast<uint32_t*>(seed->GetDataStartAddress())); 183 return random_base(reinterpret_cast<uint32_t*>(seed->GetDataStartAddress()));
172 } 184 }
173 185
174 186
175 // Used internally by the JIT and memory allocator for security 187 // Used internally by the JIT and memory allocator for security
176 // purposes. So, we keep a different state to prevent informations 188 // purposes. So, we keep a different state to prevent informations
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 SetUpJSCallerSavedCodeData(); 291 SetUpJSCallerSavedCodeData();
280 SamplerRegistry::SetUp(); 292 SamplerRegistry::SetUp();
281 ExternalReference::SetUp(); 293 ExternalReference::SetUp();
282 } 294 }
283 295
284 void V8::InitializeOncePerProcess() { 296 void V8::InitializeOncePerProcess() {
285 CallOnce(&init_once, &InitializeOncePerProcessImpl); 297 CallOnce(&init_once, &InitializeOncePerProcessImpl);
286 } 298 }
287 299
288 } } // namespace v8::internal 300 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698