OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "src/builtins/builtins-utils-gen.h" |
| 6 #include "src/builtins/builtins.h" |
| 7 #include "src/code-stub-assembler.h" |
| 8 |
| 9 namespace v8 { |
| 10 namespace internal { |
| 11 |
| 12 // ----------------------------------------------------------------------------- |
| 13 // ES6 section 19.4 Symbol Objects |
| 14 |
| 15 // ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) |
| 16 TF_BUILTIN(SymbolPrototypeToPrimitive, CodeStubAssembler) { |
| 17 Node* receiver = Parameter(0); |
| 18 Node* context = Parameter(4); |
| 19 |
| 20 Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, |
| 21 "Symbol.prototype [ @@toPrimitive ]"); |
| 22 Return(result); |
| 23 } |
| 24 |
| 25 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) |
| 26 TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) { |
| 27 Node* receiver = Parameter(0); |
| 28 Node* context = Parameter(3); |
| 29 |
| 30 Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol, |
| 31 "Symbol.prototype.toString"); |
| 32 Node* result = CallRuntime(Runtime::kSymbolDescriptiveString, context, value); |
| 33 Return(result); |
| 34 } |
| 35 |
| 36 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) |
| 37 TF_BUILTIN(SymbolPrototypeValueOf, CodeStubAssembler) { |
| 38 Node* receiver = Parameter(0); |
| 39 Node* context = Parameter(3); |
| 40 |
| 41 Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, |
| 42 "Symbol.prototype.valueOf"); |
| 43 Return(result); |
| 44 } |
| 45 |
| 46 } // namespace internal |
| 47 } // namespace v8 |
OLD | NEW |