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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 493 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
494 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); | 494 Generate_JSConstructStubHelper(masm, false, FLAG_pretenuring_call_new); |
495 } | 495 } |
496 | 496 |
497 | 497 |
498 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 498 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
499 Generate_JSConstructStubHelper(masm, true, false); | 499 Generate_JSConstructStubHelper(masm, true, false); |
500 } | 500 } |
501 | 501 |
502 | 502 |
| 503 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 504 // ----------- S t a t e ------------- |
| 505 // -- eax: number of arguments |
| 506 // -- edi: constructor function |
| 507 // -- ebx: allocation site or undefined |
| 508 // -- edx: original constructor |
| 509 // ----------------------------------- |
| 510 |
| 511 // TODO(dslomov): support pretenuring |
| 512 CHECK(!FLAG_pretenuring_call_new); |
| 513 |
| 514 { |
| 515 FrameScope frame_scope(masm, StackFrame::CONSTRUCT); |
| 516 |
| 517 // Preserve actual arguments count. |
| 518 __ SmiTag(eax); |
| 519 __ push(eax); |
| 520 __ SmiUntag(eax); |
| 521 |
| 522 // receiver is the hole. |
| 523 __ push(Immediate(masm->isolate()->factory()->the_hole_value())); |
| 524 |
| 525 // Set up pointer to last argument. |
| 526 __ lea(ebx, Operand(ebp, StandardFrameConstants::kCallerSPOffset)); |
| 527 |
| 528 // Copy arguments and receiver to the expression stack. |
| 529 Label loop, entry; |
| 530 __ mov(ecx, eax); |
| 531 __ jmp(&entry); |
| 532 __ bind(&loop); |
| 533 __ push(Operand(ebx, ecx, times_4, 0)); |
| 534 __ bind(&entry); |
| 535 __ dec(ecx); |
| 536 __ j(greater_equal, &loop); |
| 537 |
| 538 ParameterCount actual(eax); |
| 539 __ InvokeFunction(edi, actual, CALL_FUNCTION, NullCallWrapper()); |
| 540 |
| 541 // Restore context from the frame. |
| 542 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 543 |
| 544 __ mov(ebx, Operand(esp, 0)); |
| 545 } |
| 546 |
| 547 __ pop(ecx); // Return address. |
| 548 __ lea(esp, Operand(esp, ebx, times_2, 1 * kPointerSize)); |
| 549 __ push(ecx); |
| 550 __ ret(0); |
| 551 } |
| 552 |
| 553 |
503 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, | 554 static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm, |
504 bool is_construct) { | 555 bool is_construct) { |
505 ProfileEntryHookStub::MaybeCallEntryHook(masm); | 556 ProfileEntryHookStub::MaybeCallEntryHook(masm); |
506 | 557 |
507 // Clear the context before we push it when entering the internal frame. | 558 // Clear the context before we push it when entering the internal frame. |
508 __ Move(esi, Immediate(0)); | 559 __ Move(esi, Immediate(0)); |
509 | 560 |
510 { | 561 { |
511 FrameScope scope(masm, StackFrame::INTERNAL); | 562 FrameScope scope(masm, StackFrame::INTERNAL); |
512 | 563 |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 | 1525 |
1475 __ bind(&ok); | 1526 __ bind(&ok); |
1476 __ ret(0); | 1527 __ ret(0); |
1477 } | 1528 } |
1478 | 1529 |
1479 #undef __ | 1530 #undef __ |
1480 } | 1531 } |
1481 } // namespace v8::internal | 1532 } // namespace v8::internal |
1482 | 1533 |
1483 #endif // V8_TARGET_ARCH_IA32 | 1534 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |