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 compiler::CodeAssemblerState* state) { | 37 CodeStubAssembler* assembler) { |
38 typedef compiler::Node Node; | 38 typedef compiler::Node Node; |
39 CodeStubAssembler assembler(state); | |
40 | 39 |
41 Node* receiver = assembler.Parameter(0); | 40 Node* receiver = assembler->Parameter(0); |
42 Node* context = assembler.Parameter(4); | 41 Node* context = assembler->Parameter(4); |
43 | 42 |
44 Node* result = | 43 Node* result = |
45 assembler.ToThisValue(context, receiver, PrimitiveType::kSymbol, | 44 assembler->ToThisValue(context, receiver, PrimitiveType::kSymbol, |
46 "Symbol.prototype [ @@toPrimitive ]"); | 45 "Symbol.prototype [ @@toPrimitive ]"); |
47 assembler.Return(result); | 46 assembler->Return(result); |
48 } | 47 } |
49 | 48 |
50 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) | 49 // ES6 section 19.4.3.2 Symbol.prototype.toString ( ) |
51 void Builtins::Generate_SymbolPrototypeToString( | 50 void Builtins::Generate_SymbolPrototypeToString(CodeStubAssembler* assembler) { |
52 compiler::CodeAssemblerState* state) { | |
53 typedef compiler::Node Node; | 51 typedef compiler::Node Node; |
54 CodeStubAssembler assembler(state); | |
55 | 52 |
56 Node* receiver = assembler.Parameter(0); | 53 Node* receiver = assembler->Parameter(0); |
57 Node* context = assembler.Parameter(3); | 54 Node* context = assembler->Parameter(3); |
58 | 55 |
59 Node* value = assembler.ToThisValue(context, receiver, PrimitiveType::kSymbol, | 56 Node* value = assembler->ToThisValue( |
60 "Symbol.prototype.toString"); | 57 context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.toString"); |
61 Node* result = | 58 Node* result = |
62 assembler.CallRuntime(Runtime::kSymbolDescriptiveString, context, value); | 59 assembler->CallRuntime(Runtime::kSymbolDescriptiveString, context, value); |
63 assembler.Return(result); | 60 assembler->Return(result); |
64 } | 61 } |
65 | 62 |
66 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) | 63 // ES6 section 19.4.3.3 Symbol.prototype.valueOf ( ) |
67 void Builtins::Generate_SymbolPrototypeValueOf( | 64 void Builtins::Generate_SymbolPrototypeValueOf(CodeStubAssembler* assembler) { |
68 compiler::CodeAssemblerState* state) { | |
69 typedef compiler::Node Node; | 65 typedef compiler::Node Node; |
70 CodeStubAssembler assembler(state); | |
71 | 66 |
72 Node* receiver = assembler.Parameter(0); | 67 Node* receiver = assembler->Parameter(0); |
73 Node* context = assembler.Parameter(3); | 68 Node* context = assembler->Parameter(3); |
74 | 69 |
75 Node* result = assembler.ToThisValue( | 70 Node* result = assembler->ToThisValue( |
76 context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.valueOf"); | 71 context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.valueOf"); |
77 assembler.Return(result); | 72 assembler->Return(result); |
78 } | 73 } |
79 | 74 |
80 } // namespace internal | 75 } // namespace internal |
81 } // namespace v8 | 76 } // namespace v8 |
OLD | NEW |