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

Side by Side Diff: src/builtins.cc

Issue 2029413005: [builtins] Migrate Math.log to TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 4 years, 6 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
OLDNEW
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/once.h" 10 #include "src/base/once.h"
(...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 HandleScope scope(isolate); 2457 HandleScope scope(isolate);
2458 DCHECK_EQ(3, args.length()); 2458 DCHECK_EQ(3, args.length());
2459 Handle<Object> x = args.at<Object>(1); 2459 Handle<Object> x = args.at<Object>(1);
2460 Handle<Object> y = args.at<Object>(2); 2460 Handle<Object> y = args.at<Object>(2);
2461 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); 2461 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x));
2462 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, y, Object::ToNumber(y)); 2462 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, y, Object::ToNumber(y));
2463 int product = static_cast<int>(NumberToUint32(*x) * NumberToUint32(*y)); 2463 int product = static_cast<int>(NumberToUint32(*x) * NumberToUint32(*y));
2464 return *isolate->factory()->NewNumberFromInt(product); 2464 return *isolate->factory()->NewNumberFromInt(product);
2465 } 2465 }
2466 2466
2467 // ES6 section 20.2.2.20 Math.log ( x )
2468 void Builtins::Generate_MathLog(CodeStubAssembler* assembler) {
2469 using compiler::Node;
2470
2471 Node* x = assembler->Parameter(1);
2472 Node* context = assembler->Parameter(4);
2473 Node* x_value = assembler->TruncateTaggedToFloat64(context, x);
2474 Node* value = assembler->Float64Log(x_value);
2475 Node* result = assembler->ChangeFloat64ToTagged(value);
2476 assembler->Return(result);
2477 }
2478
2467 // ES6 section 20.2.2.28 Math.round ( x ) 2479 // ES6 section 20.2.2.28 Math.round ( x )
2468 void Builtins::Generate_MathRound(CodeStubAssembler* assembler) { 2480 void Builtins::Generate_MathRound(CodeStubAssembler* assembler) {
2469 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Round); 2481 Generate_MathRoundingOperation(assembler, &CodeStubAssembler::Float64Round);
2470 } 2482 }
2471 2483
2472 // ES6 section 20.2.2.32 Math.sqrt ( x ) 2484 // ES6 section 20.2.2.32 Math.sqrt ( x )
2473 void Builtins::Generate_MathSqrt(CodeStubAssembler* assembler) { 2485 void Builtins::Generate_MathSqrt(CodeStubAssembler* assembler) {
2474 using compiler::Node; 2486 using compiler::Node;
2475 2487
2476 Node* x = assembler->Parameter(1); 2488 Node* x = assembler->Parameter(1);
(...skipping 3316 matching lines...) Expand 10 before | Expand all | Expand 10 after
5793 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5805 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5794 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5806 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5795 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5807 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5796 #undef DEFINE_BUILTIN_ACCESSOR_C 5808 #undef DEFINE_BUILTIN_ACCESSOR_C
5797 #undef DEFINE_BUILTIN_ACCESSOR_A 5809 #undef DEFINE_BUILTIN_ACCESSOR_A
5798 #undef DEFINE_BUILTIN_ACCESSOR_T 5810 #undef DEFINE_BUILTIN_ACCESSOR_T
5799 #undef DEFINE_BUILTIN_ACCESSOR_H 5811 #undef DEFINE_BUILTIN_ACCESSOR_H
5800 5812
5801 } // namespace internal 5813 } // namespace internal
5802 } // namespace v8 5814 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698