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