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 2578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2589 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); | 2589 isolate()->stub_cache()->ComputeKeyedCallInitialize(arg_count); |
2590 __ movq(rcx, Operand(rsp, (arg_count + 1) * kPointerSize)); // Key. | 2590 __ movq(rcx, Operand(rsp, (arg_count + 1) * kPointerSize)); // Key. |
2591 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); | 2591 CallIC(ic, NOT_CONTEXTUAL, expr->CallFeedbackId()); |
2592 RecordJSReturnSite(expr); | 2592 RecordJSReturnSite(expr); |
2593 // Restore context register. | 2593 // Restore context register. |
2594 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2594 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
2595 context()->DropAndPlug(1, rax); // Drop the key still on the stack. | 2595 context()->DropAndPlug(1, rax); // Drop the key still on the stack. |
2596 } | 2596 } |
2597 | 2597 |
2598 | 2598 |
2599 void FullCodeGenerator::EmitCallWithStub(Call* expr) { | 2599 void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) { |
2600 // Code common for calls using the call stub. | 2600 // Code common for calls using the call stub. |
2601 ZoneList<Expression*>* args = expr->arguments(); | 2601 ZoneList<Expression*>* args = expr->arguments(); |
2602 int arg_count = args->length(); | 2602 int arg_count = args->length(); |
2603 { PreservePositionScope scope(masm()->positions_recorder()); | 2603 { PreservePositionScope scope(masm()->positions_recorder()); |
2604 for (int i = 0; i < arg_count; i++) { | 2604 for (int i = 0; i < arg_count; i++) { |
2605 VisitForStackValue(args->at(i)); | 2605 VisitForStackValue(args->at(i)); |
2606 } | 2606 } |
2607 } | 2607 } |
2608 // Record source position for debugger. | 2608 // Record source position for debugger. |
2609 SetSourcePosition(expr->position()); | 2609 SetSourcePosition(expr->position()); |
2610 | 2610 |
| 2611 // Record call targets in unoptimized code. |
| 2612 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
2611 Handle<Object> uninitialized = | 2613 Handle<Object> uninitialized = |
2612 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2614 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2613 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); | 2615 Handle<Cell> cell = isolate()->factory()->NewCell(uninitialized); |
2614 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); | 2616 RecordTypeFeedbackCell(expr->CallFeedbackId(), cell); |
2615 __ Move(rbx, cell); | 2617 __ Move(rbx, cell); |
2616 | 2618 |
2617 // Record call targets in unoptimized code. | 2619 CallFunctionStub stub(arg_count, flags); |
2618 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | |
2619 __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); | 2620 __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
2620 __ CallStub(&stub, expr->CallFeedbackId()); | 2621 __ CallStub(&stub, expr->CallFeedbackId()); |
2621 RecordJSReturnSite(expr); | 2622 RecordJSReturnSite(expr); |
2622 // Restore context register. | 2623 // Restore context register. |
2623 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2624 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
2624 // Discard the function left on TOS. | 2625 // Discard the function left on TOS. |
2625 context()->DropAndPlug(1, rax); | 2626 context()->DropAndPlug(1, rax); |
2626 } | 2627 } |
2627 | 2628 |
2628 | 2629 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2727 // Push function. | 2728 // Push function. |
2728 __ push(rax); | 2729 __ push(rax); |
2729 // The receiver is implicitly the global receiver. Indicate this by | 2730 // The receiver is implicitly the global receiver. Indicate this by |
2730 // passing the hole to the call function stub. | 2731 // passing the hole to the call function stub. |
2731 __ PushRoot(Heap::kUndefinedValueRootIndex); | 2732 __ PushRoot(Heap::kUndefinedValueRootIndex); |
2732 __ bind(&call); | 2733 __ bind(&call); |
2733 } | 2734 } |
2734 | 2735 |
2735 // The receiver is either the global receiver or an object found by | 2736 // The receiver is either the global receiver or an object found by |
2736 // LoadContextSlot. | 2737 // LoadContextSlot. |
2737 EmitCallWithStub(expr); | 2738 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
2738 } else if (property != NULL) { | 2739 } else if (property != NULL) { |
2739 { PreservePositionScope scope(masm()->positions_recorder()); | 2740 { PreservePositionScope scope(masm()->positions_recorder()); |
2740 VisitForStackValue(property->obj()); | 2741 VisitForStackValue(property->obj()); |
2741 } | 2742 } |
2742 if (property->key()->IsPropertyName()) { | 2743 if (property->key()->IsPropertyName()) { |
2743 EmitCallWithIC(expr, | 2744 EmitCallWithIC(expr, |
2744 property->key()->AsLiteral()->value(), | 2745 property->key()->AsLiteral()->value(), |
2745 NOT_CONTEXTUAL); | 2746 NOT_CONTEXTUAL); |
2746 } else { | 2747 } else { |
2747 EmitKeyedCallWithIC(expr, property->key()); | 2748 EmitKeyedCallWithIC(expr, property->key()); |
2748 } | 2749 } |
2749 } else { | 2750 } else { |
2750 // Call to an arbitrary expression not handled specially above. | 2751 // Call to an arbitrary expression not handled specially above. |
2751 { PreservePositionScope scope(masm()->positions_recorder()); | 2752 { PreservePositionScope scope(masm()->positions_recorder()); |
2752 VisitForStackValue(callee); | 2753 VisitForStackValue(callee); |
2753 } | 2754 } |
2754 __ PushRoot(Heap::kUndefinedValueRootIndex); | 2755 __ PushRoot(Heap::kUndefinedValueRootIndex); |
2755 // Emit function call. | 2756 // Emit function call. |
2756 EmitCallWithStub(expr); | 2757 EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS); |
2757 } | 2758 } |
2758 | 2759 |
2759 #ifdef DEBUG | 2760 #ifdef DEBUG |
2760 // RecordJSReturnSite should have been called. | 2761 // RecordJSReturnSite should have been called. |
2761 ASSERT(expr->return_is_recorded_); | 2762 ASSERT(expr->return_is_recorded_); |
2762 #endif | 2763 #endif |
2763 } | 2764 } |
2764 | 2765 |
2765 | 2766 |
2766 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 2767 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4897 | 4898 |
4898 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4899 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4899 Assembler::target_address_at(call_target_address)); | 4900 Assembler::target_address_at(call_target_address)); |
4900 return OSR_AFTER_STACK_CHECK; | 4901 return OSR_AFTER_STACK_CHECK; |
4901 } | 4902 } |
4902 | 4903 |
4903 | 4904 |
4904 } } // namespace v8::internal | 4905 } } // namespace v8::internal |
4905 | 4906 |
4906 #endif // V8_TARGET_ARCH_X64 | 4907 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |