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