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

Side by Side Diff: src/assembler.cc

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 9 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes); 223 ASSERT(RelocInfo::NUMBER_OF_MODES <= kMaxRelocModes);
224 // Use unsigned delta-encoding for pc. 224 // Use unsigned delta-encoding for pc.
225 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_); 225 uint32_t pc_delta = static_cast<uint32_t>(rinfo->pc() - last_pc_);
226 RelocInfo::Mode rmode = rinfo->rmode(); 226 RelocInfo::Mode rmode = rinfo->rmode();
227 227
228 // The two most common modes are given small tags, and usually fit in a byte. 228 // The two most common modes are given small tags, and usually fit in a byte.
229 if (rmode == RelocInfo::EMBEDDED_OBJECT) { 229 if (rmode == RelocInfo::EMBEDDED_OBJECT) {
230 WriteTaggedPC(pc_delta, kEmbeddedObjectTag); 230 WriteTaggedPC(pc_delta, kEmbeddedObjectTag);
231 } else if (rmode == RelocInfo::CODE_TARGET) { 231 } else if (rmode == RelocInfo::CODE_TARGET) {
232 WriteTaggedPC(pc_delta, kCodeTargetTag); 232 WriteTaggedPC(pc_delta, kCodeTargetTag);
233 ASSERT(begin_pos - pos_ <= RelocInfo::kMaxCallSize);
233 } else if (RelocInfo::IsPosition(rmode)) { 234 } else if (RelocInfo::IsPosition(rmode)) {
234 // Use signed delta-encoding for data. 235 // Use signed delta-encoding for data.
235 intptr_t data_delta = rinfo->data() - last_data_; 236 intptr_t data_delta = rinfo->data() - last_data_;
236 int pos_type_tag = rmode == RelocInfo::POSITION ? kNonstatementPositionTag 237 int pos_type_tag = rmode == RelocInfo::POSITION ? kNonstatementPositionTag
237 : kStatementPositionTag; 238 : kStatementPositionTag;
238 // Check if data is small enough to fit in a tagged byte. 239 // Check if data is small enough to fit in a tagged byte.
239 // We cannot use is_intn because data_delta is not an int32_t. 240 // We cannot use is_intn because data_delta is not an int32_t.
240 if (data_delta >= -(1 << (kSmallDataBits-1)) && 241 if (data_delta >= -(1 << (kSmallDataBits-1)) &&
241 data_delta < 1 << (kSmallDataBits-1)) { 242 data_delta < 1 << (kSmallDataBits-1)) {
242 WriteTaggedPC(pc_delta, kPositionTag); 243 WriteTaggedPC(pc_delta, kPositionTag);
243 WriteTaggedData(data_delta, pos_type_tag); 244 WriteTaggedData(data_delta, pos_type_tag);
244 last_data_ = rinfo->data(); 245 last_data_ = rinfo->data();
245 } else { 246 } else {
246 // Otherwise, use costly encoding. 247 // Otherwise, use costly encoding.
247 WriteExtraTaggedPC(pc_delta, kPCJumpTag); 248 WriteExtraTaggedPC(pc_delta, kPCJumpTag);
248 WriteExtraTaggedData(data_delta, pos_type_tag); 249 WriteExtraTaggedData(data_delta, pos_type_tag);
249 last_data_ = rinfo->data(); 250 last_data_ = rinfo->data();
250 } 251 }
251 } else if (RelocInfo::IsComment(rmode)) { 252 } else if (RelocInfo::IsComment(rmode)) {
252 // Comments are normally not generated, so we use the costly encoding. 253 // Comments are normally not generated, so we use the costly encoding.
253 WriteExtraTaggedPC(pc_delta, kPCJumpTag); 254 WriteExtraTaggedPC(pc_delta, kPCJumpTag);
254 WriteExtraTaggedData(rinfo->data() - last_data_, kCommentTag); 255 WriteExtraTaggedData(rinfo->data() - last_data_, kCommentTag);
255 last_data_ = rinfo->data(); 256 last_data_ = rinfo->data();
257 ASSERT(begin_pos - pos_ >= RelocInfo::kMinRelocCommentSize);
256 } else { 258 } else {
257 // For all other modes we simply use the mode as the extra tag. 259 // For all other modes we simply use the mode as the extra tag.
258 // None of these modes need a data component. 260 // None of these modes need a data component.
259 ASSERT(rmode < kPCJumpTag && rmode < kDataJumpTag); 261 ASSERT(rmode < kPCJumpTag && rmode < kDataJumpTag);
260 WriteExtraTaggedPC(pc_delta, rmode); 262 WriteExtraTaggedPC(pc_delta, rmode);
261 } 263 }
262 last_pc_ = rinfo->pc(); 264 last_pc_ = rinfo->pc();
263 #ifdef DEBUG 265 #ifdef DEBUG
264 ASSERT(begin_pos - pos_ <= kMaxSize); 266 ASSERT(begin_pos - pos_ <= kMaxSize);
265 #endif 267 #endif
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 static double div_two_doubles(double x, double y) { 823 static double div_two_doubles(double x, double y) {
822 return x / y; 824 return x / y;
823 } 825 }
824 826
825 827
826 static double mod_two_doubles(double x, double y) { 828 static double mod_two_doubles(double x, double y) {
827 return modulo(x, y); 829 return modulo(x, y);
828 } 830 }
829 831
830 832
833 static double math_sin_double(double x) {
834 return sin(x);
835 }
836
837
838 static double math_cos_double(double x) {
839 return cos(x);
840 }
841
842
843 static double math_log_double(double x) {
844 return log(x);
845 }
846
847
848 ExternalReference ExternalReference::math_sin_double_function() {
849 return ExternalReference(Redirect(FUNCTION_ADDR(math_sin_double),
850 FP_RETURN_CALL));
851 }
852
853
854 ExternalReference ExternalReference::math_cos_double_function() {
855 return ExternalReference(Redirect(FUNCTION_ADDR(math_cos_double),
856 FP_RETURN_CALL));
857 }
858
859
860 ExternalReference ExternalReference::math_log_double_function() {
861 return ExternalReference(Redirect(FUNCTION_ADDR(math_log_double),
862 FP_RETURN_CALL));
863 }
864
865
831 // Helper function to compute x^y, where y is known to be an 866 // Helper function to compute x^y, where y is known to be an
832 // integer. Uses binary decomposition to limit the number of 867 // integer. Uses binary decomposition to limit the number of
833 // multiplications; see the discussion in "Hacker's Delight" by Henry 868 // multiplications; see the discussion in "Hacker's Delight" by Henry
834 // S. Warren, Jr., figure 11-6, page 213. 869 // S. Warren, Jr., figure 11-6, page 213.
835 double power_double_int(double x, int y) { 870 double power_double_int(double x, int y) {
836 double m = (y < 0) ? 1 / x : x; 871 double m = (y < 0) ? 1 / x : x;
837 unsigned n = (y < 0) ? -y : y; 872 unsigned n = (y < 0) ? -y : y;
838 double p = 1; 873 double p = 1;
839 while (n != 0) { 874 while (n != 0) {
840 if ((n & 1) != 0) p *= m; 875 if ((n & 1) != 0) p *= m;
(...skipping 16 matching lines...) Expand all
857 if (y == -0.5) return 1.0 / sqrt(x + 0.0); 892 if (y == -0.5) return 1.0 / sqrt(x + 0.0);
858 } 893 }
859 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) { 894 if (isnan(y) || ((x == 1 || x == -1) && isinf(y))) {
860 return OS::nan_value(); 895 return OS::nan_value();
861 } 896 }
862 return pow(x, y); 897 return pow(x, y);
863 } 898 }
864 899
865 900
866 ExternalReference ExternalReference::power_double_double_function() { 901 ExternalReference ExternalReference::power_double_double_function() {
867 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_double))); 902 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_double),
903 FP_RETURN_CALL));
868 } 904 }
869 905
870 906
871 ExternalReference ExternalReference::power_double_int_function() { 907 ExternalReference ExternalReference::power_double_int_function() {
872 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_int))); 908 return ExternalReference(Redirect(FUNCTION_ADDR(power_double_int),
909 FP_RETURN_CALL));
873 } 910 }
874 911
875 912
876 static int native_compare_doubles(double y, double x) { 913 static int native_compare_doubles(double y, double x) {
877 if (x == y) return EQUAL; 914 if (x == y) return EQUAL;
878 return x < y ? LESS : GREATER; 915 return x < y ? LESS : GREATER;
879 } 916 }
880 917
881 918
882 ExternalReference ExternalReference::double_fp_operation( 919 ExternalReference ExternalReference::double_fp_operation(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1011 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
975 state_.written_position = state_.current_position; 1012 state_.written_position = state_.current_position;
976 written = true; 1013 written = true;
977 } 1014 }
978 1015
979 // Return whether something was written. 1016 // Return whether something was written.
980 return written; 1017 return written;
981 } 1018 }
982 1019
983 } } // namespace v8::internal 1020 } } // 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