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 2221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2232 Handle<Object> object = args.atOrUndefined(isolate, 1); | 2232 Handle<Object> object = args.atOrUndefined(isolate, 1); |
2233 Handle<Object> replacer = args.atOrUndefined(isolate, 2); | 2233 Handle<Object> replacer = args.atOrUndefined(isolate, 2); |
2234 Handle<Object> indent = args.atOrUndefined(isolate, 3); | 2234 Handle<Object> indent = args.atOrUndefined(isolate, 3); |
2235 RETURN_RESULT_OR_FAILURE(isolate, | 2235 RETURN_RESULT_OR_FAILURE(isolate, |
2236 stringifier.Stringify(object, replacer, indent)); | 2236 stringifier.Stringify(object, replacer, indent)); |
2237 } | 2237 } |
2238 | 2238 |
2239 // ----------------------------------------------------------------------------- | 2239 // ----------------------------------------------------------------------------- |
2240 // ES6 section 20.2.2 Function Properties of the Math Object | 2240 // ES6 section 20.2.2 Function Properties of the Math Object |
2241 | 2241 |
| 2242 // ES6 section - 20.2.2.1 Math.abs ( x ) |
| 2243 void Builtins::Generate_MathAbs(CodeStubAssembler* assembler) { |
| 2244 using compiler::Node; |
| 2245 Node* x = assembler->Parameter(1); |
| 2246 Node* context = assembler->Parameter(4); |
| 2247 Node* x_value = assembler->TruncateTaggedToFloat64(context, x); |
| 2248 Node* value = assembler->Float64Abs(x_value); |
| 2249 Node* result = assembler->ChangeFloat64ToTagged(value); |
| 2250 assembler->Return(result); |
| 2251 } |
2242 | 2252 |
2243 // ES6 section 20.2.2.2 Math.acos ( x ) | 2253 // ES6 section 20.2.2.2 Math.acos ( x ) |
2244 BUILTIN(MathAcos) { | 2254 BUILTIN(MathAcos) { |
2245 HandleScope scope(isolate); | 2255 HandleScope scope(isolate); |
2246 DCHECK_EQ(2, args.length()); | 2256 DCHECK_EQ(2, args.length()); |
2247 Handle<Object> x = args.at<Object>(1); | 2257 Handle<Object> x = args.at<Object>(1); |
2248 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); | 2258 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); |
2249 return *isolate->factory()->NewHeapNumber(std::acos(x->Number())); | 2259 return *isolate->factory()->NewHeapNumber(std::acos(x->Number())); |
2250 } | 2260 } |
2251 | 2261 |
2252 | |
2253 // ES6 section 20.2.2.4 Math.asin ( x ) | 2262 // ES6 section 20.2.2.4 Math.asin ( x ) |
2254 BUILTIN(MathAsin) { | 2263 BUILTIN(MathAsin) { |
2255 HandleScope scope(isolate); | 2264 HandleScope scope(isolate); |
2256 DCHECK_EQ(2, args.length()); | 2265 DCHECK_EQ(2, args.length()); |
2257 Handle<Object> x = args.at<Object>(1); | 2266 Handle<Object> x = args.at<Object>(1); |
2258 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); | 2267 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, x, Object::ToNumber(x)); |
2259 return *isolate->factory()->NewHeapNumber(std::asin(x->Number())); | 2268 return *isolate->factory()->NewHeapNumber(std::asin(x->Number())); |
2260 } | 2269 } |
2261 | 2270 |
2262 // ES6 section 20.2.2.6 Math.atan ( x ) | 2271 // ES6 section 20.2.2.6 Math.atan ( x ) |
(...skipping 4030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6293 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 6302 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
6294 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 6303 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
6295 #undef DEFINE_BUILTIN_ACCESSOR_C | 6304 #undef DEFINE_BUILTIN_ACCESSOR_C |
6296 #undef DEFINE_BUILTIN_ACCESSOR_A | 6305 #undef DEFINE_BUILTIN_ACCESSOR_A |
6297 #undef DEFINE_BUILTIN_ACCESSOR_T | 6306 #undef DEFINE_BUILTIN_ACCESSOR_T |
6298 #undef DEFINE_BUILTIN_ACCESSOR_S | 6307 #undef DEFINE_BUILTIN_ACCESSOR_S |
6299 #undef DEFINE_BUILTIN_ACCESSOR_H | 6308 #undef DEFINE_BUILTIN_ACCESSOR_H |
6300 | 6309 |
6301 } // namespace internal | 6310 } // namespace internal |
6302 } // namespace v8 | 6311 } // namespace v8 |
OLD | NEW |