| 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" | |
| 8 #include "src/counters.h" | 7 #include "src/counters.h" |
| 9 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
| 10 | 9 |
| 11 namespace v8 { | 10 namespace v8 { |
| 12 namespace internal { | 11 namespace internal { |
| 13 | 12 |
| 14 // ----------------------------------------------------------------------------- | 13 // ----------------------------------------------------------------------------- |
| 15 // ES6 section 19.4 Symbol Objects | 14 // ES6 section 19.4 Symbol Objects |
| 16 | 15 |
| 17 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case. | 16 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 result = symbol->name(); | 59 result = symbol->name(); |
| 61 DCHECK(result->IsString()); | 60 DCHECK(result->IsString()); |
| 62 } else { | 61 } else { |
| 63 result = isolate->heap()->undefined_value(); | 62 result = isolate->heap()->undefined_value(); |
| 64 } | 63 } |
| 65 DCHECK_EQ(isolate->heap()->public_symbol_table()->SlowReverseLookup(*symbol), | 64 DCHECK_EQ(isolate->heap()->public_symbol_table()->SlowReverseLookup(*symbol), |
| 66 result); | 65 result); |
| 67 return result; | 66 return result; |
| 68 } | 67 } |
| 69 | 68 |
| 70 // ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) | |
| 71 TF_BUILTIN(SymbolPrototypeToPrimitive, CodeStubAssembler) { | |
| 72 Node* receiver = Parameter(0); | |
| 73 Node* context = Parameter(4); | |
| 74 | |
| 75 Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, | |
| 76 "Symbol.prototype [ @@toPrimitive ]"); | |
| 77 Return(result); | |
| 78 } | |
| 79 | |
| 80 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) | |
| 81 TF_BUILTIN(SymbolPrototypeToString, CodeStubAssembler) { | |
| 82 Node* receiver = Parameter(0); | |
| 83 Node* context = Parameter(3); | |
| 84 | |
| 85 Node* value = ToThisValue(context, receiver, PrimitiveType::kSymbol, | |
| 86 "Symbol.prototype.toString"); | |
| 87 Node* result = CallRuntime(Runtime::kSymbolDescriptiveString, context, value); | |
| 88 Return(result); | |
| 89 } | |
| 90 | |
| 91 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) | |
| 92 TF_BUILTIN(SymbolPrototypeValueOf, CodeStubAssembler) { | |
| 93 Node* receiver = Parameter(0); | |
| 94 Node* context = Parameter(3); | |
| 95 | |
| 96 Node* result = ToThisValue(context, receiver, PrimitiveType::kSymbol, | |
| 97 "Symbol.prototype.valueOf"); | |
| 98 Return(result); | |
| 99 } | |
| 100 | |
| 101 } // namespace internal | 69 } // namespace internal |
| 102 } // namespace v8 | 70 } // namespace v8 |
| OLD | NEW |