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 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Construct]] case. | 27 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Construct]] case. |
28 BUILTIN(SymbolConstructor_ConstructStub) { | 28 BUILTIN(SymbolConstructor_ConstructStub) { |
29 HandleScope scope(isolate); | 29 HandleScope scope(isolate); |
30 THROW_NEW_ERROR_RETURN_FAILURE( | 30 THROW_NEW_ERROR_RETURN_FAILURE( |
31 isolate, NewTypeError(MessageTemplate::kNotConstructor, | 31 isolate, NewTypeError(MessageTemplate::kNotConstructor, |
32 isolate->factory()->Symbol_string())); | 32 isolate->factory()->Symbol_string())); |
33 } | 33 } |
34 | 34 |
35 // ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) | 35 // ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint ) |
36 void Builtins::Generate_SymbolPrototypeToPrimitive( | 36 void Builtins::Generate_SymbolPrototypeToPrimitive( |
37 CodeStubAssembler* assembler) { | 37 compiler::CodeAssemblerState* state) { |
38 typedef compiler::Node Node; | 38 typedef compiler::Node Node; |
| 39 CodeStubAssembler assembler(state); |
39 | 40 |
40 Node* receiver = assembler->Parameter(0); | 41 Node* receiver = assembler.Parameter(0); |
41 Node* context = assembler->Parameter(4); | 42 Node* context = assembler.Parameter(4); |
42 | 43 |
43 Node* result = | 44 Node* result = |
44 assembler->ToThisValue(context, receiver, PrimitiveType::kSymbol, | 45 assembler.ToThisValue(context, receiver, PrimitiveType::kSymbol, |
45 "Symbol.prototype [ @@toPrimitive ]"); | 46 "Symbol.prototype [ @@toPrimitive ]"); |
46 assembler->Return(result); | 47 assembler.Return(result); |
47 } | 48 } |
48 | 49 |
49 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) | 50 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) |
50 void Builtins::Generate_SymbolPrototypeToString(CodeStubAssembler* assembler) { | 51 void Builtins::Generate_SymbolPrototypeToString( |
| 52 compiler::CodeAssemblerState* state) { |
51 typedef compiler::Node Node; | 53 typedef compiler::Node Node; |
| 54 CodeStubAssembler assembler(state); |
52 | 55 |
53 Node* receiver = assembler->Parameter(0); | 56 Node* receiver = assembler.Parameter(0); |
54 Node* context = assembler->Parameter(3); | 57 Node* context = assembler.Parameter(3); |
55 | 58 |
56 Node* value = assembler->ToThisValue( | 59 Node* value = assembler.ToThisValue(context, receiver, PrimitiveType::kSymbol, |
57 context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.toString"); | 60 "Symbol.prototype.toString"); |
58 Node* result = | 61 Node* result = |
59 assembler->CallRuntime(Runtime::kSymbolDescriptiveString, context, value); | 62 assembler.CallRuntime(Runtime::kSymbolDescriptiveString, context, value); |
60 assembler->Return(result); | 63 assembler.Return(result); |
61 } | 64 } |
62 | 65 |
63 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) | 66 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) |
64 void Builtins::Generate_SymbolPrototypeValueOf(CodeStubAssembler* assembler) { | 67 void Builtins::Generate_SymbolPrototypeValueOf( |
| 68 compiler::CodeAssemblerState* state) { |
65 typedef compiler::Node Node; | 69 typedef compiler::Node Node; |
| 70 CodeStubAssembler assembler(state); |
66 | 71 |
67 Node* receiver = assembler->Parameter(0); | 72 Node* receiver = assembler.Parameter(0); |
68 Node* context = assembler->Parameter(3); | 73 Node* context = assembler.Parameter(3); |
69 | 74 |
70 Node* result = assembler->ToThisValue( | 75 Node* result = assembler.ToThisValue( |
71 context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.valueOf"); | 76 context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.valueOf"); |
72 assembler->Return(result); | 77 assembler.Return(result); |
73 } | 78 } |
74 | 79 |
75 } // namespace internal | 80 } // namespace internal |
76 } // namespace v8 | 81 } // namespace v8 |
OLD | NEW |