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.h" | 7 #include "src/api.h" |
8 #include "src/api-natives.h" | 8 #include "src/api-natives.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/once.h" | 10 #include "src/base/once.h" |
(...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2339 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2339 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
2340 isolate, initial_map, | 2340 isolate, initial_map, |
2341 JSFunction::GetDerivedMap(isolate, target, new_target)); | 2341 JSFunction::GetDerivedMap(isolate, target, new_target)); |
2342 Handle<JSValue> result = Handle<JSValue>::cast( | 2342 Handle<JSValue> result = Handle<JSValue>::cast( |
2343 isolate->factory()->NewJSObjectFromMap(initial_map)); | 2343 isolate->factory()->NewJSObjectFromMap(initial_map)); |
2344 result->set_value(isolate->heap()->ToBoolean(value->BooleanValue())); | 2344 result->set_value(isolate->heap()->ToBoolean(value->BooleanValue())); |
2345 return *result; | 2345 return *result; |
2346 } | 2346 } |
2347 | 2347 |
2348 | 2348 |
| 2349 // ES6 section 19.3.3.2 Boolean.prototype.toString ( ) |
| 2350 BUILTIN(BooleanPrototypeToString) { |
| 2351 HandleScope scope(isolate); |
| 2352 Handle<Object> receiver = args.receiver(); |
| 2353 if (receiver->IsJSValue()) { |
| 2354 receiver = handle(Handle<JSValue>::cast(receiver)->value(), isolate); |
| 2355 } |
| 2356 if (!receiver->IsBoolean()) { |
| 2357 THROW_NEW_ERROR_RETURN_FAILURE( |
| 2358 isolate, NewTypeError(MessageTemplate::kNotGeneric, |
| 2359 isolate->factory()->NewStringFromAsciiChecked( |
| 2360 "Boolean.prototype.toString"))); |
| 2361 } |
| 2362 return Handle<Oddball>::cast(receiver)->to_string(); |
| 2363 } |
| 2364 |
| 2365 |
| 2366 // ES6 section 19.3.3.3 Boolean.prototype.valueOf ( ) |
| 2367 BUILTIN(BooleanPrototypeValueOf) { |
| 2368 HandleScope scope(isolate); |
| 2369 Handle<Object> receiver = args.receiver(); |
| 2370 if (receiver->IsJSValue()) { |
| 2371 receiver = handle(Handle<JSValue>::cast(receiver)->value(), isolate); |
| 2372 } |
| 2373 if (!receiver->IsBoolean()) { |
| 2374 THROW_NEW_ERROR_RETURN_FAILURE( |
| 2375 isolate, NewTypeError(MessageTemplate::kNotGeneric, |
| 2376 isolate->factory()->NewStringFromAsciiChecked( |
| 2377 "Boolean.prototype.valueOf"))); |
| 2378 } |
| 2379 return *receiver; |
| 2380 } |
| 2381 |
| 2382 |
2349 // ----------------------------------------------------------------------------- | 2383 // ----------------------------------------------------------------------------- |
2350 // ES6 section 20.3 Date Objects | 2384 // ES6 section 20.3 Date Objects |
2351 | 2385 |
2352 | 2386 |
2353 namespace { | 2387 namespace { |
2354 | 2388 |
2355 // ES6 section 20.3.1.1 Time Values and Time Range | 2389 // ES6 section 20.3.1.1 Time Values and Time Range |
2356 const double kMinYear = -1000000.0; | 2390 const double kMinYear = -1000000.0; |
2357 const double kMaxYear = -kMinYear; | 2391 const double kMaxYear = -kMinYear; |
2358 const double kMinMonth = -10000000.0; | 2392 const double kMinMonth = -10000000.0; |
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4418 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 4452 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
4419 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 4453 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
4420 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 4454 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
4421 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 4455 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
4422 #undef DEFINE_BUILTIN_ACCESSOR_C | 4456 #undef DEFINE_BUILTIN_ACCESSOR_C |
4423 #undef DEFINE_BUILTIN_ACCESSOR_A | 4457 #undef DEFINE_BUILTIN_ACCESSOR_A |
4424 | 4458 |
4425 | 4459 |
4426 } // namespace internal | 4460 } // namespace internal |
4427 } // namespace v8 | 4461 } // namespace v8 |
OLD | NEW |