OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/builtins.h" | 5 #include "src/builtins.h" |
6 | 6 |
7 #include "src/api-arguments.h" | 7 #include "src/api-arguments.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/base/ieee754.h" | 10 #include "src/base/ieee754.h" |
(...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 | 2414 |
2415 assembler->Bind(&do_clz32); | 2415 assembler->Bind(&do_clz32); |
2416 { | 2416 { |
2417 Node* x_value = var_clz32_x.value(); | 2417 Node* x_value = var_clz32_x.value(); |
2418 Node* value = assembler->Word32Clz(x_value); | 2418 Node* value = assembler->Word32Clz(x_value); |
2419 Node* result = assembler->ChangeInt32ToTagged(value); | 2419 Node* result = assembler->ChangeInt32ToTagged(value); |
2420 assembler->Return(result); | 2420 assembler->Return(result); |
2421 } | 2421 } |
2422 } | 2422 } |
2423 | 2423 |
| 2424 // ES6 section 20.2.2.12 Math.cos ( x ) |
| 2425 void Builtins::Generate_MathCos(CodeStubAssembler* assembler) { |
| 2426 using compiler::Node; |
| 2427 |
| 2428 Node* x = assembler->Parameter(1); |
| 2429 Node* context = assembler->Parameter(4); |
| 2430 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
| 2431 Node* value = assembler->Float64Cos(x_value); |
| 2432 Node* result = assembler->ChangeFloat64ToTagged(value); |
| 2433 assembler->Return(result); |
| 2434 } |
| 2435 |
2424 // ES6 section 20.2.2.14 Math.exp ( x ) | 2436 // ES6 section 20.2.2.14 Math.exp ( x ) |
2425 void Builtins::Generate_MathExp(CodeStubAssembler* assembler) { | 2437 void Builtins::Generate_MathExp(CodeStubAssembler* assembler) { |
2426 using compiler::Node; | 2438 using compiler::Node; |
2427 | 2439 |
2428 Node* x = assembler->Parameter(1); | 2440 Node* x = assembler->Parameter(1); |
2429 Node* context = assembler->Parameter(4); | 2441 Node* context = assembler->Parameter(4); |
2430 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); | 2442 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
2431 Node* value = assembler->Float64Exp(x_value); | 2443 Node* value = assembler->Float64Exp(x_value); |
2432 Node* result = assembler->ChangeFloat64ToTagged(value); | 2444 Node* result = assembler->ChangeFloat64ToTagged(value); |
2433 assembler->Return(result); | 2445 assembler->Return(result); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 Node* value = assembler->Float64Expm1(x_value); | 2530 Node* value = assembler->Float64Expm1(x_value); |
2519 Node* result = assembler->ChangeFloat64ToTagged(value); | 2531 Node* result = assembler->ChangeFloat64ToTagged(value); |
2520 assembler->Return(result); | 2532 assembler->Return(result); |
2521 } | 2533 } |
2522 | 2534 |
2523 // ES6 section 20.2.2.28 Math.round ( x ) | 2535 // ES6 section 20.2.2.28 Math.round ( x ) |
2524 void Builtins::Generate_MathRound(CodeStubAssembler* assembler) { | 2536 void Builtins::Generate_MathRound(CodeStubAssembler* assembler) { |
2525 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Round); | 2537 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Round); |
2526 } | 2538 } |
2527 | 2539 |
| 2540 // ES6 section 20.2.2.30 Math.sin ( x ) |
| 2541 void Builtins::Generate_MathSin(CodeStubAssembler* assembler) { |
| 2542 using compiler::Node; |
| 2543 |
| 2544 Node* x = assembler->Parameter(1); |
| 2545 Node* context = assembler->Parameter(4); |
| 2546 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
| 2547 Node* value = assembler->Float64Sin(x_value); |
| 2548 Node* result = assembler->ChangeFloat64ToTagged(value); |
| 2549 assembler->Return(result); |
| 2550 } |
| 2551 |
2528 // ES6 section 20.2.2.32 Math.sqrt ( x ) | 2552 // ES6 section 20.2.2.32 Math.sqrt ( x ) |
2529 void Builtins::Generate_MathSqrt(CodeStubAssembler* assembler) { | 2553 void Builtins::Generate_MathSqrt(CodeStubAssembler* assembler) { |
2530 using compiler::Node; | 2554 using compiler::Node; |
2531 | 2555 |
2532 Node* x = assembler->Parameter(1); | 2556 Node* x = assembler->Parameter(1); |
2533 Node* context = assembler->Parameter(4); | 2557 Node* context = assembler->Parameter(4); |
2534 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); | 2558 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
2535 Node* value = assembler->Float64Sqrt(x_value); | 2559 Node* value = assembler->Float64Sqrt(x_value); |
2536 Node* result = assembler->ChangeFloat64ToTagged(value); | 2560 Node* result = assembler->ChangeFloat64ToTagged(value); |
2537 assembler->Return(result); | 2561 assembler->Return(result); |
(...skipping 3491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6029 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 6053 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
6030 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 6054 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
6031 #undef DEFINE_BUILTIN_ACCESSOR_C | 6055 #undef DEFINE_BUILTIN_ACCESSOR_C |
6032 #undef DEFINE_BUILTIN_ACCESSOR_A | 6056 #undef DEFINE_BUILTIN_ACCESSOR_A |
6033 #undef DEFINE_BUILTIN_ACCESSOR_T | 6057 #undef DEFINE_BUILTIN_ACCESSOR_T |
6034 #undef DEFINE_BUILTIN_ACCESSOR_S | 6058 #undef DEFINE_BUILTIN_ACCESSOR_S |
6035 #undef DEFINE_BUILTIN_ACCESSOR_H | 6059 #undef DEFINE_BUILTIN_ACCESSOR_H |
6036 | 6060 |
6037 } // namespace internal | 6061 } // namespace internal |
6038 } // namespace v8 | 6062 } // namespace v8 |
OLD | NEW |