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 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/property-descriptor.h" | 9 #include "src/property-descriptor.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 Node* object = assembler->Parameter(0); | 22 Node* object = assembler->Parameter(0); |
23 Node* key = assembler->Parameter(1); | 23 Node* key = assembler->Parameter(1); |
24 Node* context = assembler->Parameter(4); | 24 Node* context = assembler->Parameter(4); |
25 | 25 |
26 Label call_runtime(assembler), return_true(assembler), | 26 Label call_runtime(assembler), return_true(assembler), |
27 return_false(assembler); | 27 return_false(assembler); |
28 | 28 |
29 // Smi receivers do not have own properties. | 29 // Smi receivers do not have own properties. |
30 Label if_objectisnotsmi(assembler); | 30 Label if_objectisnotsmi(assembler); |
31 assembler->Branch(assembler->WordIsSmi(object), &return_false, | 31 assembler->Branch(assembler->TaggedIsSmi(object), &return_false, |
32 &if_objectisnotsmi); | 32 &if_objectisnotsmi); |
33 assembler->Bind(&if_objectisnotsmi); | 33 assembler->Bind(&if_objectisnotsmi); |
34 | 34 |
35 Node* map = assembler->LoadMap(object); | 35 Node* map = assembler->LoadMap(object); |
36 Node* instance_type = assembler->LoadMapInstanceType(map); | 36 Node* instance_type = assembler->LoadMapInstanceType(map); |
37 | 37 |
38 Variable var_index(assembler, MachineType::PointerRepresentation()); | 38 Variable var_index(assembler, MachineType::PointerRepresentation()); |
39 | 39 |
40 Label keyisindex(assembler), if_iskeyunique(assembler); | 40 Label keyisindex(assembler), if_iskeyunique(assembler); |
41 assembler->TryToName(key, &keyisindex, &var_index, &if_iskeyunique, | 41 assembler->TryToName(key, &keyisindex, &var_index, &if_iskeyunique, |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 217 |
218 namespace { // anonymous namespace for ObjectProtoToString() | 218 namespace { // anonymous namespace for ObjectProtoToString() |
219 | 219 |
220 void IsString(CodeStubAssembler* assembler, compiler::Node* object, | 220 void IsString(CodeStubAssembler* assembler, compiler::Node* object, |
221 CodeStubAssembler::Label* if_string, | 221 CodeStubAssembler::Label* if_string, |
222 CodeStubAssembler::Label* if_notstring) { | 222 CodeStubAssembler::Label* if_notstring) { |
223 typedef compiler::Node Node; | 223 typedef compiler::Node Node; |
224 typedef CodeStubAssembler::Label Label; | 224 typedef CodeStubAssembler::Label Label; |
225 | 225 |
226 Label if_notsmi(assembler); | 226 Label if_notsmi(assembler); |
227 assembler->Branch(assembler->WordIsSmi(object), if_notstring, &if_notsmi); | 227 assembler->Branch(assembler->TaggedIsSmi(object), if_notstring, &if_notsmi); |
228 | 228 |
229 assembler->Bind(&if_notsmi); | 229 assembler->Bind(&if_notsmi); |
230 { | 230 { |
231 Node* instance_type = assembler->LoadInstanceType(object); | 231 Node* instance_type = assembler->LoadInstanceType(object); |
232 | 232 |
233 assembler->Branch(assembler->IsStringInstanceType(instance_type), if_string, | 233 assembler->Branch(assembler->IsStringInstanceType(instance_type), if_string, |
234 if_notstring); | 234 if_notstring); |
235 } | 235 } |
236 } | 236 } |
237 | 237 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 Node* receiver = assembler->Parameter(0); | 295 Node* receiver = assembler->Parameter(0); |
296 Node* context = assembler->Parameter(3); | 296 Node* context = assembler->Parameter(3); |
297 | 297 |
298 assembler->GotoIf( | 298 assembler->GotoIf( |
299 assembler->Word32Equal(receiver, assembler->UndefinedConstant()), | 299 assembler->Word32Equal(receiver, assembler->UndefinedConstant()), |
300 &return_undefined); | 300 &return_undefined); |
301 | 301 |
302 assembler->GotoIf(assembler->Word32Equal(receiver, assembler->NullConstant()), | 302 assembler->GotoIf(assembler->Word32Equal(receiver, assembler->NullConstant()), |
303 &return_null); | 303 &return_null); |
304 | 304 |
305 assembler->GotoIf(assembler->WordIsSmi(receiver), &return_number); | 305 assembler->GotoIf(assembler->TaggedIsSmi(receiver), &return_number); |
306 | 306 |
307 Node* receiver_instance_type = assembler->LoadInstanceType(receiver); | 307 Node* receiver_instance_type = assembler->LoadInstanceType(receiver); |
308 ReturnIfPrimitive(assembler, receiver_instance_type, &return_string, | 308 ReturnIfPrimitive(assembler, receiver_instance_type, &return_string, |
309 &return_boolean, &return_number); | 309 &return_boolean, &return_number); |
310 | 310 |
311 // for proxies, check IsArray before getting @@toStringTag | 311 // for proxies, check IsArray before getting @@toStringTag |
312 Variable var_proxy_is_array(assembler, MachineRepresentation::kTagged); | 312 Variable var_proxy_is_array(assembler, MachineRepresentation::kTagged); |
313 var_proxy_is_array.Bind(assembler->BooleanConstant(false)); | 313 var_proxy_is_array.Bind(assembler->BooleanConstant(false)); |
314 | 314 |
315 assembler->Branch( | 315 assembler->Branch( |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 assembler->Bind(&return_api); | 420 assembler->Bind(&return_api); |
421 { | 421 { |
422 Node* class_name = | 422 Node* class_name = |
423 assembler->CallRuntime(Runtime::kClassOf, context, receiver); | 423 assembler->CallRuntime(Runtime::kClassOf, context, receiver); |
424 ReturnToStringFormat(assembler, context, class_name); | 424 ReturnToStringFormat(assembler, context, class_name); |
425 } | 425 } |
426 | 426 |
427 assembler->Bind(&return_jsvalue); | 427 assembler->Bind(&return_jsvalue); |
428 { | 428 { |
429 Node* value = assembler->LoadJSValueValue(receiver); | 429 Node* value = assembler->LoadJSValueValue(receiver); |
430 assembler->GotoIf(assembler->WordIsSmi(value), &return_number); | 430 assembler->GotoIf(assembler->TaggedIsSmi(value), &return_number); |
431 | 431 |
432 ReturnIfPrimitive(assembler, assembler->LoadInstanceType(value), | 432 ReturnIfPrimitive(assembler, assembler->LoadInstanceType(value), |
433 &return_string, &return_boolean, &return_number); | 433 &return_string, &return_boolean, &return_number); |
434 assembler->Goto(&return_object); | 434 assembler->Goto(&return_object); |
435 } | 435 } |
436 | 436 |
437 assembler->Bind(&return_jsproxy); | 437 assembler->Bind(&return_jsproxy); |
438 { | 438 { |
439 assembler->GotoIf(assembler->WordEqual(var_proxy_is_array.value(), | 439 assembler->GotoIf(assembler->WordEqual(var_proxy_is_array.value(), |
440 assembler->BooleanConstant(true)), | 440 assembler->BooleanConstant(true)), |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 typedef CompareDescriptor Descriptor; | 934 typedef CompareDescriptor Descriptor; |
935 Node* object = assembler->Parameter(Descriptor::kLeft); | 935 Node* object = assembler->Parameter(Descriptor::kLeft); |
936 Node* callable = assembler->Parameter(Descriptor::kRight); | 936 Node* callable = assembler->Parameter(Descriptor::kRight); |
937 Node* context = assembler->Parameter(Descriptor::kContext); | 937 Node* context = assembler->Parameter(Descriptor::kContext); |
938 | 938 |
939 assembler->Return(assembler->InstanceOf(object, callable, context)); | 939 assembler->Return(assembler->InstanceOf(object, callable, context)); |
940 } | 940 } |
941 | 941 |
942 } // namespace internal | 942 } // namespace internal |
943 } // namespace v8 | 943 } // namespace v8 |
OLD | NEW |