OLD | NEW |
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 18 matching lines...) Expand all Loading... |
29 #include "code-stubs.h" | 29 #include "code-stubs.h" |
30 #include "stub-cache.h" | 30 #include "stub-cache.h" |
31 | 31 |
32 namespace v8 { | 32 namespace v8 { |
33 namespace internal { | 33 namespace internal { |
34 | 34 |
35 | 35 |
36 #define __ masm()-> | 36 #define __ masm()-> |
37 | 37 |
38 | 38 |
| 39 void LCodeGen::WriteTranslation(LEnvironment* environment, |
| 40 Translation* translation) { |
| 41 if (environment == NULL) return; |
| 42 |
| 43 // The translation includes one command per value in the environment. |
| 44 int translation_size = environment->values()->length(); |
| 45 // The output frame height does not include the parameters. |
| 46 int height = translation_size - environment->parameter_count(); |
| 47 |
| 48 WriteTranslation(environment->outer(), translation); |
| 49 int closure_id = DefineDeoptimizationLiteral(environment->closure()); |
| 50 translation->BeginFrame(environment->ast_id(), closure_id, height); |
| 51 for (int i = 0; i < translation_size; ++i) { |
| 52 LOperand* value = environment->values()->at(i); |
| 53 // spilled_registers_ and spilled_double_registers_ are either |
| 54 // both NULL or both set. |
| 55 if (environment->spilled_registers() != NULL && value != NULL) { |
| 56 if (value->IsRegister() && |
| 57 environment->spilled_registers()[value->index()] != NULL) { |
| 58 translation->MarkDuplicate(); |
| 59 AddToTranslation(translation, |
| 60 environment->spilled_registers()[value->index()], |
| 61 environment->HasTaggedValueAt(i)); |
| 62 } else if ( |
| 63 value->IsDoubleRegister() && |
| 64 environment->spilled_double_registers()[value->index()] != NULL) { |
| 65 translation->MarkDuplicate(); |
| 66 AddToTranslation( |
| 67 translation, |
| 68 environment->spilled_double_registers()[value->index()], |
| 69 false); |
| 70 } |
| 71 } |
| 72 |
| 73 AddToTranslation(translation, value, environment->HasTaggedValueAt(i)); |
| 74 } |
| 75 } |
| 76 |
| 77 |
39 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { | 78 void LCodeGen::DoLazyBailout(LLazyBailout* instr) { |
40 // No code for lazy bailout instruction. Used to capture environment after a | 79 // No code for lazy bailout instruction. Used to capture environment after a |
41 // call for populating the safepoint data with deoptimization data. | 80 // call for populating the safepoint data with deoptimization data. |
42 } | 81 } |
43 | 82 |
44 | 83 |
45 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 84 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
46 DeoptimizeIf(no_condition, instr->environment()); | 85 DeoptimizeIf(no_condition, instr->environment()); |
47 } | 86 } |
48 | 87 |
49 | 88 |
50 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 89 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
51 UNIMPLEMENTED(); | 90 UNIMPLEMENTED(); |
52 } | 91 } |
53 | 92 |
54 | 93 |
55 #undef __ | 94 #undef __ |
56 | 95 |
57 } } // namespace v8::internal | 96 } } // namespace v8::internal |
OLD | NEW |