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

Side by Side Diff: src/assembler.h

Issue 435003: Patch for allowing several V8 instances in process:... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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/arm/stub-cache-arm.cc ('k') | src/assembler.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 (c) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 //---------------------------------------------------------------------------- 356 //----------------------------------------------------------------------------
357 class IC_Utility; 357 class IC_Utility;
358 class SCTableReference; 358 class SCTableReference;
359 #ifdef ENABLE_DEBUGGER_SUPPORT 359 #ifdef ENABLE_DEBUGGER_SUPPORT
360 class Debug_Address; 360 class Debug_Address;
361 #endif 361 #endif
362 362
363 363
364 typedef void* ExternalReferenceRedirector(void* original, bool fp_return); 364 typedef void* ExternalReferenceRedirector(void* original, bool fp_return);
365 365
366 class BasicAssemblerData {
367 public:
368 ExternalReferenceRedirector* redirector_;
369 protected:
370 BasicAssemblerData()
371 :redirector_(NULL) {}
372 };
366 373
367 // An ExternalReference represents a C++ address used in the generated 374 // An ExternalReference represents a C++ address used in the generated
368 // code. All references to C++ functions and variables must be encapsulated in 375 // code. All references to C++ functions and variables must be encapsulated in
369 // an ExternalReference instance. This is done in order to track the origin of 376 // an ExternalReference instance. This is done in order to track the origin of
370 // all external references in the code so that they can be bound to the correct 377 // all external references in the code so that they can be bound to the correct
371 // addresses when deserializing a heap. 378 // addresses when deserializing a heap.
372 class ExternalReference BASE_EMBEDDED { 379 class ExternalReference BASE_EMBEDDED {
373 public: 380 public:
374 explicit ExternalReference(Builtins::CFunctionId id); 381 explicit ExternalReference(Builtins::CFunctionId id);
375 382
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 // Function RegExpMacroAssembler*::CheckStackGuardState() 459 // Function RegExpMacroAssembler*::CheckStackGuardState()
453 static ExternalReference re_check_stack_guard_state(); 460 static ExternalReference re_check_stack_guard_state();
454 461
455 // Function NativeRegExpMacroAssembler::GrowStack() 462 // Function NativeRegExpMacroAssembler::GrowStack()
456 static ExternalReference re_grow_stack(); 463 static ExternalReference re_grow_stack();
457 #endif 464 #endif
458 465
459 // This lets you register a function that rewrites all external references. 466 // This lets you register a function that rewrites all external references.
460 // Used by the ARM simulator to catch calls to external references. 467 // Used by the ARM simulator to catch calls to external references.
461 static void set_redirector(ExternalReferenceRedirector* redirector) { 468 static void set_redirector(ExternalReferenceRedirector* redirector) {
462 ASSERT(redirector_ == NULL); // We can't stack them. 469 ExternalReferenceRedirector* & current_redirector =
463 redirector_ = redirector; 470 reinterpret_cast<BasicAssemblerData*>(v8_context()->assembler_data_)->
471 redirector_;
472 ASSERT(current_redirector == NULL); // We can't stack them.
473 current_redirector = redirector;
464 } 474 }
465 475
466 private: 476 private:
467 explicit ExternalReference(void* address) 477 explicit ExternalReference(void* address)
468 : address_(address) {} 478 : address_(address) {}
469 479
470 static ExternalReferenceRedirector* redirector_;
471 480
472 static void* Redirect(void* address, bool fp_return = false) { 481 static void* Redirect(void* address, bool fp_return = false) {
473 if (redirector_ == NULL) return address; 482 ExternalReferenceRedirector* redirector =
474 void* answer = (*redirector_)(address, fp_return); 483 reinterpret_cast<BasicAssemblerData*>(v8_context()->assembler_data_)->
475 return answer; 484 redirector_;
485 if (redirector == NULL) return address;
486 return (*redirector)(address, fp_return);
476 } 487 }
477 488
478 static void* Redirect(Address address_arg, bool fp_return = false) { 489 static void* Redirect(Address address_arg, bool fp_return = false) {
479 void* address = reinterpret_cast<void*>(address_arg); 490 void* address = reinterpret_cast<void*>(address_arg);
480 void* answer = (redirector_ == NULL) ? 491 ExternalReferenceRedirector* redirector =
481 address : 492 reinterpret_cast<BasicAssemblerData*>(v8_context()->assembler_data_)->
482 (*redirector_)(address, fp_return); 493 redirector_;
483 return answer; 494 return redirector == NULL ? address : (*redirector)(address, fp_return);
484 } 495 }
485 496
486 void* address_; 497 void* address_;
487 }; 498 };
488 499
489 500
490 // ----------------------------------------------------------------------------- 501 // -----------------------------------------------------------------------------
491 // Utility functions 502 // Utility functions
492 503
493 static inline bool is_intn(int x, int n) { 504 static inline bool is_intn(int x, int n) {
(...skipping 13 matching lines...) Expand all
507 static inline bool is_uint5(int x) { return is_uintn(x, 5); } 518 static inline bool is_uint5(int x) { return is_uintn(x, 5); }
508 static inline bool is_uint6(int x) { return is_uintn(x, 6); } 519 static inline bool is_uint6(int x) { return is_uintn(x, 6); }
509 static inline bool is_uint8(int x) { return is_uintn(x, 8); } 520 static inline bool is_uint8(int x) { return is_uintn(x, 8); }
510 static inline bool is_uint12(int x) { return is_uintn(x, 12); } 521 static inline bool is_uint12(int x) { return is_uintn(x, 12); }
511 static inline bool is_uint16(int x) { return is_uintn(x, 16); } 522 static inline bool is_uint16(int x) { return is_uintn(x, 16); }
512 static inline bool is_uint24(int x) { return is_uintn(x, 24); } 523 static inline bool is_uint24(int x) { return is_uintn(x, 24); }
513 524
514 } } // namespace v8::internal 525 } } // namespace v8::internal
515 526
516 #endif // V8_ASSEMBLER_H_ 527 #endif // V8_ASSEMBLER_H_
OLDNEW
« no previous file with comments | « src/arm/stub-cache-arm.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698