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-utils.h" | 5 #include "src/builtins/builtins-utils.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 #include "src/counters.h" | 8 #include "src/counters.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 DCHECK(result->IsString()); | 61 DCHECK(result->IsString()); |
62 } else { | 62 } else { |
63 result = isolate->heap()->undefined_value(); | 63 result = isolate->heap()->undefined_value(); |
64 } | 64 } |
65 DCHECK_EQ(isolate->heap()->public_symbol_table()->SlowReverseLookup(*symbol), | 65 DCHECK_EQ(isolate->heap()->public_symbol_table()->SlowReverseLookup(*symbol), |
66 result); | 66 result); |
67 return result; | 67 return result; |
68 } | 68 } |
69 | 69 |
70 // ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) | 70 // ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) |
71 void Builtins::Generate_SymbolPrototypeToPrimitive( | 71 TF_BUILTIN(SymbolPrototypeToPrimitive, CodeStubAssembler) { |
72 compiler::CodeAssemblerState* state) { | 72 Node* receiver = Parameter(0); |
73 typedef compiler::Node Node; | 73 Node* context = Parameter(4); |
74 CodeStubAssembler assembler(state); | |
75 | 74 |
76 Node* receiver = assembler.Parameter(0); | 75 Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, |
77 Node* context = assembler.Parameter(4); | 76 "Symbol.prototype [ @@toPrimitive ]"); |
78 | 77 Return(result); |
79 Node* result = | |
80 assembler.ToThisValue(context, receiver, PrimitiveType::kSymbol, | |
81 "Symbol.prototype [ @@toPrimitive ]"); | |
82 assembler.Return(result); | |
83 } | 78 } |
84 | 79 |
85 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) | 80 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) |
86 void Builtins::Generate_SymbolPrototypeToString( | 81 TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) { |
87 compiler::CodeAssemblerState* state) { | 82 Node* receiver = Parameter(0); |
88 typedef compiler::Node Node; | 83 Node* context = Parameter(3); |
89 CodeStubAssembler assembler(state); | |
90 | 84 |
91 Node* receiver = assembler.Parameter(0); | 85 Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol, |
92 Node* context = assembler.Parameter(3); | 86 "Symbol.prototype.toString"); |
93 | 87 Node* result = CallRuntime(Runtime::kSymbolDescriptiveString, context, value); |
94 Node* value = assembler.ToThisValue(context, receiver, PrimitiveType::kSymbol, | 88 Return(result); |
95 "Symbol.prototype.toString"); | |
96 Node* result = | |
97 assembler.CallRuntime(Runtime::kSymbolDescriptiveString, context, value); | |
98 assembler.Return(result); | |
99 } | 89 } |
100 | 90 |
101 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) | 91 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) |
102 void Builtins::Generate_SymbolPrototypeValueOf( | 92 TF_BUILTIN(SymbolPrototypeValueOf, CodeStubAssembler) { |
103 compiler::CodeAssemblerState* state) { | 93 Node* receiver = Parameter(0); |
104 typedef compiler::Node Node; | 94 Node* context = Parameter(3); |
105 CodeStubAssembler assembler(state); | |
106 | 95 |
107 Node* receiver = assembler.Parameter(0); | 96 Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, |
108 Node* context = assembler.Parameter(3); | 97 "Symbol.prototype.valueOf"); |
109 | 98 Return(result); |
110 Node* result = assembler.ToThisValue( | |
111 context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.valueOf"); | |
112 assembler.Return(result); | |
113 } | 99 } |
114 | 100 |
115 } // namespace internal | 101 } // namespace internal |
116 } // namespace v8 | 102 } // namespace v8 |
OLD | NEW |