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

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

Issue 2172223002: [stubs] Call interface descriptors cleanup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@store-ic-tf
Patch Set: Addressing comments Created 4 years, 4 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 | « no previous file | src/builtins/builtins-handler.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.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 10 matching lines...) Expand all
21 UNREACHABLE(); 21 UNREACHABLE();
22 return Handle<Code>::null(); 22 return Handle<Code>::null();
23 } 23 }
24 24
25 namespace { 25 namespace {
26 // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] ) 26 // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] )
27 void Generate_NonPrimitiveToPrimitive(CodeStubAssembler* assembler, 27 void Generate_NonPrimitiveToPrimitive(CodeStubAssembler* assembler,
28 ToPrimitiveHint hint) { 28 ToPrimitiveHint hint) {
29 typedef CodeStubAssembler::Label Label; 29 typedef CodeStubAssembler::Label Label;
30 typedef compiler::Node Node; 30 typedef compiler::Node Node;
31 typedef TypeConversionDescriptor Descriptor;
31 32
32 Node* input = assembler->Parameter(0); 33 Node* input = assembler->Parameter(Descriptor::kArgument);
33 Node* context = assembler->Parameter(1); 34 Node* context = assembler->Parameter(Descriptor::kContext);
34 35
35 // Lookup the @@toPrimitive property on the {input}. 36 // Lookup the @@toPrimitive property on the {input}.
36 Callable callable = CodeFactory::GetProperty(assembler->isolate()); 37 Callable callable = CodeFactory::GetProperty(assembler->isolate());
37 Node* to_primitive_symbol = 38 Node* to_primitive_symbol =
38 assembler->HeapConstant(assembler->factory()->to_primitive_symbol()); 39 assembler->HeapConstant(assembler->factory()->to_primitive_symbol());
39 Node* exotic_to_prim = 40 Node* exotic_to_prim =
40 assembler->CallStub(callable, context, input, to_primitive_symbol); 41 assembler->CallStub(callable, context, input, to_primitive_symbol);
41 42
42 // Check if {exotic_to_prim} is neither null nor undefined. 43 // Check if {exotic_to_prim} is neither null nor undefined.
43 Label ordinary_to_primitive(assembler); 44 Label ordinary_to_primitive(assembler);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void Builtins::Generate_NonPrimitiveToPrimitive_String( 107 void Builtins::Generate_NonPrimitiveToPrimitive_String(
107 CodeStubAssembler* assembler) { 108 CodeStubAssembler* assembler) {
108 Generate_NonPrimitiveToPrimitive(assembler, ToPrimitiveHint::kString); 109 Generate_NonPrimitiveToPrimitive(assembler, ToPrimitiveHint::kString);
109 } 110 }
110 111
111 // ES6 section 7.1.3 ToNumber ( argument ) 112 // ES6 section 7.1.3 ToNumber ( argument )
112 void Builtins::Generate_NonNumberToNumber(CodeStubAssembler* assembler) { 113 void Builtins::Generate_NonNumberToNumber(CodeStubAssembler* assembler) {
113 typedef CodeStubAssembler::Label Label; 114 typedef CodeStubAssembler::Label Label;
114 typedef compiler::Node Node; 115 typedef compiler::Node Node;
115 typedef CodeStubAssembler::Variable Variable; 116 typedef CodeStubAssembler::Variable Variable;
117 typedef TypeConversionDescriptor Descriptor;
116 118
117 Node* input = assembler->Parameter(0); 119 Node* input = assembler->Parameter(Descriptor::kArgument);
118 Node* context = assembler->Parameter(1); 120 Node* context = assembler->Parameter(Descriptor::kContext);
119 121
120 // We might need to loop once here due to ToPrimitive conversions. 122 // We might need to loop once here due to ToPrimitive conversions.
121 Variable var_input(assembler, MachineRepresentation::kTagged); 123 Variable var_input(assembler, MachineRepresentation::kTagged);
122 Label loop(assembler, &var_input); 124 Label loop(assembler, &var_input);
123 var_input.Bind(input); 125 var_input.Bind(input);
124 assembler->Goto(&loop); 126 assembler->Goto(&loop);
125 assembler->Bind(&loop); 127 assembler->Bind(&loop);
126 { 128 {
127 // Load the current {input} value (known to be a HeapObject). 129 // Load the current {input} value (known to be a HeapObject).
128 Node* input = var_input.value(); 130 Node* input = var_input.value();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return Handle<Code>::null(); 219 return Handle<Code>::null();
218 } 220 }
219 221
220 namespace { 222 namespace {
221 // 7.1.1.1 OrdinaryToPrimitive ( O, hint ) 223 // 7.1.1.1 OrdinaryToPrimitive ( O, hint )
222 void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler, 224 void Generate_OrdinaryToPrimitive(CodeStubAssembler* assembler,
223 OrdinaryToPrimitiveHint hint) { 225 OrdinaryToPrimitiveHint hint) {
224 typedef CodeStubAssembler::Label Label; 226 typedef CodeStubAssembler::Label Label;
225 typedef compiler::Node Node; 227 typedef compiler::Node Node;
226 typedef CodeStubAssembler::Variable Variable; 228 typedef CodeStubAssembler::Variable Variable;
229 typedef TypeConversionDescriptor Descriptor;
227 230
228 Node* input = assembler->Parameter(0); 231 Node* input = assembler->Parameter(Descriptor::kArgument);
229 Node* context = assembler->Parameter(1); 232 Node* context = assembler->Parameter(Descriptor::kContext);
230 233
231 Variable var_result(assembler, MachineRepresentation::kTagged); 234 Variable var_result(assembler, MachineRepresentation::kTagged);
232 Label return_result(assembler, &var_result); 235 Label return_result(assembler, &var_result);
233 236
234 Handle<String> method_names[2]; 237 Handle<String> method_names[2];
235 switch (hint) { 238 switch (hint) {
236 case OrdinaryToPrimitiveHint::kNumber: 239 case OrdinaryToPrimitiveHint::kNumber:
237 method_names[0] = assembler->factory()->valueOf_string(); 240 method_names[0] = assembler->factory()->valueOf_string();
238 method_names[1] = assembler->factory()->toString_string(); 241 method_names[1] = assembler->factory()->toString_string();
239 break; 242 break;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 300
298 void Builtins::Generate_OrdinaryToPrimitive_String( 301 void Builtins::Generate_OrdinaryToPrimitive_String(
299 CodeStubAssembler* assembler) { 302 CodeStubAssembler* assembler) {
300 Generate_OrdinaryToPrimitive(assembler, OrdinaryToPrimitiveHint::kString); 303 Generate_OrdinaryToPrimitive(assembler, OrdinaryToPrimitiveHint::kString);
301 } 304 }
302 305
303 // ES6 section 7.1.2 ToBoolean ( argument ) 306 // ES6 section 7.1.2 ToBoolean ( argument )
304 void Builtins::Generate_ToBoolean(CodeStubAssembler* assembler) { 307 void Builtins::Generate_ToBoolean(CodeStubAssembler* assembler) {
305 typedef compiler::Node Node; 308 typedef compiler::Node Node;
306 typedef CodeStubAssembler::Label Label; 309 typedef CodeStubAssembler::Label Label;
310 typedef TypeConversionDescriptor Descriptor;
307 311
308 Node* value = assembler->Parameter(0); 312 Node* value = assembler->Parameter(Descriptor::kArgument);
309 313
310 Label return_true(assembler), return_false(assembler); 314 Label return_true(assembler), return_false(assembler);
311 assembler->BranchIfToBooleanIsTrue(value, &return_true, &return_false); 315 assembler->BranchIfToBooleanIsTrue(value, &return_true, &return_false);
312 316
313 assembler->Bind(&return_true); 317 assembler->Bind(&return_true);
314 assembler->Return(assembler->BooleanConstant(true)); 318 assembler->Return(assembler->BooleanConstant(true));
315 319
316 assembler->Bind(&return_false); 320 assembler->Bind(&return_false);
317 assembler->Return(assembler->BooleanConstant(false)); 321 assembler->Return(assembler->BooleanConstant(false));
318 } 322 }
319 323
320 } // namespace internal 324 } // namespace internal
321 } // namespace v8 325 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins-handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698