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

Side by Side Diff: src/api.cc

Issue 18062006: Revert r15361 "Improved function entry hook coverage" because of ARM build error. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | « include/v8.h ('k') | src/arm/builtins-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 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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 295
296 static inline bool EmptyCheck(const char* location, const v8::Data* obj) { 296 static inline bool EmptyCheck(const char* location, const v8::Data* obj) {
297 return (obj == 0) ? ReportEmptyHandle(location) : false; 297 return (obj == 0) ? ReportEmptyHandle(location) : false;
298 } 298 }
299 299
300 // --- S t a t i c s --- 300 // --- S t a t i c s ---
301 301
302 302
303 static bool InitializeHelper(i::Isolate* isolate) { 303 static bool InitializeHelper() {
304 // If the isolate has a function entry hook, it needs to re-build all its 304 if (i::Snapshot::Initialize()) return true;
305 // code stubs with entry hooks embedded, so let's deserialize a snapshot.
306 if (isolate == NULL || isolate->function_entry_hook() == NULL) {
307 if (i::Snapshot::Initialize())
308 return true;
309 }
310 return i::V8::Initialize(NULL); 305 return i::V8::Initialize(NULL);
311 } 306 }
312 307
313 308
314 static inline bool EnsureInitializedForIsolate(i::Isolate* isolate, 309 static inline bool EnsureInitializedForIsolate(i::Isolate* isolate,
315 const char* location) { 310 const char* location) {
316 if (IsDeadCheck(isolate, location)) return false; 311 if (IsDeadCheck(isolate, location)) return false;
317 if (isolate != NULL) { 312 if (isolate != NULL) {
318 if (isolate->IsInitialized()) return true; 313 if (isolate->IsInitialized()) return true;
319 } 314 }
320 ASSERT(isolate == i::Isolate::Current()); 315 ASSERT(isolate == i::Isolate::Current());
321 return ApiCheck(InitializeHelper(isolate), location, "Error initializing V8"); 316 return ApiCheck(InitializeHelper(), location, "Error initializing V8");
322 } 317 }
323 318
324 // Some initializing API functions are called early and may be 319 // Some initializing API functions are called early and may be
325 // called on a thread different from static initializer thread. 320 // called on a thread different from static initializer thread.
326 // If Isolate API is used, Isolate::Enter() will initialize TLS so 321 // If Isolate API is used, Isolate::Enter() will initialize TLS so
327 // Isolate::Current() works. If it's a legacy case, then the thread 322 // Isolate::Current() works. If it's a legacy case, then the thread
328 // may not have TLS initialized yet. However, in initializing APIs it 323 // may not have TLS initialized yet. However, in initializing APIs it
329 // may be too early to call EnsureInitialized() - some pre-init 324 // may be too early to call EnsureInitialized() - some pre-init
330 // parameters still have to be configured. 325 // parameters still have to be configured.
331 static inline i::Isolate* EnterIsolateIfNeeded() { 326 static inline i::Isolate* EnterIsolateIfNeeded() {
(...skipping 4877 matching lines...) Expand 10 before | Expand all | Expand 10 after
5209 5204
5210 5205
5211 // --- E n v i r o n m e n t --- 5206 // --- E n v i r o n m e n t ---
5212 5207
5213 5208
5214 bool v8::V8::Initialize() { 5209 bool v8::V8::Initialize() {
5215 i::Isolate* isolate = i::Isolate::UncheckedCurrent(); 5210 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
5216 if (isolate != NULL && isolate->IsInitialized()) { 5211 if (isolate != NULL && isolate->IsInitialized()) {
5217 return true; 5212 return true;
5218 } 5213 }
5219 return InitializeHelper(isolate); 5214 return InitializeHelper();
5220 } 5215 }
5221 5216
5222 5217
5223 void v8::V8::SetEntropySource(EntropySource source) { 5218 void v8::V8::SetEntropySource(EntropySource source) {
5224 i::V8::SetEntropySource(source); 5219 i::V8::SetEntropySource(source);
5225 } 5220 }
5226 5221
5227 5222
5228 void v8::V8::SetReturnAddressLocationResolver( 5223 void v8::V8::SetReturnAddressLocationResolver(
5229 ReturnAddressLocationResolver return_address_resolver) { 5224 ReturnAddressLocationResolver return_address_resolver) {
5230 i::V8::SetReturnAddressLocationResolver(return_address_resolver); 5225 i::V8::SetReturnAddressLocationResolver(return_address_resolver);
5231 } 5226 }
5232 5227
5233 5228
5234 bool v8::V8::SetFunctionEntryHook(FunctionEntryHook entry_hook) { 5229 bool v8::V8::SetFunctionEntryHook(FunctionEntryHook entry_hook) {
5235 return SetFunctionEntryHook(Isolate::GetCurrent(), entry_hook); 5230 return i::ProfileEntryHookStub::SetFunctionEntryHook(entry_hook);
5236 } 5231 }
5237 5232
5238 5233
5239 bool v8::V8::SetFunctionEntryHook(Isolate* ext_isolate,
5240 FunctionEntryHook entry_hook) {
5241 ASSERT(ext_isolate != NULL);
5242 ASSERT(entry_hook != NULL);
5243
5244 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(ext_isolate);
5245
5246 // The entry hook can only be set before the Isolate is initialized, as
5247 // otherwise the Isolate's code stubs generated at initialization won't
5248 // contain entry hooks.
5249 if (isolate->IsInitialized())
5250 return false;
5251
5252 // Setting an entry hook is a one-way operation, once set, it cannot be
5253 // changed or unset.
5254 if (isolate->function_entry_hook() != NULL)
5255 return false;
5256
5257 isolate->set_function_entry_hook(entry_hook);
5258 return true;
5259 }
5260
5261
5262 void v8::V8::SetJitCodeEventHandler( 5234 void v8::V8::SetJitCodeEventHandler(
5263 JitCodeEventOptions options, JitCodeEventHandler event_handler) { 5235 JitCodeEventOptions options, JitCodeEventHandler event_handler) {
5264 i::Isolate* isolate = i::Isolate::Current(); 5236 i::Isolate* isolate = i::Isolate::Current();
5265 // Ensure that logging is initialized for our isolate. 5237 // Ensure that logging is initialized for our isolate.
5266 isolate->InitializeLoggingAndCounters(); 5238 isolate->InitializeLoggingAndCounters();
5267 isolate->logger()->SetCodeEventHandler(options, event_handler); 5239 isolate->logger()->SetCodeEventHandler(options, event_handler);
5268 } 5240 }
5269 5241
5270 void v8::V8::SetArrayBufferAllocator( 5242 void v8::V8::SetArrayBufferAllocator(
5271 ArrayBuffer::Allocator* allocator) { 5243 ArrayBuffer::Allocator* allocator) {
(...skipping 2747 matching lines...) Expand 10 before | Expand all | Expand 10 after
8019 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7991 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8020 Address callback_address = 7992 Address callback_address =
8021 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7993 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8022 VMState<EXTERNAL> state(isolate); 7994 VMState<EXTERNAL> state(isolate);
8023 ExternalCallbackScope call_scope(isolate, callback_address); 7995 ExternalCallbackScope call_scope(isolate, callback_address);
8024 return callback(info); 7996 return callback(info);
8025 } 7997 }
8026 7998
8027 7999
8028 } } // namespace v8::internal 8000 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/arm/builtins-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698