OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 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 | 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-utils-gen.h" | 5 #include "src/builtins/builtins-utils-gen.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 11 matching lines...) Expand all Loading... |
22 Return(result); | 22 Return(result); |
23 } | 23 } |
24 | 24 |
25 // ES6 #sec-symbol.prototype.tostring | 25 // ES6 #sec-symbol.prototype.tostring |
26 TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) { | 26 TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) { |
27 Node* context = Parameter(Descriptor::kContext); | 27 Node* context = Parameter(Descriptor::kContext); |
28 Node* receiver = Parameter(Descriptor::kReceiver); | 28 Node* receiver = Parameter(Descriptor::kReceiver); |
29 | 29 |
30 Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol, | 30 Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol, |
31 "Symbol.prototype.toString"); | 31 "Symbol.prototype.toString"); |
32 Node* result = CallRuntime(Runtime::kSymbolDescriptiveString, context, value); | 32 Node* result = LoadObjectField(value, Symbol::kDescriptiveStringOffset); |
33 Return(result); | 33 Return(result); |
34 } | 34 } |
35 | 35 |
36 // ES6 #sec-symbol.prototype.valueof | 36 // ES6 #sec-symbol.prototype.valueof |
37 TF_BUILTIN(SymbolPrototypeValueOf, CodeStubAssembler) { | 37 TF_BUILTIN(SymbolPrototypeValueOf, CodeStubAssembler) { |
38 Node* context = Parameter(Descriptor::kContext); | 38 Node* context = Parameter(Descriptor::kContext); |
39 Node* receiver = Parameter(Descriptor::kReceiver); | 39 Node* receiver = Parameter(Descriptor::kReceiver); |
40 | 40 |
41 Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, | 41 Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, |
42 "Symbol.prototype.valueOf"); | 42 "Symbol.prototype.valueOf"); |
43 Return(result); | 43 Return(result); |
44 } | 44 } |
45 | 45 |
46 } // namespace internal | 46 } // namespace internal |
47 } // namespace v8 | 47 } // namespace v8 |
OLD | NEW |