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 2595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2606 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); | 2606 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); |
2607 __ mov(ecx, Operand(esp, (arg_count + 1) * kPointerSize)); // Key. | 2607 __ mov(ecx, Operand(esp, (arg_count + 1) * kPointerSize)); // Key. |
2608 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); | 2608 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); |
2609 RecordJSReturnSite(expr); | 2609 RecordJSReturnSite(expr); |
2610 // Restore context register. | 2610 // Restore context register. |
2611 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2611 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2612 context()->DropAndPlug(1, eax); // Drop the key still on the stack. | 2612 context()->DropAndPlug(1, eax); // Drop the key still on the stack. |
2613 } | 2613 } |
2614 | 2614 |
2615 | 2615 |
2616 void FullCodeGenerator::EmitCallWithStub(Call* expr) { | 2616 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
2617 // Code common for calls using the call stub. | 2617 // Code common for calls using the call stub. |
2618 ZoneList<Expression*>* args = expr->arguments(); | 2618 ZoneList<Expression*>* args = expr->arguments(); |
2619 int arg_count = args->length(); | 2619 int arg_count = args->length(); |
2620 { PreservePositionScope scope(masm()->positions_recorder()); | 2620 { PreservePositionScope scope(masm()->positions_recorder()); |
2621 for (int i = 0; i < arg_count; i++) { | 2621 for (int i = 0; i < arg_count; i++) { |
2622 VisitForStackValue(args->at(i)); | 2622 VisitForStackValue(args->at(i)); |
2623 } | 2623 } |
2624 } | 2624 } |
2625 // Record source position for debugger. | 2625 // Record source position for debugger. |
2626 SetSourcePosition(expr->position()); | 2626 SetSourcePosition(expr->position()); |
2627 | 2627 |
| 2628 // Record call targets in unoptimized code. |
| 2629 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
2628 Handle<Object> uninitialized = | 2630 Handle<Object> uninitialized = |
2629 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2631 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2630 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); | 2632 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); |
2631 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2633 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); |
2632 __ mov(ebx, cell); | 2634 __ mov(ebx, cell); |
2633 | 2635 |
2634 // Record call targets in unoptimized code. | 2636 CallFunctionStub stub(arg_count, flags); |
2635 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | |
2636 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); | 2637 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); |
2637 __ CallStub(&stub, expr->CallFeedbackId()); | 2638 __ CallStub(&stub, expr->CallFeedbackId()); |
2638 | 2639 |
2639 RecordJSReturnSite(expr); | 2640 RecordJSReturnSite(expr); |
2640 // Restore context register. | 2641 // Restore context register. |
2641 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 2642 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
2642 context()->DropAndPlug(1, eax); | 2643 context()->DropAndPlug(1, eax); |
2643 } | 2644 } |
2644 | 2645 |
2645 | 2646 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 // Push function. | 2742 // Push function. |
2742 __ push(eax); | 2743 __ push(eax); |
2743 // The receiver is implicitly the global receiver. Indicate this by | 2744 // The receiver is implicitly the global receiver. Indicate this by |
2744 // passing the hole to the call function stub. | 2745 // passing the hole to the call function stub. |
2745 __ push(Immediate(isolate()->factory()->undefined_value())); | 2746 __ push(Immediate(isolate()->factory()->undefined_value())); |
2746 __ bind(&call); | 2747 __ bind(&call); |
2747 } | 2748 } |
2748 | 2749 |
2749 // The receiver is either the global receiver or an object found by | 2750 // The receiver is either the global receiver or an object found by |
2750 // LoadContextSlot. | 2751 // LoadContextSlot. |
2751 EmitCallWithStub(expr); | 2752 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
2752 | 2753 |
2753 } else if (property != NULL) { | 2754 } else if (property != NULL) { |
2754 { PreservePositionScope scope(masm()->positions_recorder()); | 2755 { PreservePositionScope scope(masm()->positions_recorder()); |
2755 VisitForStackValue(property->obj()); | 2756 VisitForStackValue(property->obj()); |
2756 } | 2757 } |
2757 if (property->key()->IsPropertyName()) { | 2758 if (property->key()->IsPropertyName()) { |
2758 EmitCallWithIC(expr, | 2759 EmitCallWithIC(expr, |
2759 property->key()->AsLiteral()->value(), | 2760 property->key()->AsLiteral()->value(), |
2760 NOT_CONTEXTUAL); | 2761 NOT_CONTEXTUAL); |
2761 } else { | 2762 } else { |
2762 EmitKeyedCallWithIC(expr, property->key()); | 2763 EmitKeyedCallWithIC(expr, property->key()); |
2763 } | 2764 } |
2764 | 2765 |
2765 } else { | 2766 } else { |
2766 // Call to an arbitrary expression not handled specially above. | 2767 // Call to an arbitrary expression not handled specially above. |
2767 { PreservePositionScope scope(masm()->positions_recorder()); | 2768 { PreservePositionScope scope(masm()->positions_recorder()); |
2768 VisitForStackValue(callee); | 2769 VisitForStackValue(callee); |
2769 } | 2770 } |
2770 __ push(Immediate(isolate()->factory()->undefined_value())); | 2771 __ push(Immediate(isolate()->factory()->undefined_value())); |
2771 // Emit function call. | 2772 // Emit function call. |
2772 EmitCallWithStub(expr); | 2773 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
2773 } | 2774 } |
2774 | 2775 |
2775 #ifdef DEBUG | 2776 #ifdef DEBUG |
2776 // RecordJSReturnSite should have been called. | 2777 // RecordJSReturnSite should have been called. |
2777 ASSERT(expr->return_is_recorded_); | 2778 ASSERT(expr->return_is_recorded_); |
2778 #endif | 2779 #endif |
2779 } | 2780 } |
2780 | 2781 |
2781 | 2782 |
2782 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 2783 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
(...skipping 2115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4898 | 4899 |
4899 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4900 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4900 Assembler::target_address_at(call_target_address)); | 4901 Assembler::target_address_at(call_target_address)); |
4901 return OSR_AFTER_STACK_CHECK; | 4902 return OSR_AFTER_STACK_CHECK; |
4902 } | 4903 } |
4903 | 4904 |
4904 | 4905 |
4905 } } // namespace v8::internal | 4906 } } // namespace v8::internal |
4906 | 4907 |
4907 #endif // V8_TARGET_ARCH_IA32 | 4908 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |