| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // o rbp: our caller's frame pointer | 112 // o rbp: our caller's frame pointer |
| 113 // o rsp: stack pointer (pointing to return address) | 113 // o rsp: stack pointer (pointing to return address) |
| 114 // | 114 // |
| 115 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 115 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 116 // frames-x64.h for its layout. | 116 // frames-x64.h for its layout. |
| 117 void FullCodeGenerator::Generate() { | 117 void FullCodeGenerator::Generate() { |
| 118 CompilationInfo* info = info_; | 118 CompilationInfo* info = info_; |
| 119 handler_table_ = | 119 handler_table_ = |
| 120 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); | 120 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); |
| 121 | 121 |
| 122 InitializeFeedbackVector(); | |
| 123 | |
| 124 profiling_counter_ = isolate()->factory()->NewCell( | 122 profiling_counter_ = isolate()->factory()->NewCell( |
| 125 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); | 123 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); |
| 126 SetFunctionPosition(function()); | 124 SetFunctionPosition(function()); |
| 127 Comment cmnt(masm_, "[ function compiled by full code generator"); | 125 Comment cmnt(masm_, "[ function compiled by full code generator"); |
| 128 | 126 |
| 129 ProfileEntryHookStub::MaybeCallEntryHook(masm_); | 127 ProfileEntryHookStub::MaybeCallEntryHook(masm_); |
| 130 | 128 |
| 131 #ifdef DEBUG | 129 #ifdef DEBUG |
| 132 if (strlen(FLAG_stop_at) > 0 && | 130 if (strlen(FLAG_stop_at) > 0 && |
| 133 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 131 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 __ jmp(&loop); | 1118 __ jmp(&loop); |
| 1121 | 1119 |
| 1122 __ bind(&no_descriptors); | 1120 __ bind(&no_descriptors); |
| 1123 __ addq(rsp, Immediate(kPointerSize)); | 1121 __ addq(rsp, Immediate(kPointerSize)); |
| 1124 __ jmp(&exit); | 1122 __ jmp(&exit); |
| 1125 | 1123 |
| 1126 // We got a fixed array in register rax. Iterate through that. | 1124 // We got a fixed array in register rax. Iterate through that. |
| 1127 Label non_proxy; | 1125 Label non_proxy; |
| 1128 __ bind(&fixed_array); | 1126 __ bind(&fixed_array); |
| 1129 | 1127 |
| 1130 Handle<Object> feedback = Handle<Object>( | |
| 1131 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker), | |
| 1132 isolate()); | |
| 1133 StoreFeedbackVectorSlot(slot, feedback); | |
| 1134 | |
| 1135 // No need for a write barrier, we are storing a Smi in the feedback vector. | 1128 // No need for a write barrier, we are storing a Smi in the feedback vector. |
| 1136 __ Move(rbx, FeedbackVector()); | 1129 __ Move(rbx, FeedbackVector()); |
| 1137 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(slot)), | 1130 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(slot)), |
| 1138 Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker)); | 1131 TypeFeedbackInfo::MegamorphicSentinel(isolate())); |
| 1139 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check | 1132 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check |
| 1140 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object | 1133 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object |
| 1141 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); | 1134 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); |
| 1142 __ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx); | 1135 __ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx); |
| 1143 __ j(above, &non_proxy); | 1136 __ j(above, &non_proxy); |
| 1144 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy | 1137 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy |
| 1145 __ bind(&non_proxy); | 1138 __ bind(&non_proxy); |
| 1146 __ push(rbx); // Smi | 1139 __ push(rbx); // Smi |
| 1147 __ push(rax); // Array | 1140 __ push(rax); // Array |
| 1148 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); | 1141 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2643 ZoneList<Expression*>* args = expr->arguments(); | 2636 ZoneList<Expression*>* args = expr->arguments(); |
| 2644 int arg_count = args->length(); | 2637 int arg_count = args->length(); |
| 2645 { PreservePositionScope scope(masm()->positions_recorder()); | 2638 { PreservePositionScope scope(masm()->positions_recorder()); |
| 2646 for (int i = 0; i < arg_count; i++) { | 2639 for (int i = 0; i < arg_count; i++) { |
| 2647 VisitForStackValue(args->at(i)); | 2640 VisitForStackValue(args->at(i)); |
| 2648 } | 2641 } |
| 2649 } | 2642 } |
| 2650 // Record source position for debugger. | 2643 // Record source position for debugger. |
| 2651 SetSourcePosition(expr->position()); | 2644 SetSourcePosition(expr->position()); |
| 2652 | 2645 |
| 2653 Handle<Object> uninitialized = | |
| 2654 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
| 2655 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); | |
| 2656 __ Move(rbx, FeedbackVector()); | 2646 __ Move(rbx, FeedbackVector()); |
| 2657 __ Move(rdx, Smi::FromInt(expr->CallFeedbackSlot())); | 2647 __ Move(rdx, Smi::FromInt(expr->CallFeedbackSlot())); |
| 2658 | 2648 |
| 2659 // Record call targets in unoptimized code. | 2649 // Record call targets in unoptimized code. |
| 2660 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | 2650 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
| 2661 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); | 2651 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
| 2662 __ CallStub(&stub); | 2652 __ CallStub(&stub); |
| 2663 RecordJSReturnSite(expr); | 2653 RecordJSReturnSite(expr); |
| 2664 // Restore context register. | 2654 // Restore context register. |
| 2665 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2655 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2823 | 2813 |
| 2824 // Call the construct call builtin that handles allocation and | 2814 // Call the construct call builtin that handles allocation and |
| 2825 // constructor invocation. | 2815 // constructor invocation. |
| 2826 SetSourcePosition(expr->position()); | 2816 SetSourcePosition(expr->position()); |
| 2827 | 2817 |
| 2828 // Load function and argument count into rdi and rax. | 2818 // Load function and argument count into rdi and rax. |
| 2829 __ Set(rax, arg_count); | 2819 __ Set(rax, arg_count); |
| 2830 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); | 2820 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); |
| 2831 | 2821 |
| 2832 // Record call targets in unoptimized code, but not in the snapshot. | 2822 // Record call targets in unoptimized code, but not in the snapshot. |
| 2833 Handle<Object> uninitialized = | |
| 2834 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
| 2835 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); | |
| 2836 __ Move(rbx, FeedbackVector()); | 2823 __ Move(rbx, FeedbackVector()); |
| 2837 __ Move(rdx, Smi::FromInt(expr->CallNewFeedbackSlot())); | 2824 __ Move(rdx, Smi::FromInt(expr->CallNewFeedbackSlot())); |
| 2838 | 2825 |
| 2839 CallConstructStub stub(RECORD_CALL_TARGET); | 2826 CallConstructStub stub(RECORD_CALL_TARGET); |
| 2840 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2827 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
| 2841 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2828 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 2842 context()->Plug(rax); | 2829 context()->Plug(rax); |
| 2843 } | 2830 } |
| 2844 | 2831 |
| 2845 | 2832 |
| (...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4907 | 4894 |
| 4908 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4895 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4909 Assembler::target_address_at(call_target_address)); | 4896 Assembler::target_address_at(call_target_address)); |
| 4910 return OSR_AFTER_STACK_CHECK; | 4897 return OSR_AFTER_STACK_CHECK; |
| 4911 } | 4898 } |
| 4912 | 4899 |
| 4913 | 4900 |
| 4914 } } // namespace v8::internal | 4901 } } // namespace v8::internal |
| 4915 | 4902 |
| 4916 #endif // V8_TARGET_ARCH_X64 | 4903 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |