| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 __ movp(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0)); | 526 __ movp(kScratchRegister, Operand(rbx, rcx, times_pointer_size, 0)); |
| 527 __ push(Operand(kScratchRegister, 0)); // dereference handle | 527 __ push(Operand(kScratchRegister, 0)); // dereference handle |
| 528 __ addq(rcx, Immediate(1)); | 528 __ addq(rcx, Immediate(1)); |
| 529 __ bind(&entry); | 529 __ bind(&entry); |
| 530 __ cmpq(rcx, rax); | 530 __ cmpq(rcx, rax); |
| 531 __ j(not_equal, &loop); | 531 __ j(not_equal, &loop); |
| 532 | 532 |
| 533 // Invoke the code. | 533 // Invoke the code. |
| 534 if (is_construct) { | 534 if (is_construct) { |
| 535 // No type feedback cell is available | 535 // No type feedback cell is available |
| 536 Handle<Object> undefined_sentinel( | 536 Handle<Object> megamorphic_sentinel = |
| 537 masm->isolate()->factory()->undefined_value()); | 537 TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()); |
| 538 __ Move(rbx, undefined_sentinel); | 538 __ Move(rbx, megamorphic_sentinel); |
| 539 // Expects rdi to hold function pointer. | 539 // Expects rdi to hold function pointer. |
| 540 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); | 540 CallConstructStub stub(NO_CALL_FUNCTION_FLAGS); |
| 541 __ CallStub(&stub); | 541 __ CallStub(&stub); |
| 542 } else { | 542 } else { |
| 543 ParameterCount actual(rax); | 543 ParameterCount actual(rax); |
| 544 // Function must be in rdi. | 544 // Function must be in rdi. |
| 545 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); | 545 __ InvokeFunction(rdi, actual, CALL_FUNCTION, NullCallWrapper()); |
| 546 } | 546 } |
| 547 // Exit the internal frame. Notice that this also removes the empty | 547 // Exit the internal frame. Notice that this also removes the empty |
| 548 // context and the function left on the stack by the code | 548 // context and the function left on the stack by the code |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 __ testb(FieldOperand(rbx, SharedFunctionInfo::kStrictModeByteOffset), | 792 __ testb(FieldOperand(rbx, SharedFunctionInfo::kStrictModeByteOffset), |
| 793 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); | 793 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); |
| 794 __ j(not_equal, &shift_arguments); | 794 __ j(not_equal, &shift_arguments); |
| 795 | 795 |
| 796 // Do not transform the receiver for natives. | 796 // Do not transform the receiver for natives. |
| 797 // SharedFunctionInfo is already loaded into rbx. | 797 // SharedFunctionInfo is already loaded into rbx. |
| 798 __ testb(FieldOperand(rbx, SharedFunctionInfo::kNativeByteOffset), | 798 __ testb(FieldOperand(rbx, SharedFunctionInfo::kNativeByteOffset), |
| 799 Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte)); | 799 Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte)); |
| 800 __ j(not_zero, &shift_arguments); | 800 __ j(not_zero, &shift_arguments); |
| 801 | 801 |
| 802 // Compute the receiver in non-strict mode. | 802 // Compute the receiver in sloppy mode. |
| 803 __ movp(rbx, args.GetArgumentOperand(1)); | 803 __ movp(rbx, args.GetArgumentOperand(1)); |
| 804 __ JumpIfSmi(rbx, &convert_to_object, Label::kNear); | 804 __ JumpIfSmi(rbx, &convert_to_object, Label::kNear); |
| 805 | 805 |
| 806 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 806 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 807 __ j(equal, &use_global_receiver); | 807 __ j(equal, &use_global_receiver); |
| 808 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 808 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 809 __ j(equal, &use_global_receiver); | 809 __ j(equal, &use_global_receiver); |
| 810 | 810 |
| 811 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 811 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 812 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); | 812 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 983 __ movp(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 984 __ testb(FieldOperand(rdx, SharedFunctionInfo::kStrictModeByteOffset), | 984 __ testb(FieldOperand(rdx, SharedFunctionInfo::kStrictModeByteOffset), |
| 985 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); | 985 Immediate(1 << SharedFunctionInfo::kStrictModeBitWithinByte)); |
| 986 __ j(not_equal, &push_receiver); | 986 __ j(not_equal, &push_receiver); |
| 987 | 987 |
| 988 // Do not transform the receiver for natives. | 988 // Do not transform the receiver for natives. |
| 989 __ testb(FieldOperand(rdx, SharedFunctionInfo::kNativeByteOffset), | 989 __ testb(FieldOperand(rdx, SharedFunctionInfo::kNativeByteOffset), |
| 990 Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte)); | 990 Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte)); |
| 991 __ j(not_equal, &push_receiver); | 991 __ j(not_equal, &push_receiver); |
| 992 | 992 |
| 993 // Compute the receiver in non-strict mode. | 993 // Compute the receiver in sloppy mode. |
| 994 __ JumpIfSmi(rbx, &call_to_object, Label::kNear); | 994 __ JumpIfSmi(rbx, &call_to_object, Label::kNear); |
| 995 __ CompareRoot(rbx, Heap::kNullValueRootIndex); | 995 __ CompareRoot(rbx, Heap::kNullValueRootIndex); |
| 996 __ j(equal, &use_global_receiver); | 996 __ j(equal, &use_global_receiver); |
| 997 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); | 997 __ CompareRoot(rbx, Heap::kUndefinedValueRootIndex); |
| 998 __ j(equal, &use_global_receiver); | 998 __ j(equal, &use_global_receiver); |
| 999 | 999 |
| 1000 // If given receiver is already a JavaScript object then there's no | 1000 // If given receiver is already a JavaScript object then there's no |
| 1001 // reason for converting it. | 1001 // reason for converting it. |
| 1002 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); | 1002 STATIC_ASSERT(LAST_SPEC_OBJECT_TYPE == LAST_TYPE); |
| 1003 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); | 1003 __ CmpObjectType(rbx, FIRST_SPEC_OBJECT_TYPE, rcx); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 // Will both indicate a NULL and a Smi. | 1121 // Will both indicate a NULL and a Smi. |
| 1122 STATIC_ASSERT(kSmiTag == 0); | 1122 STATIC_ASSERT(kSmiTag == 0); |
| 1123 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); | 1123 Condition not_smi = NegateCondition(masm->CheckSmi(rbx)); |
| 1124 __ Check(not_smi, kUnexpectedInitialMapForArrayFunction); | 1124 __ Check(not_smi, kUnexpectedInitialMapForArrayFunction); |
| 1125 __ CmpObjectType(rbx, MAP_TYPE, rcx); | 1125 __ CmpObjectType(rbx, MAP_TYPE, rcx); |
| 1126 __ Check(equal, kUnexpectedInitialMapForArrayFunction); | 1126 __ Check(equal, kUnexpectedInitialMapForArrayFunction); |
| 1127 } | 1127 } |
| 1128 | 1128 |
| 1129 // Run the native code for the Array function called as a normal function. | 1129 // Run the native code for the Array function called as a normal function. |
| 1130 // tail call a stub | 1130 // tail call a stub |
| 1131 Handle<Object> undefined_sentinel( | 1131 Handle<Object> megamorphic_sentinel = |
| 1132 masm->isolate()->heap()->undefined_value(), | 1132 TypeFeedbackInfo::MegamorphicSentinel(masm->isolate()); |
| 1133 masm->isolate()); | 1133 __ Move(rbx, megamorphic_sentinel); |
| 1134 __ Move(rbx, undefined_sentinel); | |
| 1135 ArrayConstructorStub stub(masm->isolate()); | 1134 ArrayConstructorStub stub(masm->isolate()); |
| 1136 __ TailCallStub(&stub); | 1135 __ TailCallStub(&stub); |
| 1137 } | 1136 } |
| 1138 | 1137 |
| 1139 | 1138 |
| 1140 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { | 1139 void Builtins::Generate_StringConstructCode(MacroAssembler* masm) { |
| 1141 // ----------- S t a t e ------------- | 1140 // ----------- S t a t e ------------- |
| 1142 // -- rax : number of arguments | 1141 // -- rax : number of arguments |
| 1143 // -- rdi : constructor function | 1142 // -- rdi : constructor function |
| 1144 // -- rsp[0] : return address | 1143 // -- rsp[0] : return address |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1434 __ bind(&ok); | 1433 __ bind(&ok); |
| 1435 __ ret(0); | 1434 __ ret(0); |
| 1436 } | 1435 } |
| 1437 | 1436 |
| 1438 | 1437 |
| 1439 #undef __ | 1438 #undef __ |
| 1440 | 1439 |
| 1441 } } // namespace v8::internal | 1440 } } // namespace v8::internal |
| 1442 | 1441 |
| 1443 #endif // V8_TARGET_ARCH_X64 | 1442 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |