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

Side by Side Diff: src/assembler.cc

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 months 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/assembler.h ('k') | src/ast.h » ('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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #error "Unknown architecture." 59 #error "Unknown architecture."
60 #endif // Target architecture. 60 #endif // Target architecture.
61 #endif // V8_INTERPRETED_REGEXP 61 #endif // V8_INTERPRETED_REGEXP
62 62
63 namespace v8 { 63 namespace v8 {
64 namespace internal { 64 namespace internal {
65 65
66 66
67 const double DoubleConstant::min_int = kMinInt; 67 const double DoubleConstant::min_int = kMinInt;
68 const double DoubleConstant::one_half = 0.5; 68 const double DoubleConstant::one_half = 0.5;
69 const double DoubleConstant::negative_infinity = -V8_INFINITY;
69 70
70 71
71 // ----------------------------------------------------------------------------- 72 // -----------------------------------------------------------------------------
72 // Implementation of Label 73 // Implementation of Label
73 74
74 int Label::pos() const { 75 int Label::pos() const {
75 if (pos_ < 0) return -pos_ - 1; 76 if (pos_ < 0) return -pos_ - 1;
76 if (pos_ > 0) return pos_ - 1; 77 if (pos_ > 0) return pos_ - 1;
77 UNREACHABLE(); 78 UNREACHABLE();
78 return 0; 79 return 0;
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 #endif 460 #endif
460 return "debug break slot"; 461 return "debug break slot";
461 case RelocInfo::NUMBER_OF_MODES: 462 case RelocInfo::NUMBER_OF_MODES:
462 UNREACHABLE(); 463 UNREACHABLE();
463 return "number_of_modes"; 464 return "number_of_modes";
464 } 465 }
465 return "unknown relocation type"; 466 return "unknown relocation type";
466 } 467 }
467 468
468 469
469 void RelocInfo::Print() { 470 void RelocInfo::Print(FILE* out) {
470 PrintF("%p %s", pc_, RelocModeName(rmode_)); 471 PrintF(out, "%p %s", pc_, RelocModeName(rmode_));
471 if (IsComment(rmode_)) { 472 if (IsComment(rmode_)) {
472 PrintF(" (%s)", reinterpret_cast<char*>(data_)); 473 PrintF(out, " (%s)", reinterpret_cast<char*>(data_));
473 } else if (rmode_ == EMBEDDED_OBJECT) { 474 } else if (rmode_ == EMBEDDED_OBJECT) {
474 PrintF(" ("); 475 PrintF(out, " (");
475 target_object()->ShortPrint(); 476 target_object()->ShortPrint(out);
476 PrintF(")"); 477 PrintF(out, ")");
477 } else if (rmode_ == EXTERNAL_REFERENCE) { 478 } else if (rmode_ == EXTERNAL_REFERENCE) {
478 ExternalReferenceEncoder ref_encoder; 479 ExternalReferenceEncoder ref_encoder;
479 PrintF(" (%s) (%p)", 480 PrintF(out, " (%s) (%p)",
480 ref_encoder.NameOfAddress(*target_reference_address()), 481 ref_encoder.NameOfAddress(*target_reference_address()),
481 *target_reference_address()); 482 *target_reference_address());
482 } else if (IsCodeTarget(rmode_)) { 483 } else if (IsCodeTarget(rmode_)) {
483 Code* code = Code::GetCodeFromTargetAddress(target_address()); 484 Code* code = Code::GetCodeFromTargetAddress(target_address());
484 PrintF(" (%s) (%p)", Code::Kind2String(code->kind()), target_address()); 485 PrintF(out, " (%s) (%p)", Code::Kind2String(code->kind()),
486 target_address());
485 } else if (IsPosition(rmode_)) { 487 } else if (IsPosition(rmode_)) {
486 PrintF(" (%" V8_PTR_PREFIX "d)", data()); 488 PrintF(out, " (%" V8_PTR_PREFIX "d)", data());
487 } else if (rmode_ == RelocInfo::RUNTIME_ENTRY) { 489 } else if (rmode_ == RelocInfo::RUNTIME_ENTRY) {
488 // Depotimization bailouts are stored as runtime entries. 490 // Depotimization bailouts are stored as runtime entries.
489 int id = Deoptimizer::GetDeoptimizationId( 491 int id = Deoptimizer::GetDeoptimizationId(
490 target_address(), Deoptimizer::EAGER); 492 target_address(), Deoptimizer::EAGER);
491 if (id != Deoptimizer::kNotDeoptimizationEntry) { 493 if (id != Deoptimizer::kNotDeoptimizationEntry) {
492 PrintF(" (deoptimization bailout %d)", id); 494 PrintF(out, " (deoptimization bailout %d)", id);
493 } 495 }
494 } 496 }
495 497
496 PrintF("\n"); 498 PrintF(out, "\n");
497 } 499 }
498 #endif // ENABLE_DISASSEMBLER 500 #endif // ENABLE_DISASSEMBLER
499 501
500 502
501 #ifdef DEBUG 503 #ifdef DEBUG
502 void RelocInfo::Verify() { 504 void RelocInfo::Verify() {
503 switch (rmode_) { 505 switch (rmode_) {
504 case EMBEDDED_OBJECT: 506 case EMBEDDED_OBJECT:
505 Object::VerifyPointer(target_object()); 507 Object::VerifyPointer(target_object());
506 break; 508 break;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 const_cast<double*>(&DoubleConstant::min_int))); 729 const_cast<double*>(&DoubleConstant::min_int)));
728 } 730 }
729 731
730 732
731 ExternalReference ExternalReference::address_of_one_half() { 733 ExternalReference ExternalReference::address_of_one_half() {
732 return ExternalReference(reinterpret_cast<void*>( 734 return ExternalReference(reinterpret_cast<void*>(
733 const_cast<double*>(&DoubleConstant::one_half))); 735 const_cast<double*>(&DoubleConstant::one_half)));
734 } 736 }
735 737
736 738
739 ExternalReference ExternalReference::address_of_negative_infinity() {
740 return ExternalReference(reinterpret_cast<void*>(
741 const_cast<double*>(&DoubleConstant::negative_infinity)));
742 }
743
744
737 #ifndef V8_INTERPRETED_REGEXP 745 #ifndef V8_INTERPRETED_REGEXP
738 746
739 ExternalReference ExternalReference::re_check_stack_guard_state() { 747 ExternalReference ExternalReference::re_check_stack_guard_state() {
740 Address function; 748 Address function;
741 #ifdef V8_TARGET_ARCH_X64 749 #ifdef V8_TARGET_ARCH_X64
742 function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState); 750 function = FUNCTION_ADDR(RegExpMacroAssemblerX64::CheckStackGuardState);
743 #elif V8_TARGET_ARCH_IA32 751 #elif V8_TARGET_ARCH_IA32
744 function = FUNCTION_ADDR(RegExpMacroAssemblerIA32::CheckStackGuardState); 752 function = FUNCTION_ADDR(RegExpMacroAssemblerIA32::CheckStackGuardState);
745 #elif V8_TARGET_ARCH_ARM 753 #elif V8_TARGET_ARCH_ARM
746 function = FUNCTION_ADDR(RegExpMacroAssemblerARM::CheckStackGuardState); 754 function = FUNCTION_ADDR(RegExpMacroAssemblerARM::CheckStackGuardState);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 static double div_two_doubles(double x, double y) { 809 static double div_two_doubles(double x, double y) {
802 return x / y; 810 return x / y;
803 } 811 }
804 812
805 813
806 static double mod_two_doubles(double x, double y) { 814 static double mod_two_doubles(double x, double y) {
807 return modulo(x, y); 815 return modulo(x, y);
808 } 816 }
809 817
810 818
819 // Helper function to compute x^y, where y is known to be an
820 // integer. Uses binary decomposition to limit the number of
821 // multiplications; see the discussion in "Hacker's Delight" by Henry
822 // S. Warren, Jr., figure 11-6, page 213.
823 double power_double_int(double x, int y) {
824 double m = (y < 0) ? 1 / x : x;
825 unsigned n = (y < 0) ? -y : y;
826 double p = 1;
827 while (n != 0) {
828 if ((n & 1) != 0) p *= m;
829 m *= m;
830 if ((n & 2) != 0) p *= m;
831 m *= m;
832 n >>= 2;
833 }
834 return p;
835 }
836
837
838 double power_double_double(double x, double y) {
839 int y_int = static_cast<int>(y);
840 if (y == y_int) {
841 return power_double_int(x, y_int); // Returns 1.0 for exponent 0.
842 }
843 if (!isinf(x)) {
844 if (y == 0.5) return sqrt(x);
845 if (y == -0.5) return 1.0 / sqrt(x);
846 }
847 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) {
848 return OS::nan_value();
849 }
850 return pow(x, y);
851 }
852
853
854 ExternalReference ExternalReference::power_double_double_function() {
855 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_double)));
856 }
857
858
859 ExternalReference ExternalReference::power_double_int_function() {
860 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_int)));
861 }
862
863
811 static int native_compare_doubles(double y, double x) { 864 static int native_compare_doubles(double y, double x) {
812 if (x == y) return EQUAL; 865 if (x == y) return EQUAL;
813 return x < y ? LESS : GREATER; 866 return x < y ? LESS : GREATER;
814 } 867 }
815 868
816 869
817 ExternalReference ExternalReference::double_fp_operation( 870 ExternalReference ExternalReference::double_fp_operation(
818 Token::Value operation) { 871 Token::Value operation) {
819 typedef double BinaryFPOperation(double x, double y); 872 typedef double BinaryFPOperation(double x, double y);
820 BinaryFPOperation* function = NULL; 873 BinaryFPOperation* function = NULL;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 948 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
896 state_.written_position = state_.current_position; 949 state_.written_position = state_.current_position;
897 written = true; 950 written = true;
898 } 951 }
899 952
900 // Return whether something was written. 953 // Return whether something was written.
901 return written; 954 return written;
902 } 955 }
903 956
904 } } // namespace v8::internal 957 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/assembler.h ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698