| 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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // or | 302 // or |
| 303 // pc-jump (variable length): | 303 // pc-jump (variable length): |
| 304 // 01 1111 11, | 304 // 01 1111 11, |
| 305 // [7 bits data] 0 | 305 // [7 bits data] 0 |
| 306 // ... | 306 // ... |
| 307 // [7 bits data] 1 | 307 // [7 bits data] 1 |
| 308 // (Bits 6..31 of pc delta, with leading zeroes | 308 // (Bits 6..31 of pc delta, with leading zeroes |
| 309 // dropped, and last non-zero chunk tagged with 1.) | 309 // dropped, and last non-zero chunk tagged with 1.) |
| 310 | 310 |
| 311 | 311 |
| 312 #ifdef DEBUG |
| 312 const int kMaxStandardNonCompactModes = 14; | 313 const int kMaxStandardNonCompactModes = 14; |
| 314 #endif |
| 313 | 315 |
| 314 const int kTagBits = 2; | 316 const int kTagBits = 2; |
| 315 const int kTagMask = (1 << kTagBits) - 1; | 317 const int kTagMask = (1 << kTagBits) - 1; |
| 316 const int kExtraTagBits = 4; | 318 const int kExtraTagBits = 4; |
| 317 const int kLocatableTypeTagBits = 2; | 319 const int kLocatableTypeTagBits = 2; |
| 318 const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits; | 320 const int kSmallDataBits = kBitsPerByte - kLocatableTypeTagBits; |
| 319 | 321 |
| 320 const int kEmbeddedObjectTag = 0; | 322 const int kEmbeddedObjectTag = 0; |
| 321 const int kCodeTargetTag = 1; | 323 const int kCodeTargetTag = 1; |
| 322 const int kLocatableTag = 2; | 324 const int kLocatableTag = 2; |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) { | 1089 ExternalReference ExternalReference::date_cache_stamp(Isolate* isolate) { |
| 1088 return ExternalReference(isolate->date_cache()->stamp_address()); | 1090 return ExternalReference(isolate->date_cache()->stamp_address()); |
| 1089 } | 1091 } |
| 1090 | 1092 |
| 1091 | 1093 |
| 1092 ExternalReference ExternalReference::stress_deopt_count(Isolate* isolate) { | 1094 ExternalReference ExternalReference::stress_deopt_count(Isolate* isolate) { |
| 1093 return ExternalReference(isolate->stress_deopt_count_address()); | 1095 return ExternalReference(isolate->stress_deopt_count_address()); |
| 1094 } | 1096 } |
| 1095 | 1097 |
| 1096 | 1098 |
| 1097 ExternalReference ExternalReference::transcendental_cache_array_address( | |
| 1098 Isolate* isolate) { | |
| 1099 return ExternalReference( | |
| 1100 isolate->transcendental_cache()->cache_array_address()); | |
| 1101 } | |
| 1102 | |
| 1103 | |
| 1104 ExternalReference ExternalReference::new_deoptimizer_function( | 1099 ExternalReference ExternalReference::new_deoptimizer_function( |
| 1105 Isolate* isolate) { | 1100 Isolate* isolate) { |
| 1106 return ExternalReference( | 1101 return ExternalReference( |
| 1107 Redirect(isolate, FUNCTION_ADDR(Deoptimizer::New))); | 1102 Redirect(isolate, FUNCTION_ADDR(Deoptimizer::New))); |
| 1108 } | 1103 } |
| 1109 | 1104 |
| 1110 | 1105 |
| 1111 ExternalReference ExternalReference::compute_output_frames_function( | 1106 ExternalReference ExternalReference::compute_output_frames_function( |
| 1112 Isolate* isolate) { | 1107 Isolate* isolate) { |
| 1113 return ExternalReference( | 1108 return ExternalReference( |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 } | 1386 } |
| 1392 | 1387 |
| 1393 ExternalReference ExternalReference::address_of_regexp_stack_memory_size( | 1388 ExternalReference ExternalReference::address_of_regexp_stack_memory_size( |
| 1394 Isolate* isolate) { | 1389 Isolate* isolate) { |
| 1395 return ExternalReference(isolate->regexp_stack()->memory_size_address()); | 1390 return ExternalReference(isolate->regexp_stack()->memory_size_address()); |
| 1396 } | 1391 } |
| 1397 | 1392 |
| 1398 #endif // V8_INTERPRETED_REGEXP | 1393 #endif // V8_INTERPRETED_REGEXP |
| 1399 | 1394 |
| 1400 | 1395 |
| 1401 static double add_two_doubles(double x, double y) { | |
| 1402 return x + y; | |
| 1403 } | |
| 1404 | |
| 1405 | |
| 1406 static double sub_two_doubles(double x, double y) { | |
| 1407 return x - y; | |
| 1408 } | |
| 1409 | |
| 1410 | |
| 1411 static double mul_two_doubles(double x, double y) { | |
| 1412 return x * y; | |
| 1413 } | |
| 1414 | |
| 1415 | |
| 1416 static double div_two_doubles(double x, double y) { | |
| 1417 return x / y; | |
| 1418 } | |
| 1419 | |
| 1420 | |
| 1421 static double mod_two_doubles(double x, double y) { | |
| 1422 return modulo(x, y); | |
| 1423 } | |
| 1424 | |
| 1425 | |
| 1426 static double math_log_double(double x) { | |
| 1427 return log(x); | |
| 1428 } | |
| 1429 | |
| 1430 | |
| 1431 ExternalReference ExternalReference::math_log_double_function( | 1396 ExternalReference ExternalReference::math_log_double_function( |
| 1432 Isolate* isolate) { | 1397 Isolate* isolate) { |
| 1398 typedef double (*d2d)(double x); |
| 1433 return ExternalReference(Redirect(isolate, | 1399 return ExternalReference(Redirect(isolate, |
| 1434 FUNCTION_ADDR(math_log_double), | 1400 FUNCTION_ADDR(static_cast<d2d>(log)), |
| 1435 BUILTIN_FP_CALL)); | 1401 BUILTIN_FP_CALL)); |
| 1436 } | 1402 } |
| 1437 | 1403 |
| 1438 | 1404 |
| 1439 ExternalReference ExternalReference::math_exp_constants(int constant_index) { | 1405 ExternalReference ExternalReference::math_exp_constants(int constant_index) { |
| 1440 ASSERT(math_exp_data_initialized); | 1406 ASSERT(math_exp_data_initialized); |
| 1441 return ExternalReference( | 1407 return ExternalReference( |
| 1442 reinterpret_cast<void*>(math_exp_constants_array + constant_index)); | 1408 reinterpret_cast<void*>(math_exp_constants_array + constant_index)); |
| 1443 } | 1409 } |
| 1444 | 1410 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 | 1495 |
| 1530 | 1496 |
| 1531 ExternalReference ExternalReference::power_double_int_function( | 1497 ExternalReference ExternalReference::power_double_int_function( |
| 1532 Isolate* isolate) { | 1498 Isolate* isolate) { |
| 1533 return ExternalReference(Redirect(isolate, | 1499 return ExternalReference(Redirect(isolate, |
| 1534 FUNCTION_ADDR(power_double_int), | 1500 FUNCTION_ADDR(power_double_int), |
| 1535 BUILTIN_FP_INT_CALL)); | 1501 BUILTIN_FP_INT_CALL)); |
| 1536 } | 1502 } |
| 1537 | 1503 |
| 1538 | 1504 |
| 1539 static int native_compare_doubles(double y, double x) { | |
| 1540 if (x == y) return EQUAL; | |
| 1541 return x < y ? LESS : GREATER; | |
| 1542 } | |
| 1543 | |
| 1544 | |
| 1545 bool EvalComparison(Token::Value op, double op1, double op2) { | 1505 bool EvalComparison(Token::Value op, double op1, double op2) { |
| 1546 ASSERT(Token::IsCompareOp(op)); | 1506 ASSERT(Token::IsCompareOp(op)); |
| 1547 switch (op) { | 1507 switch (op) { |
| 1548 case Token::EQ: | 1508 case Token::EQ: |
| 1549 case Token::EQ_STRICT: return (op1 == op2); | 1509 case Token::EQ_STRICT: return (op1 == op2); |
| 1550 case Token::NE: return (op1 != op2); | 1510 case Token::NE: return (op1 != op2); |
| 1551 case Token::LT: return (op1 < op2); | 1511 case Token::LT: return (op1 < op2); |
| 1552 case Token::GT: return (op1 > op2); | 1512 case Token::GT: return (op1 > op2); |
| 1553 case Token::LTE: return (op1 <= op2); | 1513 case Token::LTE: return (op1 <= op2); |
| 1554 case Token::GTE: return (op1 >= op2); | 1514 case Token::GTE: return (op1 >= op2); |
| 1555 default: | 1515 default: |
| 1556 UNREACHABLE(); | 1516 UNREACHABLE(); |
| 1557 return false; | 1517 return false; |
| 1558 } | 1518 } |
| 1559 } | 1519 } |
| 1560 | 1520 |
| 1561 | 1521 |
| 1562 ExternalReference ExternalReference::double_fp_operation( | 1522 ExternalReference ExternalReference::mod_two_doubles_operation( |
| 1563 Token::Value operation, Isolate* isolate) { | 1523 Isolate* isolate) { |
| 1564 typedef double BinaryFPOperation(double x, double y); | |
| 1565 BinaryFPOperation* function = NULL; | |
| 1566 switch (operation) { | |
| 1567 case Token::ADD: | |
| 1568 function = &add_two_doubles; | |
| 1569 break; | |
| 1570 case Token::SUB: | |
| 1571 function = &sub_two_doubles; | |
| 1572 break; | |
| 1573 case Token::MUL: | |
| 1574 function = &mul_two_doubles; | |
| 1575 break; | |
| 1576 case Token::DIV: | |
| 1577 function = &div_two_doubles; | |
| 1578 break; | |
| 1579 case Token::MOD: | |
| 1580 function = &mod_two_doubles; | |
| 1581 break; | |
| 1582 default: | |
| 1583 UNREACHABLE(); | |
| 1584 } | |
| 1585 return ExternalReference(Redirect(isolate, | 1524 return ExternalReference(Redirect(isolate, |
| 1586 FUNCTION_ADDR(function), | 1525 FUNCTION_ADDR(modulo), |
| 1587 BUILTIN_FP_FP_CALL)); | 1526 BUILTIN_FP_FP_CALL)); |
| 1588 } | 1527 } |
| 1589 | 1528 |
| 1590 | 1529 |
| 1591 ExternalReference ExternalReference::compare_doubles(Isolate* isolate) { | |
| 1592 return ExternalReference(Redirect(isolate, | |
| 1593 FUNCTION_ADDR(native_compare_doubles), | |
| 1594 BUILTIN_COMPARE_CALL)); | |
| 1595 } | |
| 1596 | |
| 1597 | |
| 1598 #ifdef ENABLE_DEBUGGER_SUPPORT | 1530 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1599 ExternalReference ExternalReference::debug_break(Isolate* isolate) { | 1531 ExternalReference ExternalReference::debug_break(Isolate* isolate) { |
| 1600 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(Debug_Break))); | 1532 return ExternalReference(Redirect(isolate, FUNCTION_ADDR(Debug_Break))); |
| 1601 } | 1533 } |
| 1602 | 1534 |
| 1603 | 1535 |
| 1604 ExternalReference ExternalReference::debug_step_in_fp_address( | 1536 ExternalReference ExternalReference::debug_step_in_fp_address( |
| 1605 Isolate* isolate) { | 1537 Isolate* isolate) { |
| 1606 return ExternalReference(isolate->debug()->step_in_fp_addr()); | 1538 return ExternalReference(isolate->debug()->step_in_fp_addr()); |
| 1607 } | 1539 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); | 1594 assembler_->RecordRelocInfo(RelocInfo::POSITION, state_.current_position); |
| 1663 state_.written_position = state_.current_position; | 1595 state_.written_position = state_.current_position; |
| 1664 written = true; | 1596 written = true; |
| 1665 } | 1597 } |
| 1666 | 1598 |
| 1667 // Return whether something was written. | 1599 // Return whether something was written. |
| 1668 return written; | 1600 return written; |
| 1669 } | 1601 } |
| 1670 | 1602 |
| 1671 } } // namespace v8::internal | 1603 } } // namespace v8::internal |
| OLD | NEW |