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