| OLD | NEW |
| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // External function | 458 // External function |
| 459 | 459 |
| 460 //---------------------------------------------------------------------------- | 460 //---------------------------------------------------------------------------- |
| 461 class IC_Utility; | 461 class IC_Utility; |
| 462 class SCTableReference; | 462 class SCTableReference; |
| 463 #ifdef ENABLE_DEBUGGER_SUPPORT | 463 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 464 class Debug_Address; | 464 class Debug_Address; |
| 465 #endif | 465 #endif |
| 466 | 466 |
| 467 | 467 |
| 468 typedef void* ExternalReferenceRedirector(void* original, bool fp_return); | |
| 469 | |
| 470 | |
| 471 // An ExternalReference represents a C++ address used in the generated | 468 // An ExternalReference represents a C++ address used in the generated |
| 472 // code. All references to C++ functions and variables must be encapsulated in | 469 // code. All references to C++ functions and variables must be encapsulated in |
| 473 // an ExternalReference instance. This is done in order to track the origin of | 470 // an ExternalReference instance. This is done in order to track the origin of |
| 474 // all external references in the code so that they can be bound to the correct | 471 // all external references in the code so that they can be bound to the correct |
| 475 // addresses when deserializing a heap. | 472 // addresses when deserializing a heap. |
| 476 class ExternalReference BASE_EMBEDDED { | 473 class ExternalReference BASE_EMBEDDED { |
| 477 public: | 474 public: |
| 475 // Used in the simulator to support different native api calls. |
| 476 // |
| 477 // BUILTIN_CALL - builtin call. |
| 478 // MaybeObject* f(v8::internal::Arguments). |
| 479 // |
| 480 // FP_RETURN_CALL - builtin call that returns floating point. |
| 481 // double f(double, double). |
| 482 // |
| 483 // DIRECT_CALL - direct call to API function native callback |
| 484 // from generated code. |
| 485 // Handle<Value> f(v8::Arguments&) |
| 486 // |
| 487 enum Type { |
| 488 BUILTIN_CALL, // default |
| 489 FP_RETURN_CALL, |
| 490 DIRECT_CALL |
| 491 }; |
| 492 |
| 493 typedef void* ExternalReferenceRedirector(void* original, Type type); |
| 494 |
| 478 explicit ExternalReference(Builtins::CFunctionId id); | 495 explicit ExternalReference(Builtins::CFunctionId id); |
| 479 | 496 |
| 480 explicit ExternalReference(ApiFunction* ptr); | 497 explicit ExternalReference(ApiFunction* ptr, Type type); |
| 481 | 498 |
| 482 explicit ExternalReference(Builtins::Name name); | 499 explicit ExternalReference(Builtins::Name name); |
| 483 | 500 |
| 484 explicit ExternalReference(Runtime::FunctionId id); | 501 explicit ExternalReference(Runtime::FunctionId id); |
| 485 | 502 |
| 486 explicit ExternalReference(Runtime::Function* f); | 503 explicit ExternalReference(Runtime::Function* f); |
| 487 | 504 |
| 488 explicit ExternalReference(const IC_Utility& ic_utility); | 505 explicit ExternalReference(const IC_Utility& ic_utility); |
| 489 | 506 |
| 490 #ifdef ENABLE_DEBUGGER_SUPPORT | 507 #ifdef ENABLE_DEBUGGER_SUPPORT |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 ASSERT(redirector_ == NULL); // We can't stack them. | 615 ASSERT(redirector_ == NULL); // We can't stack them. |
| 599 redirector_ = redirector; | 616 redirector_ = redirector; |
| 600 } | 617 } |
| 601 | 618 |
| 602 private: | 619 private: |
| 603 explicit ExternalReference(void* address) | 620 explicit ExternalReference(void* address) |
| 604 : address_(address) {} | 621 : address_(address) {} |
| 605 | 622 |
| 606 static ExternalReferenceRedirector* redirector_; | 623 static ExternalReferenceRedirector* redirector_; |
| 607 | 624 |
| 608 static void* Redirect(void* address, bool fp_return = false) { | 625 static void* Redirect(void* address, |
| 626 Type type = ExternalReference::BUILTIN_CALL) { |
| 609 if (redirector_ == NULL) return address; | 627 if (redirector_ == NULL) return address; |
| 610 void* answer = (*redirector_)(address, fp_return); | 628 void* answer = (*redirector_)(address, type); |
| 611 return answer; | 629 return answer; |
| 612 } | 630 } |
| 613 | 631 |
| 614 static void* Redirect(Address address_arg, bool fp_return = false) { | 632 static void* Redirect(Address address_arg, |
| 633 Type type = ExternalReference::BUILTIN_CALL) { |
| 615 void* address = reinterpret_cast<void*>(address_arg); | 634 void* address = reinterpret_cast<void*>(address_arg); |
| 616 void* answer = (redirector_ == NULL) ? | 635 void* answer = (redirector_ == NULL) ? |
| 617 address : | 636 address : |
| 618 (*redirector_)(address, fp_return); | 637 (*redirector_)(address, type); |
| 619 return answer; | 638 return answer; |
| 620 } | 639 } |
| 621 | 640 |
| 622 void* address_; | 641 void* address_; |
| 623 }; | 642 }; |
| 624 | 643 |
| 625 | 644 |
| 626 // ----------------------------------------------------------------------------- | 645 // ----------------------------------------------------------------------------- |
| 627 // Position recording support | 646 // Position recording support |
| 628 | 647 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 return num_bits_set; | 769 return num_bits_set; |
| 751 } | 770 } |
| 752 | 771 |
| 753 // Computes pow(x, y) with the special cases in the spec for Math.pow. | 772 // Computes pow(x, y) with the special cases in the spec for Math.pow. |
| 754 double power_double_int(double x, int y); | 773 double power_double_int(double x, int y); |
| 755 double power_double_double(double x, double y); | 774 double power_double_double(double x, double y); |
| 756 | 775 |
| 757 } } // namespace v8::internal | 776 } } // namespace v8::internal |
| 758 | 777 |
| 759 #endif // V8_ASSEMBLER_H_ | 778 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |