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

Side by Side Diff: src/builtins/builtins-boolean.cc

Issue 2422573002: [builtins] Remove template argument from args.target(). (Closed)
Patch Set: Created 4 years, 2 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/builtins-arraybuffer.cc ('k') | src/builtins/builtins-dataview.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 10
11 // ----------------------------------------------------------------------------- 11 // -----------------------------------------------------------------------------
12 // ES6 section 19.3 Boolean Objects 12 // ES6 section 19.3 Boolean Objects
13 13
14 // ES6 section 19.3.1.1 Boolean ( value ) for the [[Call]] case. 14 // ES6 section 19.3.1.1 Boolean ( value ) for the [[Call]] case.
15 BUILTIN(BooleanConstructor) { 15 BUILTIN(BooleanConstructor) {
16 HandleScope scope(isolate); 16 HandleScope scope(isolate);
17 Handle<Object> value = args.atOrUndefined(isolate, 1); 17 Handle<Object> value = args.atOrUndefined(isolate, 1);
18 return isolate->heap()->ToBoolean(value->BooleanValue()); 18 return isolate->heap()->ToBoolean(value->BooleanValue());
19 } 19 }
20 20
21 // ES6 section 19.3.1.1 Boolean ( value ) for the [[Construct]] case. 21 // ES6 section 19.3.1.1 Boolean ( value ) for the [[Construct]] case.
22 BUILTIN(BooleanConstructor_ConstructStub) { 22 BUILTIN(BooleanConstructor_ConstructStub) {
23 HandleScope scope(isolate); 23 HandleScope scope(isolate);
24 Handle<Object> value = args.atOrUndefined(isolate, 1); 24 Handle<Object> value = args.atOrUndefined(isolate, 1);
25 Handle<JSFunction> target = args.target<JSFunction>(); 25 Handle<JSFunction> target = args.target();
26 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target()); 26 Handle<JSReceiver> new_target = Handle<JSReceiver>::cast(args.new_target());
27 DCHECK(*target == target->native_context()->boolean_function()); 27 DCHECK(*target == target->native_context()->boolean_function());
28 Handle<JSObject> result; 28 Handle<JSObject> result;
29 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, 29 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
30 JSObject::New(target, new_target)); 30 JSObject::New(target, new_target));
31 Handle<JSValue>::cast(result)->set_value( 31 Handle<JSValue>::cast(result)->set_value(
32 isolate->heap()->ToBoolean(value->BooleanValue())); 32 isolate->heap()->ToBoolean(value->BooleanValue()));
33 return *result; 33 return *result;
34 } 34 }
35 35
(...skipping 17 matching lines...) Expand all
53 Node* receiver = assembler->Parameter(0); 53 Node* receiver = assembler->Parameter(0);
54 Node* context = assembler->Parameter(3); 54 Node* context = assembler->Parameter(3);
55 55
56 Node* result = assembler->ToThisValue( 56 Node* result = assembler->ToThisValue(
57 context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.valueOf"); 57 context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.valueOf");
58 assembler->Return(result); 58 assembler->Return(result);
59 } 59 }
60 60
61 } // namespace internal 61 } // namespace internal
62 } // namespace v8 62 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-arraybuffer.cc ('k') | src/builtins/builtins-dataview.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698