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 2298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2309 Node* y = assembler->Parameter(1); | 2309 Node* y = assembler->Parameter(1); |
2310 Node* x = assembler->Parameter(2); | 2310 Node* x = assembler->Parameter(2); |
2311 Node* context = assembler->Parameter(5); | 2311 Node* context = assembler->Parameter(5); |
2312 Node* y_value = assembler->TruncateTaggedToFloat64(context, y); | 2312 Node* y_value = assembler->TruncateTaggedToFloat64(context, y); |
2313 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); | 2313 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
2314 Node* value = assembler->Float64Atan2(y_value, x_value); | 2314 Node* value = assembler->Float64Atan2(y_value, x_value); |
2315 Node* result = assembler->ChangeFloat64ToTagged(value); | 2315 Node* result = assembler->ChangeFloat64ToTagged(value); |
2316 assembler->Return(result); | 2316 assembler->Return(result); |
2317 } | 2317 } |
2318 | 2318 |
| 2319 // ES6 section 20.2.2.7 Math.atanh ( x ) |
| 2320 void Builtins::Generate_MathAtanh(CodeStubAssembler* assembler) { |
| 2321 using compiler::Node; |
| 2322 |
| 2323 Node* x = assembler->Parameter(1); |
| 2324 Node* context = assembler->Parameter(4); |
| 2325 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
| 2326 Node* value = assembler->Float64Atanh(x_value); |
| 2327 Node* result = assembler->ChangeFloat64ToTagged(value); |
| 2328 assembler->Return(result); |
| 2329 } |
| 2330 |
2319 namespace { | 2331 namespace { |
2320 | 2332 |
2321 void Generate_MathRoundingOperation( | 2333 void Generate_MathRoundingOperation( |
2322 CodeStubAssembler* assembler, | 2334 CodeStubAssembler* assembler, |
2323 compiler::Node* (CodeStubAssembler::*float64op)(compiler::Node*)) { | 2335 compiler::Node* (CodeStubAssembler::*float64op)(compiler::Node*)) { |
2324 typedef CodeStubAssembler::Label Label; | 2336 typedef CodeStubAssembler::Label Label; |
2325 typedef compiler::Node Node; | 2337 typedef compiler::Node Node; |
2326 typedef CodeStubAssembler::Variable Variable; | 2338 typedef CodeStubAssembler::Variable Variable; |
2327 | 2339 |
2328 Node* context = assembler->Parameter(4); | 2340 Node* context = assembler->Parameter(4); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 } | 2389 } |
2378 } | 2390 } |
2379 | 2391 |
2380 } // namespace | 2392 } // namespace |
2381 | 2393 |
2382 // ES6 section 20.2.2.10 Math.ceil ( x ) | 2394 // ES6 section 20.2.2.10 Math.ceil ( x ) |
2383 void Builtins::Generate_MathCeil(CodeStubAssembler* assembler) { | 2395 void Builtins::Generate_MathCeil(CodeStubAssembler* assembler) { |
2384 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Ceil); | 2396 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Ceil); |
2385 } | 2397 } |
2386 | 2398 |
| 2399 // ES6 section 20.2.2.9 Math.cbrt ( x ) |
| 2400 void Builtins::Generate_MathCbrt(CodeStubAssembler* assembler) { |
| 2401 using compiler::Node; |
| 2402 |
| 2403 Node* x = assembler->Parameter(1); |
| 2404 Node* context = assembler->Parameter(4); |
| 2405 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
| 2406 Node* value = assembler->Float64Cbrt(x_value); |
| 2407 Node* result = assembler->ChangeFloat64ToTagged(value); |
| 2408 assembler->Return(result); |
| 2409 } |
| 2410 |
2387 // ES6 section 20.2.2.11 Math.clz32 ( x ) | 2411 // ES6 section 20.2.2.11 Math.clz32 ( x ) |
2388 void Builtins::Generate_MathClz32(CodeStubAssembler* assembler) { | 2412 void Builtins::Generate_MathClz32(CodeStubAssembler* assembler) { |
2389 typedef CodeStubAssembler::Label Label; | 2413 typedef CodeStubAssembler::Label Label; |
2390 typedef compiler::Node Node; | 2414 typedef compiler::Node Node; |
2391 typedef CodeStubAssembler::Variable Variable; | 2415 typedef CodeStubAssembler::Variable Variable; |
2392 | 2416 |
2393 Node* context = assembler->Parameter(4); | 2417 Node* context = assembler->Parameter(4); |
2394 | 2418 |
2395 // Shared entry point for the clz32 operation. | 2419 // Shared entry point for the clz32 operation. |
2396 Variable var_clz32_x(assembler, MachineRepresentation::kWord32); | 2420 Variable var_clz32_x(assembler, MachineRepresentation::kWord32); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2532 using compiler::Node; | 2556 using compiler::Node; |
2533 | 2557 |
2534 Node* x = assembler->Parameter(1); | 2558 Node* x = assembler->Parameter(1); |
2535 Node* context = assembler->Parameter(4); | 2559 Node* context = assembler->Parameter(4); |
2536 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); | 2560 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
2537 Node* value = assembler->Float64Log10(x_value); | 2561 Node* value = assembler->Float64Log10(x_value); |
2538 Node* result = assembler->ChangeFloat64ToTagged(value); | 2562 Node* result = assembler->ChangeFloat64ToTagged(value); |
2539 assembler->Return(result); | 2563 assembler->Return(result); |
2540 } | 2564 } |
2541 | 2565 |
| 2566 // ES6 section 20.2.2.15 Math.expm1 ( x ) |
| 2567 void Builtins::Generate_MathExpm1(CodeStubAssembler* assembler) { |
| 2568 using compiler::Node; |
| 2569 |
| 2570 Node* x = assembler->Parameter(1); |
| 2571 Node* context = assembler->Parameter(4); |
| 2572 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
| 2573 Node* value = assembler->Float64Expm1(x_value); |
| 2574 Node* result = assembler->ChangeFloat64ToTagged(value); |
| 2575 assembler->Return(result); |
| 2576 } |
| 2577 |
2542 // ES6 section 20.2.2.28 Math.round ( x ) | 2578 // ES6 section 20.2.2.28 Math.round ( x ) |
2543 void Builtins::Generate_MathRound(CodeStubAssembler* assembler) { | 2579 void Builtins::Generate_MathRound(CodeStubAssembler* assembler) { |
2544 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Round); | 2580 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Round); |
2545 } | 2581 } |
2546 | 2582 |
2547 // ES6 section 20.2.2.32 Math.sqrt ( x ) | 2583 // ES6 section 20.2.2.32 Math.sqrt ( x ) |
2548 void Builtins::Generate_MathSqrt(CodeStubAssembler* assembler) { | 2584 void Builtins::Generate_MathSqrt(CodeStubAssembler* assembler) { |
2549 using compiler::Node; | 2585 using compiler::Node; |
2550 | 2586 |
2551 Node* x = assembler->Parameter(1); | 2587 Node* x = assembler->Parameter(1); |
(...skipping 3513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6065 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 6101 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
6066 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 6102 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
6067 #undef DEFINE_BUILTIN_ACCESSOR_C | 6103 #undef DEFINE_BUILTIN_ACCESSOR_C |
6068 #undef DEFINE_BUILTIN_ACCESSOR_A | 6104 #undef DEFINE_BUILTIN_ACCESSOR_A |
6069 #undef DEFINE_BUILTIN_ACCESSOR_T | 6105 #undef DEFINE_BUILTIN_ACCESSOR_T |
6070 #undef DEFINE_BUILTIN_ACCESSOR_S | 6106 #undef DEFINE_BUILTIN_ACCESSOR_S |
6071 #undef DEFINE_BUILTIN_ACCESSOR_H | 6107 #undef DEFINE_BUILTIN_ACCESSOR_H |
6072 | 6108 |
6073 } // namespace internal | 6109 } // namespace internal |
6074 } // namespace v8 | 6110 } // namespace v8 |
OLD | NEW |