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

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

Issue 2751363002: [csa] Replace remaining old-style GetProperty calls (Closed)
Patch Set: 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-array.cc ('k') | src/builtins/builtins-promise.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.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
(...skipping 24 matching lines...) Expand all
35 return Handle<Code>::null(); 35 return Handle<Code>::null();
36 } 36 }
37 37
38 // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] ) 38 // ES6 section 7.1.1 ToPrimitive ( input [ , PreferredType ] )
39 void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive( 39 void ConversionBuiltinsAssembler::Generate_NonPrimitiveToPrimitive(
40 ToPrimitiveHint hint) { 40 ToPrimitiveHint hint) {
41 Node* input = Parameter(TypeConversionDescriptor::kArgument); 41 Node* input = Parameter(TypeConversionDescriptor::kArgument);
42 Node* context = Parameter(TypeConversionDescriptor::kContext); 42 Node* context = Parameter(TypeConversionDescriptor::kContext);
43 43
44 // Lookup the @@toPrimitive property on the {input}. 44 // Lookup the @@toPrimitive property on the {input}.
45 Callable callable = CodeFactory::GetProperty(isolate());
46 Node* to_primitive_symbol = HeapConstant(factory()->to_primitive_symbol());
47 Node* exotic_to_prim = 45 Node* exotic_to_prim =
48 CallStub(callable, context, input, to_primitive_symbol); 46 GetProperty(context, input, factory()->to_primitive_symbol());
49 47
50 // Check if {exotic_to_prim} is neither null nor undefined. 48 // Check if {exotic_to_prim} is neither null nor undefined.
51 Label ordinary_to_primitive(this); 49 Label ordinary_to_primitive(this);
52 GotoIf(WordEqual(exotic_to_prim, NullConstant()), &ordinary_to_primitive); 50 GotoIf(WordEqual(exotic_to_prim, NullConstant()), &ordinary_to_primitive);
53 GotoIf(WordEqual(exotic_to_prim, UndefinedConstant()), 51 GotoIf(WordEqual(exotic_to_prim, UndefinedConstant()),
54 &ordinary_to_primitive); 52 &ordinary_to_primitive);
55 { 53 {
56 // Invoke the {exotic_to_prim} method on the {input} with a string 54 // Invoke the {exotic_to_prim} method on the {input} with a string
57 // representation of the {hint}. 55 // representation of the {hint}.
58 Callable callable = 56 Callable callable =
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 method_names[0] = factory()->valueOf_string(); 195 method_names[0] = factory()->valueOf_string();
198 method_names[1] = factory()->toString_string(); 196 method_names[1] = factory()->toString_string();
199 break; 197 break;
200 case OrdinaryToPrimitiveHint::kString: 198 case OrdinaryToPrimitiveHint::kString:
201 method_names[0] = factory()->toString_string(); 199 method_names[0] = factory()->toString_string();
202 method_names[1] = factory()->valueOf_string(); 200 method_names[1] = factory()->valueOf_string();
203 break; 201 break;
204 } 202 }
205 for (Handle<String> name : method_names) { 203 for (Handle<String> name : method_names) {
206 // Lookup the {name} on the {input}. 204 // Lookup the {name} on the {input}.
207 Callable callable = CodeFactory::GetProperty(isolate()); 205 Node* method = GetProperty(context, input, name);
208 Node* name_string = HeapConstant(name);
209 Node* method = CallStub(callable, context, input, name_string);
210 206
211 // Check if the {method} is callable. 207 // Check if the {method} is callable.
212 Label if_methodiscallable(this), 208 Label if_methodiscallable(this),
213 if_methodisnotcallable(this, Label::kDeferred); 209 if_methodisnotcallable(this, Label::kDeferred);
214 GotoIf(TaggedIsSmi(method), &if_methodisnotcallable); 210 GotoIf(TaggedIsSmi(method), &if_methodisnotcallable);
215 Node* method_map = LoadMap(method); 211 Node* method_map = LoadMap(method);
216 Branch(IsCallableMap(method_map), &if_methodiscallable, 212 Branch(IsCallableMap(method_map), &if_methodiscallable,
217 &if_methodisnotcallable); 213 &if_methodisnotcallable);
218 214
219 Bind(&if_methodiscallable); 215 Bind(&if_methodiscallable);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 402
407 // ES6 section 12.5.5 typeof operator 403 // ES6 section 12.5.5 typeof operator
408 TF_BUILTIN(Typeof, CodeStubAssembler) { 404 TF_BUILTIN(Typeof, CodeStubAssembler) {
409 Node* object = Parameter(TypeofDescriptor::kObject); 405 Node* object = Parameter(TypeofDescriptor::kObject);
410 406
411 Return(Typeof(object)); 407 Return(Typeof(object));
412 } 408 }
413 409
414 } // namespace internal 410 } // namespace internal
415 } // namespace v8 411 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-array.cc ('k') | src/builtins/builtins-promise.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698