| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 // External function | 451 // External function |
| 452 | 452 |
| 453 //---------------------------------------------------------------------------- | 453 //---------------------------------------------------------------------------- |
| 454 class IC_Utility; | 454 class IC_Utility; |
| 455 class SCTableReference; | 455 class SCTableReference; |
| 456 #ifdef ENABLE_DEBUGGER_SUPPORT | 456 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 457 class Debug_Address; | 457 class Debug_Address; |
| 458 #endif | 458 #endif |
| 459 | 459 |
| 460 | 460 |
| 461 typedef void* ExternalReferenceRedirector(void* original, bool fp_return); | |
| 462 | |
| 463 | |
| 464 // An ExternalReference represents a C++ address used in the generated | 461 // An ExternalReference represents a C++ address used in the generated |
| 465 // code. All references to C++ functions and variables must be encapsulated in | 462 // code. All references to C++ functions and variables must be encapsulated in |
| 466 // an ExternalReference instance. This is done in order to track the origin of | 463 // an ExternalReference instance. This is done in order to track the origin of |
| 467 // all external references in the code so that they can be bound to the correct | 464 // all external references in the code so that they can be bound to the correct |
| 468 // addresses when deserializing a heap. | 465 // addresses when deserializing a heap. |
| 469 class ExternalReference BASE_EMBEDDED { | 466 class ExternalReference BASE_EMBEDDED { |
| 470 public: | 467 public: |
| 468 // Used in the simulator to support different native api calls. |
| 469 // |
| 470 // BUILTIN_CALL - builtin/runtime call. |
| 471 // MaybeObject* f(v8::internal::Arguments). |
| 472 // |
| 473 // FP_CALL - builtin/runtime call that returns floating point. |
| 474 // double f(double, double). |
| 475 // |
| 476 // DIRECT_CALL - direct call to API function native callback |
| 477 // from generated code. |
| 478 // Handle<Value> f(v8::Arguments&) |
| 479 // |
| 480 enum Type { |
| 481 BUILTIN_CALL, // default |
| 482 FP_RETURN_CALL, |
| 483 DIRECT_CALL |
| 484 }; |
| 485 |
| 486 typedef void* ExternalReferenceRedirector(void* original, Type type); |
| 487 |
| 471 explicit ExternalReference(Builtins::CFunctionId id); | 488 explicit ExternalReference(Builtins::CFunctionId id); |
| 472 | 489 |
| 473 explicit ExternalReference(ApiFunction* ptr); | 490 explicit ExternalReference(ApiFunction* ptr, Type type); |
| 474 | 491 |
| 475 explicit ExternalReference(Builtins::Name name); | 492 explicit ExternalReference(Builtins::Name name); |
| 476 | 493 |
| 477 explicit ExternalReference(Runtime::FunctionId id); | 494 explicit ExternalReference(Runtime::FunctionId id); |
| 478 | 495 |
| 479 explicit ExternalReference(Runtime::Function* f); | 496 explicit ExternalReference(Runtime::Function* f); |
| 480 | 497 |
| 481 explicit ExternalReference(const IC_Utility& ic_utility); | 498 explicit ExternalReference(const IC_Utility& ic_utility); |
| 482 | 499 |
| 483 #ifdef ENABLE_DEBUGGER_SUPPORT | 500 #ifdef ENABLE_DEBUGGER_SUPPORT |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 ASSERT(redirector_ == NULL); // We can't stack them. | 607 ASSERT(redirector_ == NULL); // We can't stack them. |
| 591 redirector_ = redirector; | 608 redirector_ = redirector; |
| 592 } | 609 } |
| 593 | 610 |
| 594 private: | 611 private: |
| 595 explicit ExternalReference(void* address) | 612 explicit ExternalReference(void* address) |
| 596 : address_(address) {} | 613 : address_(address) {} |
| 597 | 614 |
| 598 static ExternalReferenceRedirector* redirector_; | 615 static ExternalReferenceRedirector* redirector_; |
| 599 | 616 |
| 600 static void* Redirect(void* address, bool fp_return = false) { | 617 static void* Redirect(void* address, |
| 618 Type type = ExternalReference::BUILTIN_CALL) { |
| 601 if (redirector_ == NULL) return address; | 619 if (redirector_ == NULL) return address; |
| 602 void* answer = (*redirector_)(address, fp_return); | 620 void* answer = (*redirector_)(address, type); |
| 603 return answer; | 621 return answer; |
| 604 } | 622 } |
| 605 | 623 |
| 606 static void* Redirect(Address address_arg, bool fp_return = false) { | 624 static void* Redirect(Address address_arg, |
| 625 Type type = ExternalReference::BUILTIN_CALL) { |
| 607 void* address = reinterpret_cast<void*>(address_arg); | 626 void* address = reinterpret_cast<void*>(address_arg); |
| 608 void* answer = (redirector_ == NULL) ? | 627 void* answer = (redirector_ == NULL) ? |
| 609 address : | 628 address : |
| 610 (*redirector_)(address, fp_return); | 629 (*redirector_)(address, type); |
| 611 return answer; | 630 return answer; |
| 612 } | 631 } |
| 613 | 632 |
| 614 void* address_; | 633 void* address_; |
| 615 }; | 634 }; |
| 616 | 635 |
| 617 | 636 |
| 618 // ----------------------------------------------------------------------------- | 637 // ----------------------------------------------------------------------------- |
| 619 // Position recording support | 638 // Position recording support |
| 620 | 639 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 return num_bits_set; | 736 return num_bits_set; |
| 718 } | 737 } |
| 719 | 738 |
| 720 // Computes pow(x, y) with the special cases in the spec for Math.pow. | 739 // Computes pow(x, y) with the special cases in the spec for Math.pow. |
| 721 double power_double_int(double x, int y); | 740 double power_double_int(double x, int y); |
| 722 double power_double_double(double x, double y); | 741 double power_double_double(double x, double y); |
| 723 | 742 |
| 724 } } // namespace v8::internal | 743 } } // namespace v8::internal |
| 725 | 744 |
| 726 #endif // V8_ASSEMBLER_H_ | 745 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |