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

Side by Side Diff: src/assembler.cc

Issue 157543002: A64: Synchronize with r18581. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) { 762 const char* RelocInfo::RelocModeName(RelocInfo::Mode rmode) {
763 switch (rmode) { 763 switch (rmode) {
764 case RelocInfo::NONE32: 764 case RelocInfo::NONE32:
765 return "no reloc 32"; 765 return "no reloc 32";
766 case RelocInfo::NONE64: 766 case RelocInfo::NONE64:
767 return "no reloc 64"; 767 return "no reloc 64";
768 case RelocInfo::EMBEDDED_OBJECT: 768 case RelocInfo::EMBEDDED_OBJECT:
769 return "embedded object"; 769 return "embedded object";
770 case RelocInfo::CONSTRUCT_CALL: 770 case RelocInfo::CONSTRUCT_CALL:
771 return "code target (js construct call)"; 771 return "code target (js construct call)";
772 case RelocInfo::CODE_TARGET_CONTEXT:
773 return "code target (context)";
774 case RelocInfo::DEBUG_BREAK: 772 case RelocInfo::DEBUG_BREAK:
775 #ifndef ENABLE_DEBUGGER_SUPPORT 773 #ifndef ENABLE_DEBUGGER_SUPPORT
776 UNREACHABLE(); 774 UNREACHABLE();
777 #endif 775 #endif
778 return "debug break"; 776 return "debug break";
779 case RelocInfo::CODE_TARGET: 777 case RelocInfo::CODE_TARGET:
780 return "code target"; 778 return "code target";
781 case RelocInfo::CODE_TARGET_WITH_ID: 779 case RelocInfo::CODE_TARGET_WITH_ID:
782 return "code target with id"; 780 return "code target with id";
783 case RelocInfo::CELL: 781 case RelocInfo::CELL:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 break; 856 break;
859 case CELL: 857 case CELL:
860 Object::VerifyPointer(target_cell()); 858 Object::VerifyPointer(target_cell());
861 break; 859 break;
862 case DEBUG_BREAK: 860 case DEBUG_BREAK:
863 #ifndef ENABLE_DEBUGGER_SUPPORT 861 #ifndef ENABLE_DEBUGGER_SUPPORT
864 UNREACHABLE(); 862 UNREACHABLE();
865 break; 863 break;
866 #endif 864 #endif
867 case CONSTRUCT_CALL: 865 case CONSTRUCT_CALL:
868 case CODE_TARGET_CONTEXT:
869 case CODE_TARGET_WITH_ID: 866 case CODE_TARGET_WITH_ID:
870 case CODE_TARGET: { 867 case CODE_TARGET: {
871 // convert inline target address to code object 868 // convert inline target address to code object
872 Address addr = target_address(); 869 Address addr = target_address();
873 CHECK(addr != NULL); 870 CHECK(addr != NULL);
874 // Check that we can find the right code object. 871 // Check that we can find the right code object.
875 Code* code = Code::GetCodeFromTargetAddress(addr); 872 Code* code = Code::GetCodeFromTargetAddress(addr);
876 Object* found = code->GetIsolate()->FindCodeObject(addr); 873 Object* found = code->GetIsolate()->FindCodeObject(addr);
877 CHECK(found->IsCode()); 874 CHECK(found->IsCode());
878 CHECK(code->address() == HeapObject::cast(found)->address()); 875 CHECK(code->address() == HeapObject::cast(found)->address());
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 931
935 math_exp_constants_array = new double[9]; 932 math_exp_constants_array = new double[9];
936 // Input values smaller than this always return 0. 933 // Input values smaller than this always return 0.
937 math_exp_constants_array[0] = -708.39641853226408; 934 math_exp_constants_array[0] = -708.39641853226408;
938 // Input values larger than this always return +Infinity. 935 // Input values larger than this always return +Infinity.
939 math_exp_constants_array[1] = 709.78271289338397; 936 math_exp_constants_array[1] = 709.78271289338397;
940 math_exp_constants_array[2] = V8_INFINITY; 937 math_exp_constants_array[2] = V8_INFINITY;
941 // The rest is black magic. Do not attempt to understand it. It is 938 // The rest is black magic. Do not attempt to understand it. It is
942 // loosely based on the "expd" function published at: 939 // loosely based on the "expd" function published at:
943 // http://herumi.blogspot.com/2011/08/fast-double-precision-exponential.html 940 // http://herumi.blogspot.com/2011/08/fast-double-precision-exponential.html
944 const double constant3 = (1 << kTableSizeBits) / log(2.0); 941 const double constant3 = (1 << kTableSizeBits) / std::log(2.0);
945 math_exp_constants_array[3] = constant3; 942 math_exp_constants_array[3] = constant3;
946 math_exp_constants_array[4] = 943 math_exp_constants_array[4] =
947 static_cast<double>(static_cast<int64_t>(3) << 51); 944 static_cast<double>(static_cast<int64_t>(3) << 51);
948 math_exp_constants_array[5] = 1 / constant3; 945 math_exp_constants_array[5] = 1 / constant3;
949 math_exp_constants_array[6] = 3.0000000027955394; 946 math_exp_constants_array[6] = 3.0000000027955394;
950 math_exp_constants_array[7] = 0.16666666685227835; 947 math_exp_constants_array[7] = 0.16666666685227835;
951 math_exp_constants_array[8] = 1; 948 math_exp_constants_array[8] = 1;
952 949
953 math_exp_log_table_array = new double[kTableSize]; 950 math_exp_log_table_array = new double[kTableSize];
954 for (int i = 0; i < kTableSize; i++) { 951 for (int i = 0; i < kTableSize; i++) {
955 double value = pow(2, i / kTableSizeDouble); 952 double value = std::pow(2, i / kTableSizeDouble);
956 uint64_t bits = BitCast<uint64_t, double>(value); 953 uint64_t bits = BitCast<uint64_t, double>(value);
957 bits &= (static_cast<uint64_t>(1) << 52) - 1; 954 bits &= (static_cast<uint64_t>(1) << 52) - 1;
958 double mantissa = BitCast<double, uint64_t>(bits); 955 double mantissa = BitCast<double, uint64_t>(bits);
959 math_exp_log_table_array[i] = mantissa; 956 math_exp_log_table_array[i] = mantissa;
960 } 957 }
961 958
962 math_exp_data_initialized = true; 959 math_exp_data_initialized = true;
963 } 960 }
964 } 961 }
965 962
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 return ExternalReference(isolate->regexp_stack()->memory_size_address()); 1387 return ExternalReference(isolate->regexp_stack()->memory_size_address());
1391 } 1388 }
1392 1389
1393 #endif // V8_INTERPRETED_REGEXP 1390 #endif // V8_INTERPRETED_REGEXP
1394 1391
1395 1392
1396 ExternalReference ExternalReference::math_log_double_function( 1393 ExternalReference ExternalReference::math_log_double_function(
1397 Isolate* isolate) { 1394 Isolate* isolate) {
1398 typedef double (*d2d)(double x); 1395 typedef double (*d2d)(double x);
1399 return ExternalReference(Redirect(isolate, 1396 return ExternalReference(Redirect(isolate,
1400 FUNCTION_ADDR(static_cast<d2d>(log)), 1397 FUNCTION_ADDR(static_cast<d2d>(std::log)),
1401 BUILTIN_FP_CALL)); 1398 BUILTIN_FP_CALL));
1402 } 1399 }
1403 1400
1404 1401
1405 ExternalReference ExternalReference::math_exp_constants(int constant_index) { 1402 ExternalReference ExternalReference::math_exp_constants(int constant_index) {
1406 ASSERT(math_exp_data_initialized); 1403 ASSERT(math_exp_data_initialized);
1407 return ExternalReference( 1404 return ExternalReference(
1408 reinterpret_cast<void*>(math_exp_constants_array + constant_index)); 1405 reinterpret_cast<void*>(math_exp_constants_array + constant_index));
1409 } 1406 }
1410 1407
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 } 1458 }
1462 1459
1463 1460
1464 double power_double_double(double x, double y) { 1461 double power_double_double(double x, double y) {
1465 #if defined(__MINGW64_VERSION_MAJOR) && \ 1462 #if defined(__MINGW64_VERSION_MAJOR) && \
1466 (!defined(__MINGW64_VERSION_RC) || __MINGW64_VERSION_RC < 1) 1463 (!defined(__MINGW64_VERSION_RC) || __MINGW64_VERSION_RC < 1)
1467 // MinGW64 has a custom implementation for pow. This handles certain 1464 // MinGW64 has a custom implementation for pow. This handles certain
1468 // special cases that are different. 1465 // special cases that are different.
1469 if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) { 1466 if ((x == 0.0 || std::isinf(x)) && std::isfinite(y)) {
1470 double f; 1467 double f;
1471 if (modf(y, &f) != 0.0) return ((x == 0.0) ^ (y > 0)) ? V8_INFINITY : 0; 1468 if (std::modf(y, &f) != 0.0) {
1469 return ((x == 0.0) ^ (y > 0)) ? V8_INFINITY : 0;
1470 }
1472 } 1471 }
1473 1472
1474 if (x == 2.0) { 1473 if (x == 2.0) {
1475 int y_int = static_cast<int>(y); 1474 int y_int = static_cast<int>(y);
1476 if (y == y_int) return ldexp(1.0, y_int); 1475 if (y == y_int) {
1476 return std::ldexp(1.0, y_int);
1477 }
1477 } 1478 }
1478 #endif 1479 #endif
1479 1480
1480 // The checks for special cases can be dropped in ia32 because it has already 1481 // The checks for special cases can be dropped in ia32 because it has already
1481 // been done in generated code before bailing out here. 1482 // been done in generated code before bailing out here.
1482 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) { 1483 if (std::isnan(y) || ((x == 1 || x == -1) && std::isinf(y))) {
1483 return OS::nan_value(); 1484 return OS::nan_value();
1484 } 1485 }
1485 return pow(x, y); 1486 return std::pow(x, y);
1486 } 1487 }
1487 1488
1488 1489
1489 ExternalReference ExternalReference::power_double_double_function( 1490 ExternalReference ExternalReference::power_double_double_function(
1490 Isolate* isolate) { 1491 Isolate* isolate) {
1491 return ExternalReference(Redirect(isolate, 1492 return ExternalReference(Redirect(isolate,
1492 FUNCTION_ADDR(power_double_double), 1493 FUNCTION_ADDR(power_double_double),
1493 BUILTIN_FP_FP_CALL)); 1494 BUILTIN_FP_FP_CALL));
1494 } 1495 }
1495 1496
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1594 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); 1595 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position);
1595 state_.written_position = state_.current_position; 1596 state_.written_position = state_.current_position;
1596 written = true; 1597 written = true;
1597 } 1598 }
1598 1599
1599 // Return whether something was written. 1600 // Return whether something was written.
1600 return written; 1601 return written;
1601 } 1602 }
1602 1603
1603 } } // namespace v8::internal 1604 } } // 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