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

Side by Side Diff: src/builtins.cc

Issue 1701273003: [builtins] Migrate the leftover Boolean setup to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/js/v8natives.js » ('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.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
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
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
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/js/v8natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698