OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/code-stubs.h" | 5 #include "src/code-stubs.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
11 #include "src/compiler/code-stub-assembler.h" | 11 #include "src/code-stub-assembler.h" |
12 #include "src/factory.h" | 12 #include "src/factory.h" |
13 #include "src/gdb-jit.h" | 13 #include "src/gdb-jit.h" |
14 #include "src/ic/handler-compiler.h" | 14 #include "src/ic/handler-compiler.h" |
15 #include "src/ic/ic.h" | 15 #include "src/ic/ic.h" |
16 #include "src/macro-assembler.h" | 16 #include "src/macro-assembler.h" |
17 #include "src/parsing/parser.h" | 17 #include "src/parsing/parser.h" |
18 #include "src/profiler/cpu-profiler.h" | 18 #include "src/profiler/cpu-profiler.h" |
19 | 19 |
20 namespace v8 { | 20 namespace v8 { |
21 namespace internal { | 21 namespace internal { |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 GenerateGeneric(masm); | 441 GenerateGeneric(masm); |
442 break; | 442 break; |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 | 446 |
447 Handle<Code> TurboFanCodeStub::GenerateCode() { | 447 Handle<Code> TurboFanCodeStub::GenerateCode() { |
448 const char* name = CodeStub::MajorName(MajorKey()); | 448 const char* name = CodeStub::MajorName(MajorKey()); |
449 Zone zone(isolate()->allocator()); | 449 Zone zone(isolate()->allocator()); |
450 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor()); | 450 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor()); |
451 compiler::CodeStubAssembler assembler(isolate(), &zone, descriptor, | 451 CodeStubAssembler assembler(isolate(), &zone, descriptor, GetCodeFlags(), |
452 GetCodeFlags(), name); | 452 name); |
453 GenerateAssembly(&assembler); | 453 GenerateAssembly(&assembler); |
454 return assembler.GenerateCode(); | 454 return assembler.GenerateCode(); |
455 } | 455 } |
456 | 456 |
457 void AllocateHeapNumberStub::GenerateAssembly( | 457 void AllocateHeapNumberStub::GenerateAssembly( |
458 compiler::CodeStubAssembler* assembler) const { | 458 CodeStubAssembler* assembler) const { |
459 typedef compiler::Node Node; | 459 typedef compiler::Node Node; |
460 | 460 |
461 Node* result = assembler->AllocateHeapNumber(); | 461 Node* result = assembler->AllocateHeapNumber(); |
462 assembler->Return(result); | 462 assembler->Return(result); |
463 } | 463 } |
464 | 464 |
465 void AllocateMutableHeapNumberStub::GenerateAssembly( | 465 void AllocateMutableHeapNumberStub::GenerateAssembly( |
466 compiler::CodeStubAssembler* assembler) const { | 466 CodeStubAssembler* assembler) const { |
467 typedef compiler::Node Node; | 467 typedef compiler::Node Node; |
468 | 468 |
469 Node* result = assembler->Allocate(HeapNumber::kSize); | 469 Node* result = assembler->Allocate(HeapNumber::kSize); |
470 assembler->StoreMapNoWriteBarrier( | 470 assembler->StoreMapNoWriteBarrier( |
471 result, | 471 result, |
472 assembler->HeapConstant(isolate()->factory()->mutable_heap_number_map())); | 472 assembler->HeapConstant(isolate()->factory()->mutable_heap_number_map())); |
473 assembler->Return(result); | 473 assembler->Return(result); |
474 } | 474 } |
475 | 475 |
476 #define SIMD128_GEN_ASM(TYPE, Type, type, lane_count, lane_type) \ | 476 #define SIMD128_GEN_ASM(TYPE, Type, type, lane_count, lane_type) \ |
477 void Allocate##Type##Stub::GenerateAssembly( \ | 477 void Allocate##Type##Stub::GenerateAssembly(CodeStubAssembler* assembler) \ |
478 compiler::CodeStubAssembler* assembler) const { \ | 478 const { \ |
479 compiler::Node* result = assembler->Allocate( \ | 479 compiler::Node* result = \ |
480 Simd128Value::kSize, compiler::CodeStubAssembler::kNone); \ | 480 assembler->Allocate(Simd128Value::kSize, CodeStubAssembler::kNone); \ |
481 compiler::Node* map_offset = \ | 481 compiler::Node* map_offset = \ |
482 assembler->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag); \ | 482 assembler->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag); \ |
483 compiler::Node* map = assembler->IntPtrAdd(result, map_offset); \ | 483 compiler::Node* map = assembler->IntPtrAdd(result, map_offset); \ |
484 assembler->StoreNoWriteBarrier( \ | 484 assembler->StoreNoWriteBarrier( \ |
485 MachineRepresentation::kTagged, map, \ | 485 MachineRepresentation::kTagged, map, \ |
486 assembler->HeapConstant(isolate()->factory()->type##_map())); \ | 486 assembler->HeapConstant(isolate()->factory()->type##_map())); \ |
487 assembler->Return(result); \ | 487 assembler->Return(result); \ |
488 } | 488 } |
489 SIMD128_TYPES(SIMD128_GEN_ASM) | 489 SIMD128_TYPES(SIMD128_GEN_ASM) |
490 #undef SIMD128_GEN_ASM | 490 #undef SIMD128_GEN_ASM |
491 | 491 |
492 void StringLengthStub::GenerateAssembly( | 492 void StringLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
493 compiler::CodeStubAssembler* assembler) const { | |
494 compiler::Node* value = assembler->Parameter(0); | 493 compiler::Node* value = assembler->Parameter(0); |
495 compiler::Node* string = | 494 compiler::Node* string = |
496 assembler->LoadObjectField(value, JSValue::kValueOffset); | 495 assembler->LoadObjectField(value, JSValue::kValueOffset); |
497 compiler::Node* result = | 496 compiler::Node* result = |
498 assembler->LoadObjectField(string, String::kLengthOffset); | 497 assembler->LoadObjectField(string, String::kLengthOffset); |
499 assembler->Return(result); | 498 assembler->Return(result); |
500 } | 499 } |
501 | 500 |
502 void AddStub::GenerateAssembly(compiler::CodeStubAssembler* assembler) const { | 501 void AddStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
503 typedef compiler::CodeStubAssembler::Label Label; | 502 typedef CodeStubAssembler::Label Label; |
504 typedef compiler::Node Node; | 503 typedef compiler::Node Node; |
505 typedef compiler::CodeStubAssembler::Variable Variable; | 504 typedef CodeStubAssembler::Variable Variable; |
506 | 505 |
507 Node* context = assembler->Parameter(2); | 506 Node* context = assembler->Parameter(2); |
508 | 507 |
509 // Shared entry for floating point addition. | 508 // Shared entry for floating point addition. |
510 Label do_fadd(assembler); | 509 Label do_fadd(assembler); |
511 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64), | 510 Variable var_fadd_lhs(assembler, MachineRepresentation::kFloat64), |
512 var_fadd_rhs(assembler, MachineRepresentation::kFloat64); | 511 var_fadd_rhs(assembler, MachineRepresentation::kFloat64); |
513 | 512 |
514 // We might need to loop several times due to ToPrimitive, ToString and/or | 513 // We might need to loop several times due to ToPrimitive, ToString and/or |
515 // ToNumber conversions. | 514 // ToNumber conversions. |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 assembler->Bind(&do_fadd); | 847 assembler->Bind(&do_fadd); |
849 { | 848 { |
850 Node* lhs_value = var_fadd_lhs.value(); | 849 Node* lhs_value = var_fadd_lhs.value(); |
851 Node* rhs_value = var_fadd_rhs.value(); | 850 Node* rhs_value = var_fadd_rhs.value(); |
852 Node* value = assembler->Float64Add(lhs_value, rhs_value); | 851 Node* value = assembler->Float64Add(lhs_value, rhs_value); |
853 Node* result = assembler->ChangeFloat64ToTagged(value); | 852 Node* result = assembler->ChangeFloat64ToTagged(value); |
854 assembler->Return(result); | 853 assembler->Return(result); |
855 } | 854 } |
856 } | 855 } |
857 | 856 |
858 void SubtractStub::GenerateAssembly( | 857 void SubtractStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
859 compiler::CodeStubAssembler* assembler) const { | 858 typedef CodeStubAssembler::Label Label; |
860 typedef compiler::CodeStubAssembler::Label Label; | |
861 typedef compiler::Node Node; | 859 typedef compiler::Node Node; |
862 typedef compiler::CodeStubAssembler::Variable Variable; | 860 typedef CodeStubAssembler::Variable Variable; |
863 | 861 |
864 Node* context = assembler->Parameter(2); | 862 Node* context = assembler->Parameter(2); |
865 | 863 |
866 // Shared entry for floating point subtraction. | 864 // Shared entry for floating point subtraction. |
867 Label do_fsub(assembler); | 865 Label do_fsub(assembler); |
868 Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64), | 866 Variable var_fsub_lhs(assembler, MachineRepresentation::kFloat64), |
869 var_fsub_rhs(assembler, MachineRepresentation::kFloat64); | 867 var_fsub_rhs(assembler, MachineRepresentation::kFloat64); |
870 | 868 |
871 // We might need to loop several times due to ToPrimitive and/or ToNumber | 869 // We might need to loop several times due to ToPrimitive and/or ToNumber |
872 // conversions. | 870 // conversions. |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 assembler->Bind(&do_fsub); | 1013 assembler->Bind(&do_fsub); |
1016 { | 1014 { |
1017 Node* lhs_value = var_fsub_lhs.value(); | 1015 Node* lhs_value = var_fsub_lhs.value(); |
1018 Node* rhs_value = var_fsub_rhs.value(); | 1016 Node* rhs_value = var_fsub_rhs.value(); |
1019 Node* value = assembler->Float64Sub(lhs_value, rhs_value); | 1017 Node* value = assembler->Float64Sub(lhs_value, rhs_value); |
1020 Node* result = assembler->ChangeFloat64ToTagged(value); | 1018 Node* result = assembler->ChangeFloat64ToTagged(value); |
1021 assembler->Return(result); | 1019 assembler->Return(result); |
1022 } | 1020 } |
1023 } | 1021 } |
1024 | 1022 |
1025 void MultiplyStub::GenerateAssembly( | 1023 void MultiplyStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
1026 compiler::CodeStubAssembler* assembler) const { | |
1027 using compiler::Node; | 1024 using compiler::Node; |
1028 typedef compiler::CodeStubAssembler::Label Label; | 1025 typedef CodeStubAssembler::Label Label; |
1029 typedef compiler::CodeStubAssembler::Variable Variable; | 1026 typedef CodeStubAssembler::Variable Variable; |
1030 | 1027 |
1031 Node* context = assembler->Parameter(2); | 1028 Node* context = assembler->Parameter(2); |
1032 | 1029 |
1033 // Shared entry point for floating point multiplication. | 1030 // Shared entry point for floating point multiplication. |
1034 Label do_fmul(assembler); | 1031 Label do_fmul(assembler); |
1035 Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64), | 1032 Variable var_lhs_float64(assembler, MachineRepresentation::kFloat64), |
1036 var_rhs_float64(assembler, MachineRepresentation::kFloat64); | 1033 var_rhs_float64(assembler, MachineRepresentation::kFloat64); |
1037 | 1034 |
1038 Node* number_map = assembler->HeapNumberMapConstant(); | 1035 Node* number_map = assembler->HeapNumberMapConstant(); |
1039 | 1036 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 | 1159 |
1163 assembler->Bind(&do_fmul); | 1160 assembler->Bind(&do_fmul); |
1164 { | 1161 { |
1165 Node* value = | 1162 Node* value = |
1166 assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value()); | 1163 assembler->Float64Mul(var_lhs_float64.value(), var_rhs_float64.value()); |
1167 Node* result = assembler->ChangeFloat64ToTagged(value); | 1164 Node* result = assembler->ChangeFloat64ToTagged(value); |
1168 assembler->Return(result); | 1165 assembler->Return(result); |
1169 } | 1166 } |
1170 } | 1167 } |
1171 | 1168 |
1172 void DivideStub::GenerateAssembly( | 1169 void DivideStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
1173 compiler::CodeStubAssembler* assembler) const { | |
1174 using compiler::Node; | 1170 using compiler::Node; |
1175 typedef compiler::CodeStubAssembler::Label Label; | 1171 typedef CodeStubAssembler::Label Label; |
1176 typedef compiler::CodeStubAssembler::Variable Variable; | 1172 typedef CodeStubAssembler::Variable Variable; |
1177 | 1173 |
1178 Node* context = assembler->Parameter(2); | 1174 Node* context = assembler->Parameter(2); |
1179 | 1175 |
1180 // Shared entry point for floating point division. | 1176 // Shared entry point for floating point division. |
1181 Label do_fdiv(assembler); | 1177 Label do_fdiv(assembler); |
1182 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), | 1178 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), |
1183 var_divisor_float64(assembler, MachineRepresentation::kFloat64); | 1179 var_divisor_float64(assembler, MachineRepresentation::kFloat64); |
1184 | 1180 |
1185 Node* number_map = assembler->HeapNumberMapConstant(); | 1181 Node* number_map = assembler->HeapNumberMapConstant(); |
1186 | 1182 |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1372 | 1368 |
1373 assembler->Bind(&do_fdiv); | 1369 assembler->Bind(&do_fdiv); |
1374 { | 1370 { |
1375 Node* value = assembler->Float64Div(var_dividend_float64.value(), | 1371 Node* value = assembler->Float64Div(var_dividend_float64.value(), |
1376 var_divisor_float64.value()); | 1372 var_divisor_float64.value()); |
1377 Node* result = assembler->ChangeFloat64ToTagged(value); | 1373 Node* result = assembler->ChangeFloat64ToTagged(value); |
1378 assembler->Return(result); | 1374 assembler->Return(result); |
1379 } | 1375 } |
1380 } | 1376 } |
1381 | 1377 |
1382 void BitwiseAndStub::GenerateAssembly( | 1378 void BitwiseAndStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
1383 compiler::CodeStubAssembler* assembler) const { | |
1384 using compiler::Node; | 1379 using compiler::Node; |
1385 | 1380 |
1386 Node* lhs = assembler->Parameter(0); | 1381 Node* lhs = assembler->Parameter(0); |
1387 Node* rhs = assembler->Parameter(1); | 1382 Node* rhs = assembler->Parameter(1); |
1388 Node* context = assembler->Parameter(2); | 1383 Node* context = assembler->Parameter(2); |
1389 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); | 1384 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); |
1390 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); | 1385 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); |
1391 Node* value = assembler->Word32And(lhs_value, rhs_value); | 1386 Node* value = assembler->Word32And(lhs_value, rhs_value); |
1392 Node* result = assembler->ChangeInt32ToTagged(value); | 1387 Node* result = assembler->ChangeInt32ToTagged(value); |
1393 assembler->Return(result); | 1388 assembler->Return(result); |
1394 } | 1389 } |
1395 | 1390 |
1396 void ModulusStub::GenerateAssembly( | 1391 void ModulusStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
1397 compiler::CodeStubAssembler* assembler) const { | |
1398 using compiler::Node; | 1392 using compiler::Node; |
1399 typedef compiler::CodeStubAssembler::Label Label; | 1393 typedef CodeStubAssembler::Label Label; |
1400 typedef compiler::CodeStubAssembler::Variable Variable; | 1394 typedef CodeStubAssembler::Variable Variable; |
1401 | 1395 |
1402 Node* context = assembler->Parameter(2); | 1396 Node* context = assembler->Parameter(2); |
1403 | 1397 |
1404 // Shared entry point for floating point modulus. | 1398 // Shared entry point for floating point modulus. |
1405 Label do_fmod(assembler); | 1399 Label do_fmod(assembler); |
1406 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), | 1400 Variable var_dividend_float64(assembler, MachineRepresentation::kFloat64), |
1407 var_divisor_float64(assembler, MachineRepresentation::kFloat64); | 1401 var_divisor_float64(assembler, MachineRepresentation::kFloat64); |
1408 | 1402 |
1409 Node* number_map = assembler->HeapNumberMapConstant(); | 1403 Node* number_map = assembler->HeapNumberMapConstant(); |
1410 | 1404 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 | 1529 |
1536 assembler->Bind(&do_fmod); | 1530 assembler->Bind(&do_fmod); |
1537 { | 1531 { |
1538 Node* value = assembler->Float64Mod(var_dividend_float64.value(), | 1532 Node* value = assembler->Float64Mod(var_dividend_float64.value(), |
1539 var_divisor_float64.value()); | 1533 var_divisor_float64.value()); |
1540 Node* result = assembler->ChangeFloat64ToTagged(value); | 1534 Node* result = assembler->ChangeFloat64ToTagged(value); |
1541 assembler->Return(result); | 1535 assembler->Return(result); |
1542 } | 1536 } |
1543 } | 1537 } |
1544 | 1538 |
1545 void ShiftLeftStub::GenerateAssembly( | 1539 void ShiftLeftStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
1546 compiler::CodeStubAssembler* assembler) const { | |
1547 using compiler::Node; | 1540 using compiler::Node; |
1548 | 1541 |
1549 Node* lhs = assembler->Parameter(0); | 1542 Node* lhs = assembler->Parameter(0); |
1550 Node* rhs = assembler->Parameter(1); | 1543 Node* rhs = assembler->Parameter(1); |
1551 Node* context = assembler->Parameter(2); | 1544 Node* context = assembler->Parameter(2); |
1552 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); | 1545 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); |
1553 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); | 1546 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); |
1554 Node* shift_count = | 1547 Node* shift_count = |
1555 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); | 1548 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); |
1556 Node* value = assembler->Word32Shl(lhs_value, shift_count); | 1549 Node* value = assembler->Word32Shl(lhs_value, shift_count); |
1557 Node* result = assembler->ChangeInt32ToTagged(value); | 1550 Node* result = assembler->ChangeInt32ToTagged(value); |
1558 assembler->Return(result); | 1551 assembler->Return(result); |
1559 } | 1552 } |
1560 | 1553 |
1561 void ShiftRightStub::GenerateAssembly( | 1554 void ShiftRightStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
1562 compiler::CodeStubAssembler* assembler) const { | |
1563 using compiler::Node; | 1555 using compiler::Node; |
1564 | 1556 |
1565 Node* lhs = assembler->Parameter(0); | 1557 Node* lhs = assembler->Parameter(0); |
1566 Node* rhs = assembler->Parameter(1); | 1558 Node* rhs = assembler->Parameter(1); |
1567 Node* context = assembler->Parameter(2); | 1559 Node* context = assembler->Parameter(2); |
1568 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); | 1560 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); |
1569 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); | 1561 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); |
1570 Node* shift_count = | 1562 Node* shift_count = |
1571 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); | 1563 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); |
1572 Node* value = assembler->Word32Sar(lhs_value, shift_count); | 1564 Node* value = assembler->Word32Sar(lhs_value, shift_count); |
1573 Node* result = assembler->ChangeInt32ToTagged(value); | 1565 Node* result = assembler->ChangeInt32ToTagged(value); |
1574 assembler->Return(result); | 1566 assembler->Return(result); |
1575 } | 1567 } |
1576 | 1568 |
1577 void ShiftRightLogicalStub::GenerateAssembly( | 1569 void ShiftRightLogicalStub::GenerateAssembly( |
1578 compiler::CodeStubAssembler* assembler) const { | 1570 CodeStubAssembler* assembler) const { |
1579 using compiler::Node; | 1571 using compiler::Node; |
1580 | 1572 |
1581 Node* lhs = assembler->Parameter(0); | 1573 Node* lhs = assembler->Parameter(0); |
1582 Node* rhs = assembler->Parameter(1); | 1574 Node* rhs = assembler->Parameter(1); |
1583 Node* context = assembler->Parameter(2); | 1575 Node* context = assembler->Parameter(2); |
1584 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); | 1576 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); |
1585 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); | 1577 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); |
1586 Node* shift_count = | 1578 Node* shift_count = |
1587 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); | 1579 assembler->Word32And(rhs_value, assembler->Int32Constant(0x1f)); |
1588 Node* value = assembler->Word32Shr(lhs_value, shift_count); | 1580 Node* value = assembler->Word32Shr(lhs_value, shift_count); |
1589 Node* result = assembler->ChangeUint32ToTagged(value); | 1581 Node* result = assembler->ChangeUint32ToTagged(value); |
1590 assembler->Return(result); | 1582 assembler->Return(result); |
1591 } | 1583 } |
1592 | 1584 |
1593 void BitwiseOrStub::GenerateAssembly( | 1585 void BitwiseOrStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
1594 compiler::CodeStubAssembler* assembler) const { | |
1595 using compiler::Node; | 1586 using compiler::Node; |
1596 | 1587 |
1597 Node* lhs = assembler->Parameter(0); | 1588 Node* lhs = assembler->Parameter(0); |
1598 Node* rhs = assembler->Parameter(1); | 1589 Node* rhs = assembler->Parameter(1); |
1599 Node* context = assembler->Parameter(2); | 1590 Node* context = assembler->Parameter(2); |
1600 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); | 1591 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); |
1601 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); | 1592 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); |
1602 Node* value = assembler->Word32Or(lhs_value, rhs_value); | 1593 Node* value = assembler->Word32Or(lhs_value, rhs_value); |
1603 Node* result = assembler->ChangeInt32ToTagged(value); | 1594 Node* result = assembler->ChangeInt32ToTagged(value); |
1604 assembler->Return(result); | 1595 assembler->Return(result); |
1605 } | 1596 } |
1606 | 1597 |
1607 void BitwiseXorStub::GenerateAssembly( | 1598 void BitwiseXorStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
1608 compiler::CodeStubAssembler* assembler) const { | |
1609 using compiler::Node; | 1599 using compiler::Node; |
1610 | 1600 |
1611 Node* lhs = assembler->Parameter(0); | 1601 Node* lhs = assembler->Parameter(0); |
1612 Node* rhs = assembler->Parameter(1); | 1602 Node* rhs = assembler->Parameter(1); |
1613 Node* context = assembler->Parameter(2); | 1603 Node* context = assembler->Parameter(2); |
1614 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); | 1604 Node* lhs_value = assembler->TruncateTaggedToWord32(context, lhs); |
1615 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); | 1605 Node* rhs_value = assembler->TruncateTaggedToWord32(context, rhs); |
1616 Node* value = assembler->Word32Xor(lhs_value, rhs_value); | 1606 Node* value = assembler->Word32Xor(lhs_value, rhs_value); |
1617 Node* result = assembler->ChangeInt32ToTagged(value); | 1607 Node* result = assembler->ChangeInt32ToTagged(value); |
1618 assembler->Return(result); | 1608 assembler->Return(result); |
1619 } | 1609 } |
1620 | 1610 |
1621 namespace { | 1611 namespace { |
1622 | 1612 |
1623 enum RelationalComparisonMode { | 1613 enum RelationalComparisonMode { |
1624 kLessThan, | 1614 kLessThan, |
1625 kLessThanOrEqual, | 1615 kLessThanOrEqual, |
1626 kGreaterThan, | 1616 kGreaterThan, |
1627 kGreaterThanOrEqual | 1617 kGreaterThanOrEqual |
1628 }; | 1618 }; |
1629 | 1619 |
1630 void GenerateAbstractRelationalComparison( | 1620 void GenerateAbstractRelationalComparison(CodeStubAssembler* assembler, |
1631 compiler::CodeStubAssembler* assembler, RelationalComparisonMode mode) { | 1621 RelationalComparisonMode mode) { |
1632 typedef compiler::CodeStubAssembler::Label Label; | 1622 typedef CodeStubAssembler::Label Label; |
1633 typedef compiler::Node Node; | 1623 typedef compiler::Node Node; |
1634 typedef compiler::CodeStubAssembler::Variable Variable; | 1624 typedef CodeStubAssembler::Variable Variable; |
1635 | 1625 |
1636 Node* context = assembler->Parameter(2); | 1626 Node* context = assembler->Parameter(2); |
1637 | 1627 |
1638 Label return_true(assembler), return_false(assembler); | 1628 Label return_true(assembler), return_false(assembler); |
1639 | 1629 |
1640 // Shared entry for floating point comparison. | 1630 // Shared entry for floating point comparison. |
1641 Label do_fcmp(assembler); | 1631 Label do_fcmp(assembler); |
1642 Variable var_fcmp_lhs(assembler, MachineRepresentation::kFloat64), | 1632 Variable var_fcmp_lhs(assembler, MachineRepresentation::kFloat64), |
1643 var_fcmp_rhs(assembler, MachineRepresentation::kFloat64); | 1633 var_fcmp_rhs(assembler, MachineRepresentation::kFloat64); |
1644 | 1634 |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 | 1953 |
1964 assembler->Bind(&return_true); | 1954 assembler->Bind(&return_true); |
1965 assembler->Return(assembler->BooleanConstant(true)); | 1955 assembler->Return(assembler->BooleanConstant(true)); |
1966 | 1956 |
1967 assembler->Bind(&return_false); | 1957 assembler->Bind(&return_false); |
1968 assembler->Return(assembler->BooleanConstant(false)); | 1958 assembler->Return(assembler->BooleanConstant(false)); |
1969 } | 1959 } |
1970 | 1960 |
1971 enum ResultMode { kDontNegateResult, kNegateResult }; | 1961 enum ResultMode { kDontNegateResult, kNegateResult }; |
1972 | 1962 |
1973 void GenerateEqual_Same(compiler::CodeStubAssembler* assembler, | 1963 void GenerateEqual_Same(CodeStubAssembler* assembler, compiler::Node* value, |
1974 compiler::Node* value, | 1964 CodeStubAssembler::Label* if_equal, |
1975 compiler::CodeStubAssembler::Label* if_equal, | 1965 CodeStubAssembler::Label* if_notequal) { |
1976 compiler::CodeStubAssembler::Label* if_notequal) { | |
1977 // In case of abstract or strict equality checks, we need additional checks | 1966 // In case of abstract or strict equality checks, we need additional checks |
1978 // for NaN values because they are not considered equal, even if both the | 1967 // for NaN values because they are not considered equal, even if both the |
1979 // left and the right hand side reference exactly the same value. | 1968 // left and the right hand side reference exactly the same value. |
1980 // TODO(bmeurer): This seems to violate the SIMD.js specification, but it | 1969 // TODO(bmeurer): This seems to violate the SIMD.js specification, but it |
1981 // seems to be what is tested in the current SIMD.js testsuite. | 1970 // seems to be what is tested in the current SIMD.js testsuite. |
1982 | 1971 |
1983 typedef compiler::CodeStubAssembler::Label Label; | 1972 typedef CodeStubAssembler::Label Label; |
1984 typedef compiler::Node Node; | 1973 typedef compiler::Node Node; |
1985 | 1974 |
1986 // Check if {value} is a Smi or a HeapObject. | 1975 // Check if {value} is a Smi or a HeapObject. |
1987 Label if_valueissmi(assembler), if_valueisnotsmi(assembler); | 1976 Label if_valueissmi(assembler), if_valueisnotsmi(assembler); |
1988 assembler->Branch(assembler->WordIsSmi(value), &if_valueissmi, | 1977 assembler->Branch(assembler->WordIsSmi(value), &if_valueissmi, |
1989 &if_valueisnotsmi); | 1978 &if_valueisnotsmi); |
1990 | 1979 |
1991 assembler->Bind(&if_valueisnotsmi); | 1980 assembler->Bind(&if_valueisnotsmi); |
1992 { | 1981 { |
1993 // Load the map of {value}. | 1982 // Load the map of {value}. |
(...skipping 16 matching lines...) Expand all Loading... |
2010 | 1999 |
2011 assembler->Bind(&if_valueisnotnumber); | 2000 assembler->Bind(&if_valueisnotnumber); |
2012 assembler->Goto(if_equal); | 2001 assembler->Goto(if_equal); |
2013 } | 2002 } |
2014 | 2003 |
2015 assembler->Bind(&if_valueissmi); | 2004 assembler->Bind(&if_valueissmi); |
2016 assembler->Goto(if_equal); | 2005 assembler->Goto(if_equal); |
2017 } | 2006 } |
2018 | 2007 |
2019 void GenerateEqual_Simd128Value_HeapObject( | 2008 void GenerateEqual_Simd128Value_HeapObject( |
2020 compiler::CodeStubAssembler* assembler, compiler::Node* lhs, | 2009 CodeStubAssembler* assembler, compiler::Node* lhs, compiler::Node* lhs_map, |
2021 compiler::Node* lhs_map, compiler::Node* rhs, compiler::Node* rhs_map, | 2010 compiler::Node* rhs, compiler::Node* rhs_map, |
2022 compiler::CodeStubAssembler::Label* if_equal, | 2011 CodeStubAssembler::Label* if_equal, CodeStubAssembler::Label* if_notequal) { |
2023 compiler::CodeStubAssembler::Label* if_notequal) { | 2012 typedef CodeStubAssembler::Label Label; |
2024 typedef compiler::CodeStubAssembler::Label Label; | |
2025 typedef compiler::Node Node; | 2013 typedef compiler::Node Node; |
2026 | 2014 |
2027 // Check if {lhs} and {rhs} have the same map. | 2015 // Check if {lhs} and {rhs} have the same map. |
2028 Label if_mapsame(assembler), if_mapnotsame(assembler); | 2016 Label if_mapsame(assembler), if_mapnotsame(assembler); |
2029 assembler->Branch(assembler->WordEqual(lhs_map, rhs_map), &if_mapsame, | 2017 assembler->Branch(assembler->WordEqual(lhs_map, rhs_map), &if_mapsame, |
2030 &if_mapnotsame); | 2018 &if_mapnotsame); |
2031 | 2019 |
2032 assembler->Bind(&if_mapsame); | 2020 assembler->Bind(&if_mapsame); |
2033 { | 2021 { |
2034 // Both {lhs} and {rhs} are Simd128Values with the same map, need special | 2022 // Both {lhs} and {rhs} are Simd128Values with the same map, need special |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 // Bitwise comparison succeeded, {lhs} and {rhs} considered equal. | 2077 // Bitwise comparison succeeded, {lhs} and {rhs} considered equal. |
2090 assembler->Goto(if_equal); | 2078 assembler->Goto(if_equal); |
2091 } | 2079 } |
2092 } | 2080 } |
2093 | 2081 |
2094 assembler->Bind(&if_mapnotsame); | 2082 assembler->Bind(&if_mapnotsame); |
2095 assembler->Goto(if_notequal); | 2083 assembler->Goto(if_notequal); |
2096 } | 2084 } |
2097 | 2085 |
2098 // ES6 section 7.2.12 Abstract Equality Comparison | 2086 // ES6 section 7.2.12 Abstract Equality Comparison |
2099 void GenerateEqual(compiler::CodeStubAssembler* assembler, ResultMode mode) { | 2087 void GenerateEqual(CodeStubAssembler* assembler, ResultMode mode) { |
2100 // This is a slightly optimized version of Object::Equals represented as | 2088 // This is a slightly optimized version of Object::Equals represented as |
2101 // scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you | 2089 // scheduled TurboFan graph utilizing the CodeStubAssembler. Whenever you |
2102 // change something functionality wise in here, remember to update the | 2090 // change something functionality wise in here, remember to update the |
2103 // Object::Equals method as well. | 2091 // Object::Equals method as well. |
2104 typedef compiler::CodeStubAssembler::Label Label; | 2092 typedef CodeStubAssembler::Label Label; |
2105 typedef compiler::Node Node; | 2093 typedef compiler::Node Node; |
2106 typedef compiler::CodeStubAssembler::Variable Variable; | 2094 typedef CodeStubAssembler::Variable Variable; |
2107 | 2095 |
2108 Node* context = assembler->Parameter(2); | 2096 Node* context = assembler->Parameter(2); |
2109 | 2097 |
2110 Label if_equal(assembler), if_notequal(assembler); | 2098 Label if_equal(assembler), if_notequal(assembler); |
2111 | 2099 |
2112 // Shared entry for floating point comparison. | 2100 // Shared entry for floating point comparison. |
2113 Label do_fcmp(assembler); | 2101 Label do_fcmp(assembler); |
2114 Variable var_fcmp_lhs(assembler, MachineRepresentation::kFloat64), | 2102 Variable var_fcmp_lhs(assembler, MachineRepresentation::kFloat64), |
2115 var_fcmp_rhs(assembler, MachineRepresentation::kFloat64); | 2103 var_fcmp_rhs(assembler, MachineRepresentation::kFloat64); |
2116 | 2104 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 assembler->BranchIfFloat64Equal(lhs, rhs, &if_equal, &if_notequal); | 2605 assembler->BranchIfFloat64Equal(lhs, rhs, &if_equal, &if_notequal); |
2618 } | 2606 } |
2619 | 2607 |
2620 assembler->Bind(&if_equal); | 2608 assembler->Bind(&if_equal); |
2621 assembler->Return(assembler->BooleanConstant(mode == kDontNegateResult)); | 2609 assembler->Return(assembler->BooleanConstant(mode == kDontNegateResult)); |
2622 | 2610 |
2623 assembler->Bind(&if_notequal); | 2611 assembler->Bind(&if_notequal); |
2624 assembler->Return(assembler->BooleanConstant(mode == kNegateResult)); | 2612 assembler->Return(assembler->BooleanConstant(mode == kNegateResult)); |
2625 } | 2613 } |
2626 | 2614 |
2627 void GenerateStrictEqual(compiler::CodeStubAssembler* assembler, | 2615 void GenerateStrictEqual(CodeStubAssembler* assembler, ResultMode mode) { |
2628 ResultMode mode) { | |
2629 // Here's pseudo-code for the algorithm below in case of kDontNegateResult | 2616 // Here's pseudo-code for the algorithm below in case of kDontNegateResult |
2630 // mode; for kNegateResult mode we properly negate the result. | 2617 // mode; for kNegateResult mode we properly negate the result. |
2631 // | 2618 // |
2632 // if (lhs == rhs) { | 2619 // if (lhs == rhs) { |
2633 // if (lhs->IsHeapNumber()) return HeapNumber::cast(lhs)->value() != NaN; | 2620 // if (lhs->IsHeapNumber()) return HeapNumber::cast(lhs)->value() != NaN; |
2634 // return true; | 2621 // return true; |
2635 // } | 2622 // } |
2636 // if (!lhs->IsSmi()) { | 2623 // if (!lhs->IsSmi()) { |
2637 // if (lhs->IsHeapNumber()) { | 2624 // if (lhs->IsHeapNumber()) { |
2638 // if (rhs->IsSmi()) { | 2625 // if (rhs->IsSmi()) { |
(...skipping 28 matching lines...) Expand all Loading... |
2667 // return false; | 2654 // return false; |
2668 // } else { | 2655 // } else { |
2669 // if (rhs->IsHeapNumber()) { | 2656 // if (rhs->IsHeapNumber()) { |
2670 // return Smi::cast(lhs)->value() == HeapNumber::cast(rhs)->value(); | 2657 // return Smi::cast(lhs)->value() == HeapNumber::cast(rhs)->value(); |
2671 // } else { | 2658 // } else { |
2672 // return false; | 2659 // return false; |
2673 // } | 2660 // } |
2674 // } | 2661 // } |
2675 // } | 2662 // } |
2676 | 2663 |
2677 typedef compiler::CodeStubAssembler::Label Label; | 2664 typedef CodeStubAssembler::Label Label; |
2678 typedef compiler::Node Node; | 2665 typedef compiler::Node Node; |
2679 | 2666 |
2680 Node* lhs = assembler->Parameter(0); | 2667 Node* lhs = assembler->Parameter(0); |
2681 Node* rhs = assembler->Parameter(1); | 2668 Node* rhs = assembler->Parameter(1); |
2682 Node* context = assembler->Parameter(2); | 2669 Node* context = assembler->Parameter(2); |
2683 | 2670 |
2684 Label if_equal(assembler), if_notequal(assembler); | 2671 Label if_equal(assembler), if_notequal(assembler); |
2685 | 2672 |
2686 // Check if {lhs} and {rhs} refer to the same object. | 2673 // Check if {lhs} and {rhs} refer to the same object. |
2687 Label if_same(assembler), if_notsame(assembler); | 2674 Label if_same(assembler), if_notsame(assembler); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2874 } | 2861 } |
2875 } | 2862 } |
2876 | 2863 |
2877 assembler->Bind(&if_equal); | 2864 assembler->Bind(&if_equal); |
2878 assembler->Return(assembler->BooleanConstant(mode == kDontNegateResult)); | 2865 assembler->Return(assembler->BooleanConstant(mode == kDontNegateResult)); |
2879 | 2866 |
2880 assembler->Bind(&if_notequal); | 2867 assembler->Bind(&if_notequal); |
2881 assembler->Return(assembler->BooleanConstant(mode == kNegateResult)); | 2868 assembler->Return(assembler->BooleanConstant(mode == kNegateResult)); |
2882 } | 2869 } |
2883 | 2870 |
2884 void GenerateStringRelationalComparison(compiler::CodeStubAssembler* assembler, | 2871 void GenerateStringRelationalComparison(CodeStubAssembler* assembler, |
2885 RelationalComparisonMode mode) { | 2872 RelationalComparisonMode mode) { |
2886 typedef compiler::CodeStubAssembler::Label Label; | 2873 typedef CodeStubAssembler::Label Label; |
2887 typedef compiler::Node Node; | 2874 typedef compiler::Node Node; |
2888 typedef compiler::CodeStubAssembler::Variable Variable; | 2875 typedef CodeStubAssembler::Variable Variable; |
2889 | 2876 |
2890 Node* lhs = assembler->Parameter(0); | 2877 Node* lhs = assembler->Parameter(0); |
2891 Node* rhs = assembler->Parameter(1); | 2878 Node* rhs = assembler->Parameter(1); |
2892 Node* context = assembler->Parameter(2); | 2879 Node* context = assembler->Parameter(2); |
2893 | 2880 |
2894 Label if_less(assembler), if_equal(assembler), if_greater(assembler); | 2881 Label if_less(assembler), if_equal(assembler), if_greater(assembler); |
2895 | 2882 |
2896 // Fast check to see if {lhs} and {rhs} refer to the same String object. | 2883 // Fast check to see if {lhs} and {rhs} refer to the same String object. |
2897 Label if_same(assembler), if_notsame(assembler); | 2884 Label if_same(assembler), if_notsame(assembler); |
2898 assembler->Branch(assembler->WordEqual(lhs, rhs), &if_same, &if_notsame); | 2885 assembler->Branch(assembler->WordEqual(lhs, rhs), &if_same, &if_notsame); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3057 assembler->Return(assembler->BooleanConstant(false)); | 3044 assembler->Return(assembler->BooleanConstant(false)); |
3058 break; | 3045 break; |
3059 | 3046 |
3060 case kGreaterThan: | 3047 case kGreaterThan: |
3061 case kGreaterThanOrEqual: | 3048 case kGreaterThanOrEqual: |
3062 assembler->Return(assembler->BooleanConstant(true)); | 3049 assembler->Return(assembler->BooleanConstant(true)); |
3063 break; | 3050 break; |
3064 } | 3051 } |
3065 } | 3052 } |
3066 | 3053 |
3067 void GenerateStringEqual(compiler::CodeStubAssembler* assembler, | 3054 void GenerateStringEqual(CodeStubAssembler* assembler, ResultMode mode) { |
3068 ResultMode mode) { | |
3069 // Here's pseudo-code for the algorithm below in case of kDontNegateResult | 3055 // Here's pseudo-code for the algorithm below in case of kDontNegateResult |
3070 // mode; for kNegateResult mode we properly negate the result. | 3056 // mode; for kNegateResult mode we properly negate the result. |
3071 // | 3057 // |
3072 // if (lhs == rhs) return true; | 3058 // if (lhs == rhs) return true; |
3073 // if (lhs->length() != rhs->length()) return false; | 3059 // if (lhs->length() != rhs->length()) return false; |
3074 // if (lhs->IsInternalizedString() && rhs->IsInternalizedString()) { | 3060 // if (lhs->IsInternalizedString() && rhs->IsInternalizedString()) { |
3075 // return false; | 3061 // return false; |
3076 // } | 3062 // } |
3077 // if (lhs->IsSeqOneByteString() && rhs->IsSeqOneByteString()) { | 3063 // if (lhs->IsSeqOneByteString() && rhs->IsSeqOneByteString()) { |
3078 // for (i = 0; i != lhs->length(); ++i) { | 3064 // for (i = 0; i != lhs->length(); ++i) { |
3079 // if (lhs[i] != rhs[i]) return false; | 3065 // if (lhs[i] != rhs[i]) return false; |
3080 // } | 3066 // } |
3081 // return true; | 3067 // return true; |
3082 // } | 3068 // } |
3083 // return %StringEqual(lhs, rhs); | 3069 // return %StringEqual(lhs, rhs); |
3084 | 3070 |
3085 typedef compiler::CodeStubAssembler::Label Label; | 3071 typedef CodeStubAssembler::Label Label; |
3086 typedef compiler::Node Node; | 3072 typedef compiler::Node Node; |
3087 typedef compiler::CodeStubAssembler::Variable Variable; | 3073 typedef CodeStubAssembler::Variable Variable; |
3088 | 3074 |
3089 Node* lhs = assembler->Parameter(0); | 3075 Node* lhs = assembler->Parameter(0); |
3090 Node* rhs = assembler->Parameter(1); | 3076 Node* rhs = assembler->Parameter(1); |
3091 Node* context = assembler->Parameter(2); | 3077 Node* context = assembler->Parameter(2); |
3092 | 3078 |
3093 Label if_equal(assembler), if_notequal(assembler); | 3079 Label if_equal(assembler), if_notequal(assembler); |
3094 | 3080 |
3095 // Fast check to see if {lhs} and {rhs} refer to the same String object. | 3081 // Fast check to see if {lhs} and {rhs} refer to the same String object. |
3096 Label if_same(assembler), if_notsame(assembler); | 3082 Label if_same(assembler), if_notsame(assembler); |
3097 assembler->Branch(assembler->WordEqual(lhs, rhs), &if_same, &if_notsame); | 3083 assembler->Branch(assembler->WordEqual(lhs, rhs), &if_same, &if_notsame); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 | 3222 |
3237 assembler->Bind(&if_equal); | 3223 assembler->Bind(&if_equal); |
3238 assembler->Return(assembler->BooleanConstant(mode == kDontNegateResult)); | 3224 assembler->Return(assembler->BooleanConstant(mode == kDontNegateResult)); |
3239 | 3225 |
3240 assembler->Bind(&if_notequal); | 3226 assembler->Bind(&if_notequal); |
3241 assembler->Return(assembler->BooleanConstant(mode == kNegateResult)); | 3227 assembler->Return(assembler->BooleanConstant(mode == kNegateResult)); |
3242 } | 3228 } |
3243 | 3229 |
3244 } // namespace | 3230 } // namespace |
3245 | 3231 |
3246 void LessThanStub::GenerateAssembly( | 3232 void LessThanStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3247 compiler::CodeStubAssembler* assembler) const { | |
3248 GenerateAbstractRelationalComparison(assembler, kLessThan); | 3233 GenerateAbstractRelationalComparison(assembler, kLessThan); |
3249 } | 3234 } |
3250 | 3235 |
3251 void LessThanOrEqualStub::GenerateAssembly( | 3236 void LessThanOrEqualStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3252 compiler::CodeStubAssembler* assembler) const { | |
3253 GenerateAbstractRelationalComparison(assembler, kLessThanOrEqual); | 3237 GenerateAbstractRelationalComparison(assembler, kLessThanOrEqual); |
3254 } | 3238 } |
3255 | 3239 |
3256 void GreaterThanStub::GenerateAssembly( | 3240 void GreaterThanStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3257 compiler::CodeStubAssembler* assembler) const { | |
3258 GenerateAbstractRelationalComparison(assembler, kGreaterThan); | 3241 GenerateAbstractRelationalComparison(assembler, kGreaterThan); |
3259 } | 3242 } |
3260 | 3243 |
3261 void GreaterThanOrEqualStub::GenerateAssembly( | 3244 void GreaterThanOrEqualStub::GenerateAssembly( |
3262 compiler::CodeStubAssembler* assembler) const { | 3245 CodeStubAssembler* assembler) const { |
3263 GenerateAbstractRelationalComparison(assembler, kGreaterThanOrEqual); | 3246 GenerateAbstractRelationalComparison(assembler, kGreaterThanOrEqual); |
3264 } | 3247 } |
3265 | 3248 |
3266 void EqualStub::GenerateAssembly(compiler::CodeStubAssembler* assembler) const { | 3249 void EqualStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3267 GenerateEqual(assembler, kDontNegateResult); | 3250 GenerateEqual(assembler, kDontNegateResult); |
3268 } | 3251 } |
3269 | 3252 |
3270 void NotEqualStub::GenerateAssembly( | 3253 void NotEqualStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3271 compiler::CodeStubAssembler* assembler) const { | |
3272 GenerateEqual(assembler, kNegateResult); | 3254 GenerateEqual(assembler, kNegateResult); |
3273 } | 3255 } |
3274 | 3256 |
3275 void StrictEqualStub::GenerateAssembly( | 3257 void StrictEqualStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3276 compiler::CodeStubAssembler* assembler) const { | |
3277 GenerateStrictEqual(assembler, kDontNegateResult); | 3258 GenerateStrictEqual(assembler, kDontNegateResult); |
3278 } | 3259 } |
3279 | 3260 |
3280 void StrictNotEqualStub::GenerateAssembly( | 3261 void StrictNotEqualStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3281 compiler::CodeStubAssembler* assembler) const { | |
3282 GenerateStrictEqual(assembler, kNegateResult); | 3262 GenerateStrictEqual(assembler, kNegateResult); |
3283 } | 3263 } |
3284 | 3264 |
3285 void StringEqualStub::GenerateAssembly( | 3265 void StringEqualStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3286 compiler::CodeStubAssembler* assembler) const { | |
3287 GenerateStringEqual(assembler, kDontNegateResult); | 3266 GenerateStringEqual(assembler, kDontNegateResult); |
3288 } | 3267 } |
3289 | 3268 |
3290 void StringNotEqualStub::GenerateAssembly( | 3269 void StringNotEqualStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3291 compiler::CodeStubAssembler* assembler) const { | |
3292 GenerateStringEqual(assembler, kNegateResult); | 3270 GenerateStringEqual(assembler, kNegateResult); |
3293 } | 3271 } |
3294 | 3272 |
3295 void StringLessThanStub::GenerateAssembly( | 3273 void StringLessThanStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3296 compiler::CodeStubAssembler* assembler) const { | |
3297 GenerateStringRelationalComparison(assembler, kLessThan); | 3274 GenerateStringRelationalComparison(assembler, kLessThan); |
3298 } | 3275 } |
3299 | 3276 |
3300 void StringLessThanOrEqualStub::GenerateAssembly( | 3277 void StringLessThanOrEqualStub::GenerateAssembly( |
3301 compiler::CodeStubAssembler* assembler) const { | 3278 CodeStubAssembler* assembler) const { |
3302 GenerateStringRelationalComparison(assembler, kLessThanOrEqual); | 3279 GenerateStringRelationalComparison(assembler, kLessThanOrEqual); |
3303 } | 3280 } |
3304 | 3281 |
3305 void StringGreaterThanStub::GenerateAssembly( | 3282 void StringGreaterThanStub::GenerateAssembly( |
3306 compiler::CodeStubAssembler* assembler) const { | 3283 CodeStubAssembler* assembler) const { |
3307 GenerateStringRelationalComparison(assembler, kGreaterThan); | 3284 GenerateStringRelationalComparison(assembler, kGreaterThan); |
3308 } | 3285 } |
3309 | 3286 |
3310 void StringGreaterThanOrEqualStub::GenerateAssembly( | 3287 void StringGreaterThanOrEqualStub::GenerateAssembly( |
3311 compiler::CodeStubAssembler* assembler) const { | 3288 CodeStubAssembler* assembler) const { |
3312 GenerateStringRelationalComparison(assembler, kGreaterThanOrEqual); | 3289 GenerateStringRelationalComparison(assembler, kGreaterThanOrEqual); |
3313 } | 3290 } |
3314 | 3291 |
3315 void ToLengthStub::GenerateAssembly( | 3292 void ToLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3316 compiler::CodeStubAssembler* assembler) const { | 3293 typedef CodeStubAssembler::Label Label; |
3317 typedef compiler::CodeStubAssembler::Label Label; | |
3318 typedef compiler::Node Node; | 3294 typedef compiler::Node Node; |
3319 typedef compiler::CodeStubAssembler::Variable Variable; | 3295 typedef CodeStubAssembler::Variable Variable; |
3320 | 3296 |
3321 Node* context = assembler->Parameter(1); | 3297 Node* context = assembler->Parameter(1); |
3322 | 3298 |
3323 // We might need to loop once for ToNumber conversion. | 3299 // We might need to loop once for ToNumber conversion. |
3324 Variable var_len(assembler, MachineRepresentation::kTagged); | 3300 Variable var_len(assembler, MachineRepresentation::kTagged); |
3325 Label loop(assembler, &var_len); | 3301 Label loop(assembler, &var_len); |
3326 var_len.Bind(assembler->Parameter(0)); | 3302 var_len.Bind(assembler->Parameter(0)); |
3327 assembler->Goto(&loop); | 3303 assembler->Goto(&loop); |
3328 assembler->Bind(&loop); | 3304 assembler->Bind(&loop); |
3329 { | 3305 { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3382 assembler->Return(var_len.value()); | 3358 assembler->Return(var_len.value()); |
3383 | 3359 |
3384 assembler->Bind(&return_two53minus1); | 3360 assembler->Bind(&return_two53minus1); |
3385 assembler->Return(assembler->NumberConstant(kMaxSafeInteger)); | 3361 assembler->Return(assembler->NumberConstant(kMaxSafeInteger)); |
3386 | 3362 |
3387 assembler->Bind(&return_zero); | 3363 assembler->Bind(&return_zero); |
3388 assembler->Return(assembler->SmiConstant(Smi::FromInt(0))); | 3364 assembler->Return(assembler->SmiConstant(Smi::FromInt(0))); |
3389 } | 3365 } |
3390 } | 3366 } |
3391 | 3367 |
3392 void ToBooleanStub::GenerateAssembly( | 3368 void ToBooleanStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3393 compiler::CodeStubAssembler* assembler) const { | |
3394 typedef compiler::Node Node; | 3369 typedef compiler::Node Node; |
3395 typedef compiler::CodeStubAssembler::Label Label; | 3370 typedef CodeStubAssembler::Label Label; |
3396 | 3371 |
3397 Node* value = assembler->Parameter(0); | 3372 Node* value = assembler->Parameter(0); |
3398 Label if_valueissmi(assembler), if_valueisnotsmi(assembler); | 3373 Label if_valueissmi(assembler), if_valueisnotsmi(assembler); |
3399 | 3374 |
3400 // Check if {value} is a Smi or a HeapObject. | 3375 // Check if {value} is a Smi or a HeapObject. |
3401 assembler->Branch(assembler->WordIsSmi(value), &if_valueissmi, | 3376 assembler->Branch(assembler->WordIsSmi(value), &if_valueissmi, |
3402 &if_valueisnotsmi); | 3377 &if_valueisnotsmi); |
3403 | 3378 |
3404 assembler->Bind(&if_valueissmi); | 3379 assembler->Bind(&if_valueissmi); |
3405 { | 3380 { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3521 | 3496 |
3522 assembler->Bind(&if_valueisundetectable); | 3497 assembler->Bind(&if_valueisundetectable); |
3523 assembler->Return(assembler->BooleanConstant(false)); | 3498 assembler->Return(assembler->BooleanConstant(false)); |
3524 | 3499 |
3525 assembler->Bind(&if_valueisnotundetectable); | 3500 assembler->Bind(&if_valueisnotundetectable); |
3526 assembler->Return(assembler->BooleanConstant(true)); | 3501 assembler->Return(assembler->BooleanConstant(true)); |
3527 } | 3502 } |
3528 } | 3503 } |
3529 } | 3504 } |
3530 | 3505 |
3531 void ToIntegerStub::GenerateAssembly( | 3506 void ToIntegerStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
3532 compiler::CodeStubAssembler* assembler) const { | 3507 typedef CodeStubAssembler::Label Label; |
3533 typedef compiler::CodeStubAssembler::Label Label; | |
3534 typedef compiler::Node Node; | 3508 typedef compiler::Node Node; |
3535 typedef compiler::CodeStubAssembler::Variable Variable; | 3509 typedef CodeStubAssembler::Variable Variable; |
3536 | 3510 |
3537 Node* context = assembler->Parameter(1); | 3511 Node* context = assembler->Parameter(1); |
3538 | 3512 |
3539 // We might need to loop once for ToNumber conversion. | 3513 // We might need to loop once for ToNumber conversion. |
3540 Variable var_arg(assembler, MachineRepresentation::kTagged); | 3514 Variable var_arg(assembler, MachineRepresentation::kTagged); |
3541 Label loop(assembler, &var_arg); | 3515 Label loop(assembler, &var_arg); |
3542 var_arg.Bind(assembler->Parameter(0)); | 3516 var_arg.Bind(assembler->Parameter(0)); |
3543 assembler->Goto(&loop); | 3517 assembler->Goto(&loop); |
3544 assembler->Bind(&loop); | 3518 assembler->Bind(&loop); |
3545 { | 3519 { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3584 | 3558 |
3585 assembler->Bind(&return_arg); | 3559 assembler->Bind(&return_arg); |
3586 assembler->Return(var_arg.value()); | 3560 assembler->Return(var_arg.value()); |
3587 | 3561 |
3588 assembler->Bind(&return_zero); | 3562 assembler->Bind(&return_zero); |
3589 assembler->Return(assembler->SmiConstant(Smi::FromInt(0))); | 3563 assembler->Return(assembler->SmiConstant(Smi::FromInt(0))); |
3590 } | 3564 } |
3591 } | 3565 } |
3592 | 3566 |
3593 void StoreInterceptorStub::GenerateAssembly( | 3567 void StoreInterceptorStub::GenerateAssembly( |
3594 compiler::CodeStubAssembler* assembler) const { | 3568 CodeStubAssembler* assembler) const { |
3595 typedef compiler::Node Node; | 3569 typedef compiler::Node Node; |
3596 Node* receiver = assembler->Parameter(0); | 3570 Node* receiver = assembler->Parameter(0); |
3597 Node* name = assembler->Parameter(1); | 3571 Node* name = assembler->Parameter(1); |
3598 Node* value = assembler->Parameter(2); | 3572 Node* value = assembler->Parameter(2); |
3599 Node* context = assembler->Parameter(3); | 3573 Node* context = assembler->Parameter(3); |
3600 assembler->TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context, | 3574 assembler->TailCallRuntime(Runtime::kStorePropertyWithInterceptor, context, |
3601 receiver, name, value); | 3575 receiver, name, value); |
3602 } | 3576 } |
3603 | 3577 |
3604 void LoadIndexedInterceptorStub::GenerateAssembly( | 3578 void LoadIndexedInterceptorStub::GenerateAssembly( |
3605 compiler::CodeStubAssembler* assembler) const { | 3579 CodeStubAssembler* assembler) const { |
3606 typedef compiler::Node Node; | 3580 typedef compiler::Node Node; |
3607 typedef compiler::CodeStubAssembler::Label Label; | 3581 typedef CodeStubAssembler::Label Label; |
3608 Node* receiver = assembler->Parameter(0); | 3582 Node* receiver = assembler->Parameter(0); |
3609 Node* key = assembler->Parameter(1); | 3583 Node* key = assembler->Parameter(1); |
3610 Node* slot = assembler->Parameter(2); | 3584 Node* slot = assembler->Parameter(2); |
3611 Node* vector = assembler->Parameter(3); | 3585 Node* vector = assembler->Parameter(3); |
3612 Node* context = assembler->Parameter(4); | 3586 Node* context = assembler->Parameter(4); |
3613 | 3587 |
3614 Label if_keyispositivesmi(assembler), if_keyisinvalid(assembler); | 3588 Label if_keyispositivesmi(assembler), if_keyisinvalid(assembler); |
3615 assembler->Branch(assembler->WordIsPositiveSmi(key), &if_keyispositivesmi, | 3589 assembler->Branch(assembler->WordIsPositiveSmi(key), &if_keyispositivesmi, |
3616 &if_keyisinvalid); | 3590 &if_keyisinvalid); |
3617 assembler->Bind(&if_keyispositivesmi); | 3591 assembler->Bind(&if_keyispositivesmi); |
3618 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, | 3592 assembler->TailCallRuntime(Runtime::kLoadElementWithInterceptor, context, |
3619 receiver, key); | 3593 receiver, key); |
3620 | 3594 |
3621 assembler->Bind(&if_keyisinvalid); | 3595 assembler->Bind(&if_keyisinvalid); |
3622 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, | 3596 assembler->TailCallRuntime(Runtime::kKeyedLoadIC_Miss, context, receiver, key, |
3623 slot, vector); | 3597 slot, vector); |
3624 } | 3598 } |
3625 | 3599 |
3626 void FastCloneShallowObjectStub::GenerateAssembly( | 3600 void FastCloneShallowObjectStub::GenerateAssembly( |
3627 compiler::CodeStubAssembler* assembler) const { | 3601 CodeStubAssembler* assembler) const { |
3628 typedef compiler::CodeStubAssembler::Label Label; | 3602 typedef CodeStubAssembler::Label Label; |
3629 typedef compiler::Node Node; | 3603 typedef compiler::Node Node; |
3630 Label call_runtime(assembler); | 3604 Label call_runtime(assembler); |
3631 Node* closure = assembler->Parameter(0); | 3605 Node* closure = assembler->Parameter(0); |
3632 Node* literals_index = assembler->Parameter(1); | 3606 Node* literals_index = assembler->Parameter(1); |
3633 | 3607 |
3634 Node* undefined = assembler->UndefinedConstant(); | 3608 Node* undefined = assembler->UndefinedConstant(); |
3635 Node* literals_array = | 3609 Node* literals_array = |
3636 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); | 3610 assembler->LoadObjectField(closure, JSFunction::kLiteralsOffset); |
3637 Node* allocation_site = assembler->LoadFixedArrayElementSmiIndex( | 3611 Node* allocation_site = assembler->LoadFixedArrayElementSmiIndex( |
3638 literals_array, literals_index, | 3612 literals_array, literals_index, |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4122 if (type->Is(Type::UntaggedPointer())) { | 4096 if (type->Is(Type::UntaggedPointer())) { |
4123 return Representation::External(); | 4097 return Representation::External(); |
4124 } | 4098 } |
4125 | 4099 |
4126 DCHECK(!type->Is(Type::Untagged())); | 4100 DCHECK(!type->Is(Type::Untagged())); |
4127 return Representation::Tagged(); | 4101 return Representation::Tagged(); |
4128 } | 4102 } |
4129 | 4103 |
4130 } // namespace internal | 4104 } // namespace internal |
4131 } // namespace v8 | 4105 } // namespace v8 |
OLD | NEW |