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

Side by Side Diff: src/x87/lithium-codegen-x87.cc

Issue 1308743005: X87: Crankshaft is now able to compile top level code even if there is a ScriptContext. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/x87/lithium-x87.h » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Store dynamic frame alignment state in the first local. 208 // Store dynamic frame alignment state in the first local.
209 int offset = JavaScriptFrameConstants::kDynamicAlignmentStateOffset; 209 int offset = JavaScriptFrameConstants::kDynamicAlignmentStateOffset;
210 if (dynamic_frame_alignment_) { 210 if (dynamic_frame_alignment_) {
211 __ mov(Operand(ebp, offset), edx); 211 __ mov(Operand(ebp, offset), edx);
212 } else { 212 } else {
213 __ mov(Operand(ebp, offset), Immediate(kNoAlignmentPadding)); 213 __ mov(Operand(ebp, offset), Immediate(kNoAlignmentPadding));
214 } 214 }
215 } 215 }
216 } 216 }
217 } 217 }
218 return !is_aborted();
219 }
220
221
222 void LCodeGen::DoPrologue(LPrologue* instr) {
223 Comment(";;; Prologue begin");
218 224
219 // Possibly allocate a local context. 225 // Possibly allocate a local context.
220 int heap_slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 226 if (info_->num_heap_slots() > 0) {
221 if (heap_slots > 0) {
222 Comment(";;; Allocate local context"); 227 Comment(";;; Allocate local context");
223 bool need_write_barrier = true; 228 bool need_write_barrier = true;
224 // Argument to NewContext is the function, which is still in edi. 229 // Argument to NewContext is the function, which is still in edi.
225 DCHECK(!info()->scope()->is_script_scope()); 230 int slots = info_->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
226 if (heap_slots <= FastNewContextStub::kMaximumSlots) { 231 Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt;
227 FastNewContextStub stub(isolate(), heap_slots); 232 if (info()->scope()->is_script_scope()) {
233 __ push(edi);
234 __ Push(info()->scope()->GetScopeInfo(info()->isolate()));
235 __ CallRuntime(Runtime::kNewScriptContext, 2);
236 deopt_mode = Safepoint::kLazyDeopt;
237 } else if (slots <= FastNewContextStub::kMaximumSlots) {
238 FastNewContextStub stub(isolate(), slots);
228 __ CallStub(&stub); 239 __ CallStub(&stub);
229 // Result of FastNewContextStub is always in new space. 240 // Result of FastNewContextStub is always in new space.
230 need_write_barrier = false; 241 need_write_barrier = false;
231 } else { 242 } else {
232 __ push(edi); 243 __ push(edi);
233 __ CallRuntime(Runtime::kNewFunctionContext, 1); 244 __ CallRuntime(Runtime::kNewFunctionContext, 1);
234 } 245 }
235 RecordSafepoint(Safepoint::kNoLazyDeopt); 246 RecordSafepoint(deopt_mode);
247
236 // Context is returned in eax. It replaces the context passed to us. 248 // Context is returned in eax. It replaces the context passed to us.
237 // It's saved in the stack and kept live in esi. 249 // It's saved in the stack and kept live in esi.
238 __ mov(esi, eax); 250 __ mov(esi, eax);
239 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax); 251 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), eax);
240 252
241 // Copy parameters into context if necessary. 253 // Copy parameters into context if necessary.
242 int num_parameters = scope()->num_parameters(); 254 int num_parameters = scope()->num_parameters();
243 int first_parameter = scope()->has_this_declaration() ? -1 : 0; 255 int first_parameter = scope()->has_this_declaration() ? -1 : 0;
244 for (int i = first_parameter; i < num_parameters; i++) { 256 for (int i = first_parameter; i < num_parameters; i++) {
245 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); 257 Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i);
(...skipping 15 matching lines...) Expand all
261 __ Abort(kExpectedNewSpaceObject); 273 __ Abort(kExpectedNewSpaceObject);
262 __ bind(&done); 274 __ bind(&done);
263 } 275 }
264 } 276 }
265 } 277 }
266 Comment(";;; End allocate local context"); 278 Comment(";;; End allocate local context");
267 } 279 }
268 280
269 // Initailize FPU state. 281 // Initailize FPU state.
270 __ fninit(); 282 __ fninit();
271 // Trace the call. 283
272 if (FLAG_trace && info()->IsOptimizing()) { 284 Comment(";;; Prologue end");
273 // We have not executed any compiled code yet, so esi still holds the
274 // incoming context.
275 __ CallRuntime(Runtime::kTraceEnter, 0);
276 }
277 return !is_aborted();
278 } 285 }
279 286
280 287
281 void LCodeGen::GenerateOsrPrologue() { 288 void LCodeGen::GenerateOsrPrologue() {
282 // Generate the OSR entry prologue at the first unknown OSR value, or if there 289 // Generate the OSR entry prologue at the first unknown OSR value, or if there
283 // are none, at the OSR entrypoint instruction. 290 // are none, at the OSR entrypoint instruction.
284 if (osr_pc_offset_ >= 0) return; 291 if (osr_pc_offset_ >= 0) return;
285 292
286 osr_pc_offset_ = masm()->pc_offset(); 293 osr_pc_offset_ = masm()->pc_offset();
287 294
(...skipping 6073 matching lines...) Expand 10 before | Expand all | Expand 10 after
6361 RecordSafepoint(Safepoint::kNoLazyDeopt); 6368 RecordSafepoint(Safepoint::kNoLazyDeopt);
6362 } 6369 }
6363 6370
6364 6371
6365 #undef __ 6372 #undef __
6366 6373
6367 } // namespace internal 6374 } // namespace internal
6368 } // namespace v8 6375 } // namespace v8
6369 6376
6370 #endif // V8_TARGET_ARCH_X87 6377 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/full-codegen/x87/full-codegen-x87.cc ('k') | src/x87/lithium-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698