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 572 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 |