Chromium Code Reviews| 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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 // External function | 452 // External function |
| 453 | 453 |
| 454 //---------------------------------------------------------------------------- | 454 //---------------------------------------------------------------------------- |
| 455 class IC_Utility; | 455 class IC_Utility; |
| 456 class SCTableReference; | 456 class SCTableReference; |
| 457 #ifdef ENABLE_DEBUGGER_SUPPORT | 457 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 458 class Debug_Address; | 458 class Debug_Address; |
| 459 #endif | 459 #endif |
| 460 | 460 |
| 461 | 461 |
| 462 typedef void* ExternalReferenceRedirector(void* original, bool fp_return); | |
| 463 | |
| 464 | |
| 465 // An ExternalReference represents a C++ address used in the generated | 462 // An ExternalReference represents a C++ address used in the generated |
| 466 // code. All references to C++ functions and variables must be encapsulated in | 463 // code. All references to C++ functions and variables must be encapsulated in |
| 467 // an ExternalReference instance. This is done in order to track the origin of | 464 // an ExternalReference instance. This is done in order to track the origin of |
| 468 // all external references in the code so that they can be bound to the correct | 465 // all external references in the code so that they can be bound to the correct |
| 469 // addresses when deserializing a heap. | 466 // addresses when deserializing a heap. |
| 470 class ExternalReference BASE_EMBEDDED { | 467 class ExternalReference BASE_EMBEDDED { |
| 471 public: | 468 public: |
| 469 // Used in the simulator to support different native api calls. | |
| 470 // | |
| 471 // BUILTIN_CALL - builtin/runtime call. | |
|
Søren Thygesen Gjesse
2011/02/02 13:24:38
builtin/runtime -> builtin
Zaheer
2011/02/03 07:27:31
Done.
| |
| 472 // MaybeObject* f(v8::internal::Arguments). | |
| 473 // | |
| 474 // FP_CALL - builtin/runtime call that returns floating point. | |
|
Søren Thygesen Gjesse
2011/02/02 13:24:38
Please change "builtin/runtime call that returns f
Zaheer
2011/02/03 07:27:31
if iam not mistaken, native_compare_doubles uses t
Søren Thygesen Gjesse
2011/02/03 08:31:14
You are right it does, and of cause returns an int
| |
| 475 // double f(double, double). | |
| 476 // | |
| 477 // DIRECT_CALL - direct call to API function native callback | |
| 478 // from generated code. | |
| 479 // Handle<Value> f(v8::Arguments&) | |
| 480 // | |
| 481 enum Type { | |
| 482 BUILTIN_CALL, // default | |
| 483 FP_RETURN_CALL, | |
|
Søren Thygesen Gjesse
2011/02/02 13:24:38
FP_RETURN_CALL -> FP_CALL as in comment.
Zaheer
2011/02/03 07:27:31
modified the comment to FP_RETURN_CALL to reflect
| |
| 484 DIRECT_CALL | |
| 485 }; | |
| 486 | |
| 487 typedef void* ExternalReferenceRedirector(void* original, Type type); | |
| 488 | |
| 472 explicit ExternalReference(Builtins::CFunctionId id); | 489 explicit ExternalReference(Builtins::CFunctionId id); |
| 473 | 490 |
| 474 explicit ExternalReference(ApiFunction* ptr); | 491 explicit ExternalReference(ApiFunction* ptr, Type type); |
| 475 | 492 |
| 476 explicit ExternalReference(Builtins::Name name); | 493 explicit ExternalReference(Builtins::Name name); |
| 477 | 494 |
| 478 explicit ExternalReference(Runtime::FunctionId id); | 495 explicit ExternalReference(Runtime::FunctionId id); |
| 479 | 496 |
| 480 explicit ExternalReference(Runtime::Function* f); | 497 explicit ExternalReference(Runtime::Function* f); |
| 481 | 498 |
| 482 explicit ExternalReference(const IC_Utility& ic_utility); | 499 explicit ExternalReference(const IC_Utility& ic_utility); |
| 483 | 500 |
| 484 #ifdef ENABLE_DEBUGGER_SUPPORT | 501 #ifdef ENABLE_DEBUGGER_SUPPORT |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 592 ASSERT(redirector_ == NULL); // We can't stack them. | 609 ASSERT(redirector_ == NULL); // We can't stack them. |
| 593 redirector_ = redirector; | 610 redirector_ = redirector; |
| 594 } | 611 } |
| 595 | 612 |
| 596 private: | 613 private: |
| 597 explicit ExternalReference(void* address) | 614 explicit ExternalReference(void* address) |
| 598 : address_(address) {} | 615 : address_(address) {} |
| 599 | 616 |
| 600 static ExternalReferenceRedirector* redirector_; | 617 static ExternalReferenceRedirector* redirector_; |
| 601 | 618 |
| 602 static void* Redirect(void* address, bool fp_return = false) { | 619 static void* Redirect(void* address, |
| 620 Type type = ExternalReference::BUILTIN_CALL) { | |
| 603 if (redirector_ == NULL) return address; | 621 if (redirector_ == NULL) return address; |
| 604 void* answer = (*redirector_)(address, fp_return); | 622 void* answer = (*redirector_)(address, type); |
| 605 return answer; | 623 return answer; |
| 606 } | 624 } |
| 607 | 625 |
| 608 static void* Redirect(Address address_arg, bool fp_return = false) { | 626 static void* Redirect(Address address_arg, |
| 627 Type type = ExternalReference::BUILTIN_CALL) { | |
| 609 void* address = reinterpret_cast<void*>(address_arg); | 628 void* address = reinterpret_cast<void*>(address_arg); |
| 610 void* answer = (redirector_ == NULL) ? | 629 void* answer = (redirector_ == NULL) ? |
| 611 address : | 630 address : |
| 612 (*redirector_)(address, fp_return); | 631 (*redirector_)(address, type); |
| 613 return answer; | 632 return answer; |
| 614 } | 633 } |
| 615 | 634 |
| 616 void* address_; | 635 void* address_; |
| 617 }; | 636 }; |
| 618 | 637 |
| 619 | 638 |
| 620 // ----------------------------------------------------------------------------- | 639 // ----------------------------------------------------------------------------- |
| 621 // Position recording support | 640 // Position recording support |
| 622 | 641 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 return num_bits_set; | 763 return num_bits_set; |
| 745 } | 764 } |
| 746 | 765 |
| 747 // Computes pow(x, y) with the special cases in the spec for Math.pow. | 766 // Computes pow(x, y) with the special cases in the spec for Math.pow. |
| 748 double power_double_int(double x, int y); | 767 double power_double_int(double x, int y); |
| 749 double power_double_double(double x, double y); | 768 double power_double_double(double x, double y); |
| 750 | 769 |
| 751 } } // namespace v8::internal | 770 } } // namespace v8::internal |
| 752 | 771 |
| 753 #endif // V8_ASSEMBLER_H_ | 772 #endif // V8_ASSEMBLER_H_ |
| OLD | NEW |