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

Side by Side Diff: src/builtins.cc

Issue 2065503002: [builtins] Introduce proper Float64Atan and Float64Atan2 operators. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [WIP] Fix GCC/Win32. 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
« no previous file with comments | « src/builtins.h ('k') | src/compiler/arm/code-generator-arm.cc » ('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 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/once.h" 11 #include "src/base/once.h"
11 #include "src/bootstrapper.h" 12 #include "src/bootstrapper.h"
12 #include "src/code-factory.h" 13 #include "src/code-factory.h"
13 #include "src/code-stub-assembler.h" 14 #include "src/code-stub-assembler.h"
14 #include "src/dateparser-inl.h" 15 #include "src/dateparser-inl.h"
15 #include "src/elements.h" 16 #include "src/elements.h"
16 #include "src/frames-inl.h" 17 #include "src/frames-inl.h"
17 #include "src/gdb-jit.h" 18 #include "src/gdb-jit.h"
18 #include "src/ic/handler-compiler.h" 19 #include "src/ic/handler-compiler.h"
19 #include "src/ic/ic.h" 20 #include "src/ic/ic.h"
(...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 2283
2283 // ES6 section 20.2.2.4 Math.asin ( x ) 2284 // ES6 section 20.2.2.4 Math.asin ( x )
2284 BUILTIN(MathAsin) { 2285 BUILTIN(MathAsin) {
2285 HandleScope scope(isolate); 2286 HandleScope scope(isolate);
2286 DCHECK_EQ(2, args.length()); 2287 DCHECK_EQ(2, args.length());
2287 Handle<Object> x = args.at<Object>(1); 2288 Handle<Object> x = args.at<Object>(1);
2288 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); 2289 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x));
2289 return *isolate->factory()->NewHeapNumber(std::asin(x->Number())); 2290 return *isolate->factory()->NewHeapNumber(std::asin(x->Number()));
2290 } 2291 }
2291 2292
2293 // ES6 section 20.2.2.6 Math.atan ( x )
2294 void Builtins::Generate_MathAtan(CodeStubAssembler* assembler) {
2295 using compiler::Node;
2292 2296
2293 // ES6 section 20.2.2.6 Math.atan ( x ) 2297 Node* x = assembler->Parameter(1);
2294 BUILTIN(MathAtan) { 2298 Node* context = assembler->Parameter(4);
2295 HandleScope scope(isolate); 2299 Node* x_value = assembler->TruncateTaggedToFloat64(context, x);
2296 DCHECK_EQ(2, args.length()); 2300 Node* value = assembler->Float64Atan(x_value);
2297 Handle<Object> x = args.at<Object>(1); 2301 Node* result = assembler->ChangeFloat64ToTagged(value);
2298 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); 2302 assembler->Return(result);
2299 return *isolate->factory()->NewHeapNumber(std::atan(x->Number())); 2303 }
2304
2305 // ES6 section 20.2.2.8 Math.atan2 ( y, x )
2306 void Builtins::Generate_MathAtan2(CodeStubAssembler* assembler) {
2307 using compiler::Node;
2308
2309 Node* y = assembler->Parameter(1);
2310 Node* x = assembler->Parameter(2);
2311 Node* context = assembler->Parameter(5);
2312 Node* y_value = assembler->TruncateTaggedToFloat64(context, y);
2313 Node* x_value = assembler->TruncateTaggedToFloat64(context, x);
2314 Node* value = assembler->Float64Atan2(y_value, x_value);
2315 Node* result = assembler->ChangeFloat64ToTagged(value);
2316 assembler->Return(result);
2300 } 2317 }
2301 2318
2302 namespace { 2319 namespace {
2303 2320
2304 void Generate_MathRoundingOperation( 2321 void Generate_MathRoundingOperation(
2305 CodeStubAssembler* assembler, 2322 CodeStubAssembler* assembler,
2306 compiler::Node* (CodeStubAssembler::*float64op)(compiler::Node*)) { 2323 compiler::Node* (CodeStubAssembler::*float64op)(compiler::Node*)) {
2307 typedef CodeStubAssembler::Label Label; 2324 typedef CodeStubAssembler::Label Label;
2308 typedef compiler::Node Node; 2325 typedef compiler::Node Node;
2309 typedef CodeStubAssembler::Variable Variable; 2326 typedef CodeStubAssembler::Variable Variable;
(...skipping 3631 matching lines...) Expand 10 before | Expand all | Expand 10 after
5941 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5958 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5942 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5959 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5943 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5960 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5944 #undef DEFINE_BUILTIN_ACCESSOR_C 5961 #undef DEFINE_BUILTIN_ACCESSOR_C
5945 #undef DEFINE_BUILTIN_ACCESSOR_A 5962 #undef DEFINE_BUILTIN_ACCESSOR_A
5946 #undef DEFINE_BUILTIN_ACCESSOR_T 5963 #undef DEFINE_BUILTIN_ACCESSOR_T
5947 #undef DEFINE_BUILTIN_ACCESSOR_H 5964 #undef DEFINE_BUILTIN_ACCESSOR_H
5948 5965
5949 } // namespace internal 5966 } // namespace internal
5950 } // namespace v8 5967 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/compiler/arm/code-generator-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698