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