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...) 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...) 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 1492 matching lines...) Loading... |
2641 ZoneList<Expression*>* args = expr->arguments(); | 2634 ZoneList<Expression*>* args = expr->arguments(); |
2642 int arg_count = args->length(); | 2635 int arg_count = args->length(); |
2643 { PreservePositionScope scope(masm()->positions_recorder()); | 2636 { PreservePositionScope scope(masm()->positions_recorder()); |
2644 for (int i = 0; i < arg_count; i++) { | 2637 for (int i = 0; i < arg_count; i++) { |
2645 VisitForStackValue(args->at(i)); | 2638 VisitForStackValue(args->at(i)); |
2646 } | 2639 } |
2647 } | 2640 } |
2648 // Record source position for debugger. | 2641 // Record source position for debugger. |
2649 SetSourcePosition(expr->position()); | 2642 SetSourcePosition(expr->position()); |
2650 | 2643 |
2651 Handle<Object> uninitialized = | |
2652 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
2653 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); | |
2654 __ Move(rbx, FeedbackVector()); | 2644 __ Move(rbx, FeedbackVector()); |
2655 __ Move(rdx, Smi::FromInt(expr->CallFeedbackSlot())); | 2645 __ Move(rdx, Smi::FromInt(expr->CallFeedbackSlot())); |
2656 | 2646 |
2657 // Record call targets in unoptimized code. | 2647 // Record call targets in unoptimized code. |
2658 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); | 2648 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
2659 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); | 2649 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
2660 __ CallStub(&stub); | 2650 __ CallStub(&stub); |
2661 RecordJSReturnSite(expr); | 2651 RecordJSReturnSite(expr); |
2662 // Restore context register. | 2652 // Restore context register. |
2663 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2653 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
(...skipping 157 matching lines...) Loading... |
2821 | 2811 |
2822 // Call the construct call builtin that handles allocation and | 2812 // Call the construct call builtin that handles allocation and |
2823 // constructor invocation. | 2813 // constructor invocation. |
2824 SetSourcePosition(expr->position()); | 2814 SetSourcePosition(expr->position()); |
2825 | 2815 |
2826 // Load function and argument count into rdi and rax. | 2816 // Load function and argument count into rdi and rax. |
2827 __ Set(rax, arg_count); | 2817 __ Set(rax, arg_count); |
2828 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); | 2818 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); |
2829 | 2819 |
2830 // Record call targets in unoptimized code, but not in the snapshot. | 2820 // Record call targets in unoptimized code, but not in the snapshot. |
2831 Handle<Object> uninitialized = | |
2832 TypeFeedbackInfo::UninitializedSentinel(isolate()); | |
2833 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized); | |
2834 __ Move(rbx, FeedbackVector()); | 2821 __ Move(rbx, FeedbackVector()); |
2835 __ Move(rdx, Smi::FromInt(expr->CallNewFeedbackSlot())); | 2822 __ Move(rdx, Smi::FromInt(expr->CallNewFeedbackSlot())); |
2836 | 2823 |
2837 CallConstructStub stub(RECORD_CALL_TARGET); | 2824 CallConstructStub stub(RECORD_CALL_TARGET); |
2838 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); | 2825 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
2839 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2826 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2840 context()->Plug(rax); | 2827 context()->Plug(rax); |
2841 } | 2828 } |
2842 | 2829 |
2843 | 2830 |
(...skipping 2063 matching lines...) Loading... |
4907 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4894 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
4908 Assembler::target_address_at(call_target_address, | 4895 Assembler::target_address_at(call_target_address, |
4909 unoptimized_code)); | 4896 unoptimized_code)); |
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 |