OLD | NEW |
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 |
(...skipping 16 matching lines...) Expand all Loading... |
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 |
36 // ES6 section 19.3.3.2 Boolean.prototype.toString ( ) | 36 // ES6 section 19.3.3.2 Boolean.prototype.toString ( ) |
37 void Builtins::Generate_BooleanPrototypeToString(CodeStubAssembler* assembler) { | 37 void Builtins::Generate_BooleanPrototypeToString( |
| 38 compiler::CodeAssemblerState* state) { |
38 typedef compiler::Node Node; | 39 typedef compiler::Node Node; |
| 40 CodeStubAssembler assembler(state); |
39 | 41 |
40 Node* receiver = assembler->Parameter(0); | 42 Node* receiver = assembler.Parameter(0); |
41 Node* context = assembler->Parameter(3); | 43 Node* context = assembler.Parameter(3); |
42 | 44 |
43 Node* value = assembler->ToThisValue( | 45 Node* value = assembler.ToThisValue( |
44 context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.toString"); | 46 context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.toString"); |
45 Node* result = assembler->LoadObjectField(value, Oddball::kToStringOffset); | 47 Node* result = assembler.LoadObjectField(value, Oddball::kToStringOffset); |
46 assembler->Return(result); | 48 assembler.Return(result); |
47 } | 49 } |
48 | 50 |
49 // ES6 section 19.3.3.3 Boolean.prototype.valueOf ( ) | 51 // ES6 section 19.3.3.3 Boolean.prototype.valueOf ( ) |
50 void Builtins::Generate_BooleanPrototypeValueOf(CodeStubAssembler* assembler) { | 52 void Builtins::Generate_BooleanPrototypeValueOf( |
| 53 compiler::CodeAssemblerState* state) { |
51 typedef compiler::Node Node; | 54 typedef compiler::Node Node; |
| 55 CodeStubAssembler assembler(state); |
52 | 56 |
53 Node* receiver = assembler->Parameter(0); | 57 Node* receiver = assembler.Parameter(0); |
54 Node* context = assembler->Parameter(3); | 58 Node* context = assembler.Parameter(3); |
55 | 59 |
56 Node* result = assembler->ToThisValue( | 60 Node* result = assembler.ToThisValue( |
57 context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.valueOf"); | 61 context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.valueOf"); |
58 assembler->Return(result); | 62 assembler.Return(result); |
59 } | 63 } |
60 | 64 |
61 } // namespace internal | 65 } // namespace internal |
62 } // namespace v8 | 66 } // namespace v8 |
OLD | NEW |