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

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

Issue 6142011: Crankshaft: Move LEnvironment and LPointerMap classes to platform-independent... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 11 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/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Local or spill slot. Skip the frame pointer, function, and 254 // Local or spill slot. Skip the frame pointer, function, and
255 // context in the fixed part of the frame. 255 // context in the fixed part of the frame.
256 return Operand(ebp, -(index + 3) * kPointerSize); 256 return Operand(ebp, -(index + 3) * kPointerSize);
257 } else { 257 } else {
258 // Incoming parameter. Skip the return address. 258 // Incoming parameter. Skip the return address.
259 return Operand(ebp, -(index - 1) * kPointerSize); 259 return Operand(ebp, -(index - 1) * kPointerSize);
260 } 260 }
261 } 261 }
262 262
263 263
264 void LCodeGen::WriteTranslation(LEnvironment* environment,
265 Translation* translation) {
266 if (environment == NULL) return;
267
268 // The translation includes one command per value in the environment.
269 int translation_size = environment->values()->length();
270 // The output frame height does not include the parameters.
271 int height = translation_size - environment->parameter_count();
272
273 WriteTranslation(environment->outer(), translation);
274 int closure_id = DefineDeoptimizationLiteral(environment->closure());
275 translation->BeginFrame(environment->ast_id(), closure_id, height);
276 for (int i = 0; i < translation_size; ++i) {
277 LOperand* value = environment->values()->at(i);
278 // spilled_registers_ and spilled_double_registers_ are either
279 // both NULL or both set.
280 if (environment->spilled_registers() != NULL && value != NULL) {
281 if (value->IsRegister() &&
282 environment->spilled_registers()[value->index()] != NULL) {
283 translation->MarkDuplicate();
284 AddToTranslation(translation,
285 environment->spilled_registers()[value->index()],
286 environment->HasTaggedValueAt(i));
287 } else if (
288 value->IsDoubleRegister() &&
289 environment->spilled_double_registers()[value->index()] != NULL) {
290 translation->MarkDuplicate();
291 AddToTranslation(
292 translation,
293 environment->spilled_double_registers()[value->index()],
294 false);
295 }
296 }
297
298 AddToTranslation(translation, value, environment->HasTaggedValueAt(i));
299 }
300 }
301
302
264 void LCodeGen::AddToTranslation(Translation* translation, 303 void LCodeGen::AddToTranslation(Translation* translation,
265 LOperand* op, 304 LOperand* op,
266 bool is_tagged) { 305 bool is_tagged) {
267 if (op == NULL) { 306 if (op == NULL) {
268 // TODO(twuerthinger): Introduce marker operands to indicate that this value 307 // TODO(twuerthinger): Introduce marker operands to indicate that this value
269 // is not present and must be reconstructed from the deoptimizer. Currently 308 // is not present and must be reconstructed from the deoptimizer. Currently
270 // this is only used for the arguments object. 309 // this is only used for the arguments object.
271 translation->StoreArgumentsObject(); 310 translation->StoreArgumentsObject();
272 } else if (op->IsStackSlot()) { 311 } else if (op->IsStackSlot()) {
273 if (is_tagged) { 312 if (is_tagged) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Layout of the translation: 417 // Layout of the translation:
379 // 0 ........................................................ size - 1 + 4 418 // 0 ........................................................ size - 1 + 4
380 // [expression stack including arguments] [locals] [4 words] [parameters] 419 // [expression stack including arguments] [locals] [4 words] [parameters]
381 // |>------------ translation_size ------------<| 420 // |>------------ translation_size ------------<|
382 421
383 int frame_count = 0; 422 int frame_count = 0;
384 for (LEnvironment* e = environment; e != NULL; e = e->outer()) { 423 for (LEnvironment* e = environment; e != NULL; e = e->outer()) {
385 ++frame_count; 424 ++frame_count;
386 } 425 }
387 Translation translation(&translations_, frame_count); 426 Translation translation(&translations_, frame_count);
388 environment->WriteTranslation(this, &translation); 427 WriteTranslation(environment, &translation);
389 int deoptimization_index = deoptimizations_.length(); 428 int deoptimization_index = deoptimizations_.length();
390 environment->Register(deoptimization_index, translation.index()); 429 environment->Register(deoptimization_index, translation.index());
391 deoptimizations_.Add(environment); 430 deoptimizations_.Add(environment);
392 } 431 }
393 } 432 }
394 433
395 434
396 void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) { 435 void LCodeGen::DeoptimizeIf(Condition cc, LEnvironment* environment) {
397 RegisterEnvironmentForDeoptimization(environment); 436 RegisterEnvironmentForDeoptimization(environment);
398 ASSERT(environment->HasBeenRegistered()); 437 ASSERT(environment->HasBeenRegistered());
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
3437 ASSERT(!environment->HasBeenRegistered()); 3476 ASSERT(!environment->HasBeenRegistered());
3438 RegisterEnvironmentForDeoptimization(environment); 3477 RegisterEnvironmentForDeoptimization(environment);
3439 ASSERT(osr_pc_offset_ == -1); 3478 ASSERT(osr_pc_offset_ == -1);
3440 osr_pc_offset_ = masm()->pc_offset(); 3479 osr_pc_offset_ = masm()->pc_offset();
3441 } 3480 }
3442 3481
3443 3482
3444 #undef __ 3483 #undef __
3445 3484
3446 } } // namespace v8::internal 3485 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698