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

Side by Side Diff: src/builtins.cc

Issue 1698343002: [builtins] Move the Boolean constructor to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Also remove it from ia32 of course. 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/compiler/js-intrinsic-lowering.h » ('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 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 } 2310 }
2311 2311
2312 Maybe<bool> result = JSReceiver::SetPrototype( 2312 Maybe<bool> result = JSReceiver::SetPrototype(
2313 Handle<JSReceiver>::cast(target), proto, true, Object::DONT_THROW); 2313 Handle<JSReceiver>::cast(target), proto, true, Object::DONT_THROW);
2314 MAYBE_RETURN(result, isolate->heap()->exception()); 2314 MAYBE_RETURN(result, isolate->heap()->exception());
2315 return *isolate->factory()->ToBoolean(result.FromJust()); 2315 return *isolate->factory()->ToBoolean(result.FromJust());
2316 } 2316 }
2317 2317
2318 2318
2319 // ----------------------------------------------------------------------------- 2319 // -----------------------------------------------------------------------------
2320 // ES6 section 19.3 Boolean Objects
2321
2322
2323 // ES6 section 19.3.1.1 Boolean ( value ) for the [[Call]] case.
2324 BUILTIN(BooleanConstructor) {
2325 HandleScope scope(isolate);
2326 Handle<Object> value = args.atOrUndefined(isolate, 1);
2327 return isolate->heap()->ToBoolean(value->BooleanValue());
2328 }
2329
2330
2331 // ES6 section 19.3.1.1 Boolean ( value ) for the [[Construct]] case.
2332 BUILTIN(BooleanConstructor_ConstructStub) {
2333 HandleScope scope(isolate);
2334 Handle<Object> value = args.atOrUndefined(isolate, 1);
2335 Handle<JSFunction> target = args.target<JSFunction>();
2336 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
2337 DCHECK(*target == target->native_context()->boolean_function());
2338 Handle<Map> initial_map;
2339 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2340 isolate, initial_map,
2341 JSFunction::GetDerivedMap(isolate, target, new_target));
2342 Handle<JSValue> result = Handle<JSValue>::cast(
2343 isolate->factory()->NewJSObjectFromMap(initial_map));
2344 result->set_value(isolate->heap()->ToBoolean(value->BooleanValue()));
2345 return *result;
2346 }
2347
2348
2349 // -----------------------------------------------------------------------------
2320 // ES6 section 20.3 Date Objects 2350 // ES6 section 20.3 Date Objects
2321 2351
2322 2352
2323 namespace { 2353 namespace {
2324 2354
2325 // ES6 section 20.3.1.1 Time Values and Time Range 2355 // ES6 section 20.3.1.1 Time Values and Time Range
2326 const double kMinYear = -1000000.0; 2356 const double kMinYear = -1000000.0;
2327 const double kMaxYear = -kMinYear; 2357 const double kMaxYear = -kMinYear;
2328 const double kMinMonth = -10000000.0; 2358 const double kMinMonth = -10000000.0;
2329 const double kMaxMonth = -kMinMonth; 2359 const double kMaxMonth = -kMinMonth;
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after
4388 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 4418 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
4389 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 4419 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
4390 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 4420 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
4391 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 4421 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
4392 #undef DEFINE_BUILTIN_ACCESSOR_C 4422 #undef DEFINE_BUILTIN_ACCESSOR_C
4393 #undef DEFINE_BUILTIN_ACCESSOR_A 4423 #undef DEFINE_BUILTIN_ACCESSOR_A
4394 4424
4395 4425
4396 } // namespace internal 4426 } // namespace internal
4397 } // namespace v8 4427 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/compiler/js-intrinsic-lowering.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698