Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: src/builtins/builtins-conversion-gen.cc

Issue 2752143004: [refactor] Separate generated builtins and C++ builtins into separate files (Closed)
Patch Set: tentative gcmole fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/builtins-conversion.cc ('k') | src/builtins/builtins-date.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-gen.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stub-assembler.h" 8 #include "src/code-stub-assembler.h"
9 #include "src/objects-inl.h" 9 #include "src/objects-inl.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 class ConversionBuiltinsAssembler : public CodeStubAssembler { 14 class ConversionBuiltinsAssembler : public CodeStubAssembler {
15 public: 15 public:
16 explicit ConversionBuiltinsAssembler(compiler::CodeAssemblerState* state) 16 explicit ConversionBuiltinsAssembler(compiler::CodeAssemblerState* state)
17 : CodeStubAssembler(state) {} 17 : CodeStubAssembler(state) {}
18 18
19 protected: 19 protected:
20 void Generate_NonPrimitiveToPrimitive(ToPrimitiveHint hint); 20 void Generate_NonPrimitiveToPrimitive(ToPrimitiveHint hint);
21 21
22 void Generate_OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint); 22 void Generate_OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint);
23 }; 23 };
24 24
25 Handle<Code> Builtins::NonPrimitiveToPrimitive(ToPrimitiveHint hint) {
26 switch (hint) {
27 case ToPrimitiveHint::kDefault:
28 return NonPrimitiveToPrimitive_Default();
29 case ToPrimitiveHint::kNumber:
30 return NonPrimitiveToPrimitive_Number();
31 case ToPrimitiveHint::kString:
32 return NonPrimitiveToPrimitive_String();
33 }
34 UNREACHABLE();
35 return Handle<Code>::null();
36 }
37
38 // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] ) 25 // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] )
39 void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive( 26 void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive(
40 ToPrimitiveHint hint) { 27 ToPrimitiveHint hint) {
41 Node* input = Parameter(TypeConversionDescriptor::kArgument); 28 Node* input = Parameter(TypeConversionDescriptor::kArgument);
42 Node* context = Parameter(TypeConversionDescriptor::kContext); 29 Node* context = Parameter(TypeConversionDescriptor::kContext);
43 30
44 // Lookup the @@toPrimitive property on the {input}. 31 // Lookup the @@toPrimitive property on the {input}.
45 Node* exotic_to_prim = 32 Node* exotic_to_prim =
46 GetProperty(context, input, factory()->to_primitive_symbol()); 33 GetProperty(context, input, factory()->to_primitive_symbol());
47 34
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 { 149 {
163 GotoIf(Word32NotEqual(input_instance_type, Int32Constant(ODDBALL_TYPE)), 150 GotoIf(Word32NotEqual(input_instance_type, Int32Constant(ODDBALL_TYPE)),
164 &runtime); 151 &runtime);
165 Return(LoadObjectField(input, Oddball::kToStringOffset)); 152 Return(LoadObjectField(input, Oddball::kToStringOffset));
166 } 153 }
167 154
168 Bind(&runtime); 155 Bind(&runtime);
169 { Return(CallRuntime(Runtime::kToString, context, input)); } 156 { Return(CallRuntime(Runtime::kToString, context, input)); }
170 } 157 }
171 158
172 Handle<Code> Builtins::OrdinaryToPrimitive(OrdinaryToPrimitiveHint hint) {
173 switch (hint) {
174 case OrdinaryToPrimitiveHint::kNumber:
175 return OrdinaryToPrimitive_Number();
176 case OrdinaryToPrimitiveHint::kString:
177 return OrdinaryToPrimitive_String();
178 }
179 UNREACHABLE();
180 return Handle<Code>::null();
181 }
182
183 // 7.1.1.1 OrdinaryToPrimitive ( O, hint ) 159 // 7.1.1.1 OrdinaryToPrimitive ( O, hint )
184 void ConversionBuiltinsAssembler::Generate_OrdinaryToPrimitive( 160 void ConversionBuiltinsAssembler::Generate_OrdinaryToPrimitive(
185 OrdinaryToPrimitiveHint hint) { 161 OrdinaryToPrimitiveHint hint) {
186 Node* input = Parameter(TypeConversionDescriptor::kArgument); 162 Node* input = Parameter(TypeConversionDescriptor::kArgument);
187 Node* context = Parameter(TypeConversionDescriptor::kContext); 163 Node* context = Parameter(TypeConversionDescriptor::kContext);
188 164
189 Variable var_result(this, MachineRepresentation::kTagged); 165 Variable var_result(this, MachineRepresentation::kTagged);
190 Label return_result(this, &var_result); 166 Label return_result(this, &var_result);
191 167
192 Handle<String> method_names[2]; 168 Handle<String> method_names[2];
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 378
403 // ES6 section 12.5.5 typeof operator 379 // ES6 section 12.5.5 typeof operator
404 TF_BUILTIN(Typeof, CodeStubAssembler) { 380 TF_BUILTIN(Typeof, CodeStubAssembler) {
405 Node* object = Parameter(TypeofDescriptor::kObject); 381 Node* object = Parameter(TypeofDescriptor::kObject);
406 382
407 Return(Typeof(object)); 383 Return(Typeof(object));
408 } 384 }
409 385
410 } // namespace internal 386 } // namespace internal
411 } // namespace v8 387 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-conversion.cc ('k') | src/builtins/builtins-date.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698