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 interfaces. |
| 469 // |BUILTIN_CALL| - MaybeObject* f(v8::internal::Arguments) |
| 470 // |DIRECT_CALL| - Handle<Value> f(v8::Arguments&) |
| 471 enum Type { |
| 472 BUILTIN_CALL, // default |
| 473 DIRECT_CALL |
| 474 }; |
| 475 |
| 476 typedef void* ExternalReferenceRedirector( |
| 477 void* original, bool fp_return, Type type); |
| 478 |
471 explicit ExternalReference(Builtins::CFunctionId id); | 479 explicit ExternalReference(Builtins::CFunctionId id); |
472 | 480 |
473 explicit ExternalReference(ApiFunction* ptr); | 481 explicit ExternalReference(ApiFunction* ptr, bool fp_return, Type type); |
474 | 482 |
475 explicit ExternalReference(Builtins::Name name); | 483 explicit ExternalReference(Builtins::Name name); |
476 | 484 |
477 explicit ExternalReference(Runtime::FunctionId id); | 485 explicit ExternalReference(Runtime::FunctionId id); |
478 | 486 |
479 explicit ExternalReference(Runtime::Function* f); | 487 explicit ExternalReference(Runtime::Function* f); |
480 | 488 |
481 explicit ExternalReference(const IC_Utility& ic_utility); | 489 explicit ExternalReference(const IC_Utility& ic_utility); |
482 | 490 |
483 #ifdef ENABLE_DEBUGGER_SUPPORT | 491 #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. | 598 ASSERT(redirector_ == NULL); // We can't stack them. |
591 redirector_ = redirector; | 599 redirector_ = redirector; |
592 } | 600 } |
593 | 601 |
594 private: | 602 private: |
595 explicit ExternalReference(void* address) | 603 explicit ExternalReference(void* address) |
596 : address_(address) {} | 604 : address_(address) {} |
597 | 605 |
598 static ExternalReferenceRedirector* redirector_; | 606 static ExternalReferenceRedirector* redirector_; |
599 | 607 |
600 static void* Redirect(void* address, bool fp_return = false) { | 608 static void* Redirect(void* address, bool fp_return = false, |
| 609 Type type = ExternalReference::BUILTIN_CALL) { |
601 if (redirector_ == NULL) return address; | 610 if (redirector_ == NULL) return address; |
602 void* answer = (*redirector_)(address, fp_return); | 611 void* answer = (*redirector_)(address, fp_return, type); |
603 return answer; | 612 return answer; |
604 } | 613 } |
605 | 614 |
606 static void* Redirect(Address address_arg, bool fp_return = false) { | 615 static void* Redirect(Address address_arg, bool fp_return = false, |
| 616 Type type = ExternalReference::BUILTIN_CALL) { |
607 void* address = reinterpret_cast<void*>(address_arg); | 617 void* address = reinterpret_cast<void*>(address_arg); |
608 void* answer = (redirector_ == NULL) ? | 618 void* answer = (redirector_ == NULL) ? |
609 address : | 619 address : |
610 (*redirector_)(address, fp_return); | 620 (*redirector_)(address, fp_return, type); |
611 return answer; | 621 return answer; |
612 } | 622 } |
613 | 623 |
614 void* address_; | 624 void* address_; |
615 }; | 625 }; |
616 | 626 |
617 | 627 |
618 // ----------------------------------------------------------------------------- | 628 // ----------------------------------------------------------------------------- |
619 // Position recording support | 629 // Position recording support |
620 | 630 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 return num_bits_set; | 727 return num_bits_set; |
718 } | 728 } |
719 | 729 |
720 // Computes pow(x, y) with the special cases in the spec for Math.pow. | 730 // Computes pow(x, y) with the special cases in the spec for Math.pow. |
721 double power_double_int(double x, int y); | 731 double power_double_int(double x, int y); |
722 double power_double_double(double x, double y); | 732 double power_double_double(double x, double y); |
723 | 733 |
724 } } // namespace v8::internal | 734 } } // namespace v8::internal |
725 | 735 |
726 #endif // V8_ASSEMBLER_H_ | 736 #endif // V8_ASSEMBLER_H_ |
OLD | NEW |