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

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

Issue 23480031: Enable preaging of code objects when --optimize-for-size. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Add missing ia32 lithium codegen. Created 7 years, 2 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
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 __ movq(Operand(rsp, receiver_offset), kScratchRegister); 146 __ movq(Operand(rsp, receiver_offset), kScratchRegister);
147 __ bind(&ok); 147 __ bind(&ok);
148 } 148 }
149 149
150 // Open a frame scope to indicate that there is a frame on the stack. The 150 // Open a frame scope to indicate that there is a frame on the stack. The
151 // MANUAL indicates that the scope shouldn't actually generate code to set up 151 // MANUAL indicates that the scope shouldn't actually generate code to set up
152 // the frame (that is done below). 152 // the frame (that is done below).
153 FrameScope frame_scope(masm_, StackFrame::MANUAL); 153 FrameScope frame_scope(masm_, StackFrame::MANUAL);
154 154
155 info->set_prologue_offset(masm_->pc_offset()); 155 info->set_prologue_offset(masm_->pc_offset());
156 __ push(rbp); // Caller's frame pointer. 156 {
157 __ movq(rbp, rsp); 157 PredictableCodeSizeScope predictible_code_size_scope(
158 __ push(rsi); // Callee's context. 158 masm_, kNoCodeAgeSequenceLength);
159 __ push(rdi); // Callee's JS Function. 159 if (FLAG_optimize_for_size && FLAG_age_code) {
160 // Pre-age the code.
161 __ Call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
162 RelocInfo::CODE_AGE_SEQUENCE);
163 for (int i = Assembler::kShortCallInstructionLength;
164 i < kNoCodeAgeSequenceLength;
165 i++) {
166 __ nop();
167 }
168 } else {
169 __ push(rbp); // Caller's frame pointer.
170 __ movq(rbp, rsp);
171 __ push(rsi); // Callee's context.
172 __ push(rdi); // Callee's JS Function.
173 }
174 }
160 info->AddNoFrameRange(0, masm_->pc_offset()); 175 info->AddNoFrameRange(0, masm_->pc_offset());
161 176
162 { Comment cmnt(masm_, "[ Allocate locals"); 177 { Comment cmnt(masm_, "[ Allocate locals");
163 int locals_count = info->scope()->num_stack_slots(); 178 int locals_count = info->scope()->num_stack_slots();
164 // Generators allocate locals, if any, in context slots. 179 // Generators allocate locals, if any, in context slots.
165 ASSERT(!info->function()->is_generator() || locals_count == 0); 180 ASSERT(!info->function()->is_generator() || locals_count == 0);
166 if (locals_count == 1) { 181 if (locals_count == 1) {
167 __ PushRoot(Heap::kUndefinedValueRootIndex); 182 __ PushRoot(Heap::kUndefinedValueRootIndex);
168 } else if (locals_count > 1) { 183 } else if (locals_count > 1) {
169 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex); 184 __ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
(...skipping 14 matching lines...) Expand all
184 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 199 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) {
185 __ Push(info->scope()->GetScopeInfo()); 200 __ Push(info->scope()->GetScopeInfo());
186 __ CallRuntime(Runtime::kNewGlobalContext, 2); 201 __ CallRuntime(Runtime::kNewGlobalContext, 2);
187 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { 202 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
188 FastNewContextStub stub(heap_slots); 203 FastNewContextStub stub(heap_slots);
189 __ CallStub(&stub); 204 __ CallStub(&stub);
190 } else { 205 } else {
191 __ CallRuntime(Runtime::kNewFunctionContext, 1); 206 __ CallRuntime(Runtime::kNewFunctionContext, 1);
192 } 207 }
193 function_in_register = false; 208 function_in_register = false;
209
danno 2013/10/04 16:30:09 nit: remove whitespace change
rmcilroy 2013/10/07 10:56:13 Done.
194 // Context is returned in both rax and rsi. It replaces the context 210 // Context is returned in both rax and rsi. It replaces the context
195 // passed to us. It's saved in the stack and kept live in rsi. 211 // passed to us. It's saved in the stack and kept live in rsi.
196 __ movq(Operand(rbp, StandardFrameConstants::kContextOffset), rsi); 212 __ movq(Operand(rbp, StandardFrameConstants::kContextOffset), rsi);
197 213
198 // Copy any necessary parameters into the context. 214 // Copy any necessary parameters into the context.
199 int num_parameters = info->scope()->num_parameters(); 215 int num_parameters = info->scope()->num_parameters();
200 for (int i = 0; i < num_parameters; i++) { 216 for (int i = 0; i < num_parameters; i++) {
201 Variable* var = scope()->parameter(i); 217 Variable* var = scope()->parameter(i);
202 if (var->IsContextSlot()) { 218 if (var->IsContextSlot()) {
203 int parameter_offset = StandardFrameConstants::kCallerSPOffset + 219 int parameter_offset = StandardFrameConstants::kCallerSPOffset +
(...skipping 4742 matching lines...) Expand 10 before | Expand all | Expand 10 after
4946 4962
4947 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4963 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4948 Assembler::target_address_at(call_target_address)); 4964 Assembler::target_address_at(call_target_address));
4949 return OSR_AFTER_STACK_CHECK; 4965 return OSR_AFTER_STACK_CHECK;
4950 } 4966 }
4951 4967
4952 4968
4953 } } // namespace v8::internal 4969 } } // namespace v8::internal
4954 4970
4955 #endif // V8_TARGET_ARCH_X64 4971 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/v8globals.h ('K') | « src/x64/codegen-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698