Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 254623002: Simplify feedback vector creation and store in SharedFunctionInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Code comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/typing.cc ('k') | test/cctest/test-compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // o rbp: our caller's frame pointer 133 // o rbp: our caller's frame pointer
134 // o rsp: stack pointer (pointing to return address) 134 // o rsp: stack pointer (pointing to return address)
135 // 135 //
136 // The function builds a JS frame. Please see JavaScriptFrameConstants in 136 // The function builds a JS frame. Please see JavaScriptFrameConstants in
137 // frames-x64.h for its layout. 137 // frames-x64.h for its layout.
138 void FullCodeGenerator::Generate() { 138 void FullCodeGenerator::Generate() {
139 CompilationInfo* info = info_; 139 CompilationInfo* info = info_;
140 handler_table_ = 140 handler_table_ =
141 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED); 141 isolate()->factory()->NewFixedArray(function()->handler_count(), TENURED);
142 142
143 InitializeFeedbackVector();
144
145 profiling_counter_ = isolate()->factory()->NewCell( 143 profiling_counter_ = isolate()->factory()->NewCell(
146 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate())); 144 Handle<Smi>(Smi::FromInt(FLAG_interrupt_budget), isolate()));
147 SetFunctionPosition(function()); 145 SetFunctionPosition(function());
148 Comment cmnt(masm_, "[ function compiled by full code generator"); 146 Comment cmnt(masm_, "[ function compiled by full code generator");
149 147
150 ProfileEntryHookStub::MaybeCallEntryHook(masm_); 148 ProfileEntryHookStub::MaybeCallEntryHook(masm_);
151 149
152 #ifdef DEBUG 150 #ifdef DEBUG
153 if (strlen(FLAG_stop_at) > 0 && 151 if (strlen(FLAG_stop_at) > 0 &&
154 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 152 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 __ jmp(&loop); 1162 __ jmp(&loop);
1165 1163
1166 __ bind(&no_descriptors); 1164 __ bind(&no_descriptors);
1167 __ addp(rsp, Immediate(kPointerSize)); 1165 __ addp(rsp, Immediate(kPointerSize));
1168 __ jmp(&exit); 1166 __ jmp(&exit);
1169 1167
1170 // We got a fixed array in register rax. Iterate through that. 1168 // We got a fixed array in register rax. Iterate through that.
1171 Label non_proxy; 1169 Label non_proxy;
1172 __ bind(&fixed_array); 1170 __ bind(&fixed_array);
1173 1171
1174 Handle<Object> feedback = Handle<Object>(
1175 Smi::FromInt(TypeFeedbackInfo::kForInFastCaseMarker),
1176 isolate());
1177 StoreFeedbackVectorSlot(slot, feedback);
1178
1179 // No need for a write barrier, we are storing a Smi in the feedback vector. 1172 // No need for a write barrier, we are storing a Smi in the feedback vector.
1180 __ Move(rbx, FeedbackVector()); 1173 __ Move(rbx, FeedbackVector());
1181 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(slot)), 1174 __ Move(FieldOperand(rbx, FixedArray::OffsetOfElementAt(slot)),
1182 Smi::FromInt(TypeFeedbackInfo::kForInSlowCaseMarker)); 1175 TypeFeedbackInfo::MegamorphicSentinel(isolate()));
1183 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check 1176 __ Move(rbx, Smi::FromInt(1)); // Smi indicates slow check
1184 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object 1177 __ movp(rcx, Operand(rsp, 0 * kPointerSize)); // Get enumerated object
1185 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE); 1178 STATIC_ASSERT(FIRST_JS_PROXY_TYPE == FIRST_SPEC_OBJECT_TYPE);
1186 __ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx); 1179 __ CmpObjectType(rcx, LAST_JS_PROXY_TYPE, rcx);
1187 __ j(above, &non_proxy); 1180 __ j(above, &non_proxy);
1188 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy 1181 __ Move(rbx, Smi::FromInt(0)); // Zero indicates proxy
1189 __ bind(&non_proxy); 1182 __ bind(&non_proxy);
1190 __ Push(rbx); // Smi 1183 __ Push(rbx); // Smi
1191 __ Push(rax); // Array 1184 __ Push(rax); // Array
1192 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset)); 1185 __ movp(rax, FieldOperand(rax, FixedArray::kLengthOffset));
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 ZoneList<Expression*>* args = expr->arguments(); 2643 ZoneList<Expression*>* args = expr->arguments();
2651 int arg_count = args->length(); 2644 int arg_count = args->length();
2652 { PreservePositionScope scope(masm()->positions_recorder()); 2645 { PreservePositionScope scope(masm()->positions_recorder());
2653 for (int i = 0; i < arg_count; i++) { 2646 for (int i = 0; i < arg_count; i++) {
2654 VisitForStackValue(args->at(i)); 2647 VisitForStackValue(args->at(i));
2655 } 2648 }
2656 } 2649 }
2657 // Record source position for debugger. 2650 // Record source position for debugger.
2658 SetSourcePosition(expr->position()); 2651 SetSourcePosition(expr->position());
2659 2652
2660 Handle<Object> uninitialized =
2661 TypeFeedbackInfo::UninitializedSentinel(isolate());
2662 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized);
2663 __ Move(rbx, FeedbackVector()); 2653 __ Move(rbx, FeedbackVector());
2664 __ Move(rdx, Smi::FromInt(expr->CallFeedbackSlot())); 2654 __ Move(rdx, Smi::FromInt(expr->CallFeedbackSlot()));
2665 2655
2666 // Record call targets in unoptimized code. 2656 // Record call targets in unoptimized code.
2667 CallFunctionStub stub(isolate(), arg_count, RECORD_CALL_TARGET); 2657 CallFunctionStub stub(isolate(), arg_count, RECORD_CALL_TARGET);
2668 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); 2658 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize));
2669 __ CallStub(&stub); 2659 __ CallStub(&stub);
2670 RecordJSReturnSite(expr); 2660 RecordJSReturnSite(expr);
2671 // Restore context register. 2661 // Restore context register.
2672 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2662 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
2830 2820
2831 // Call the construct call builtin that handles allocation and 2821 // Call the construct call builtin that handles allocation and
2832 // constructor invocation. 2822 // constructor invocation.
2833 SetSourcePosition(expr->position()); 2823 SetSourcePosition(expr->position());
2834 2824
2835 // Load function and argument count into rdi and rax. 2825 // Load function and argument count into rdi and rax.
2836 __ Set(rax, arg_count); 2826 __ Set(rax, arg_count);
2837 __ movp(rdi, Operand(rsp, arg_count * kPointerSize)); 2827 __ movp(rdi, Operand(rsp, arg_count * kPointerSize));
2838 2828
2839 // Record call targets in unoptimized code, but not in the snapshot. 2829 // Record call targets in unoptimized code, but not in the snapshot.
2840 Handle<Object> uninitialized =
2841 TypeFeedbackInfo::UninitializedSentinel(isolate());
2842 StoreFeedbackVectorSlot(expr->CallNewFeedbackSlot(), uninitialized);
2843 if (FLAG_pretenuring_call_new) { 2830 if (FLAG_pretenuring_call_new) {
2844 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(), 2831 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
2845 isolate()->factory()->NewAllocationSite());
2846 ASSERT(expr->AllocationSiteFeedbackSlot() == 2832 ASSERT(expr->AllocationSiteFeedbackSlot() ==
2847 expr->CallNewFeedbackSlot() + 1); 2833 expr->CallNewFeedbackSlot() + 1);
2848 } 2834 }
2849 2835
2850 __ Move(rbx, FeedbackVector()); 2836 __ Move(rbx, FeedbackVector());
2851 __ Move(rdx, Smi::FromInt(expr->CallNewFeedbackSlot())); 2837 __ Move(rdx, Smi::FromInt(expr->CallNewFeedbackSlot()));
2852 2838
2853 CallConstructStub stub(isolate(), RECORD_CALL_TARGET); 2839 CallConstructStub stub(isolate(), RECORD_CALL_TARGET);
2854 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 2840 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
2855 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2841 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
(...skipping 2042 matching lines...) Expand 10 before | Expand all | Expand 10 after
4898 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4884 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4899 Assembler::target_address_at(call_target_address, 4885 Assembler::target_address_at(call_target_address,
4900 unoptimized_code)); 4886 unoptimized_code));
4901 return OSR_AFTER_STACK_CHECK; 4887 return OSR_AFTER_STACK_CHECK;
4902 } 4888 }
4903 4889
4904 4890
4905 } } // namespace v8::internal 4891 } } // namespace v8::internal
4906 4892
4907 #endif // V8_TARGET_ARCH_X64 4893 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/typing.cc ('k') | test/cctest/test-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698