OLD | NEW |
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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 void LCodeGen::WriteTranslation(LEnvironment* environment, | 439 void LCodeGen::WriteTranslation(LEnvironment* environment, |
440 Translation* translation) { | 440 Translation* translation) { |
441 if (environment == NULL) return; | 441 if (environment == NULL) return; |
442 | 442 |
443 // The translation includes one command per value in the environment. | 443 // The translation includes one command per value in the environment. |
444 int translation_size = environment->values()->length(); | 444 int translation_size = environment->values()->length(); |
445 // The output frame height does not include the parameters. | 445 // The output frame height does not include the parameters. |
446 int height = translation_size - environment->parameter_count(); | 446 int height = translation_size - environment->parameter_count(); |
447 | 447 |
448 WriteTranslation(environment->outer(), translation); | 448 WriteTranslation(environment->outer(), translation); |
449 int closure_id = DefineDeoptimizationLiteral(environment->closure()); | 449 int closure_id = *info()->closure() != *environment->closure() |
| 450 ? DefineDeoptimizationLiteral(environment->closure()) |
| 451 : Translation::kSelfLiteralId; |
| 452 |
450 switch (environment->frame_type()) { | 453 switch (environment->frame_type()) { |
451 case JS_FUNCTION: | 454 case JS_FUNCTION: |
452 translation->BeginJSFrame(environment->ast_id(), closure_id, height); | 455 translation->BeginJSFrame(environment->ast_id(), closure_id, height); |
453 break; | 456 break; |
454 case JS_CONSTRUCT: | 457 case JS_CONSTRUCT: |
455 translation->BeginConstructStubFrame(closure_id, translation_size); | 458 translation->BeginConstructStubFrame(closure_id, translation_size); |
456 break; | 459 break; |
457 case ARGUMENTS_ADAPTOR: | 460 case ARGUMENTS_ADAPTOR: |
458 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); | 461 translation->BeginArgumentsAdaptorFrame(closure_id, translation_size); |
459 break; | 462 break; |
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2840 } | 2843 } |
2841 | 2844 |
2842 | 2845 |
2843 void LCodeGen::DoDrop(LDrop* instr) { | 2846 void LCodeGen::DoDrop(LDrop* instr) { |
2844 __ Drop(instr->count()); | 2847 __ Drop(instr->count()); |
2845 } | 2848 } |
2846 | 2849 |
2847 | 2850 |
2848 void LCodeGen::DoThisFunction(LThisFunction* instr) { | 2851 void LCodeGen::DoThisFunction(LThisFunction* instr) { |
2849 Register result = ToRegister(instr->result()); | 2852 Register result = ToRegister(instr->result()); |
2850 __ LoadHeapObject(result, instr->hydrogen()->closure()); | 2853 __ lw(result, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
2851 } | 2854 } |
2852 | 2855 |
2853 | 2856 |
2854 void LCodeGen::DoContext(LContext* instr) { | 2857 void LCodeGen::DoContext(LContext* instr) { |
2855 Register result = ToRegister(instr->result()); | 2858 Register result = ToRegister(instr->result()); |
2856 __ mov(result, cp); | 2859 __ mov(result, cp); |
2857 } | 2860 } |
2858 | 2861 |
2859 | 2862 |
2860 void LCodeGen::DoOuterContext(LOuterContext* instr) { | 2863 void LCodeGen::DoOuterContext(LOuterContext* instr) { |
(...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5203 __ Subu(scratch, result, scratch); | 5206 __ Subu(scratch, result, scratch); |
5204 __ lw(result, FieldMemOperand(scratch, | 5207 __ lw(result, FieldMemOperand(scratch, |
5205 FixedArray::kHeaderSize - kPointerSize)); | 5208 FixedArray::kHeaderSize - kPointerSize)); |
5206 __ bind(&done); | 5209 __ bind(&done); |
5207 } | 5210 } |
5208 | 5211 |
5209 | 5212 |
5210 #undef __ | 5213 #undef __ |
5211 | 5214 |
5212 } } // namespace v8::internal | 5215 } } // namespace v8::internal |
OLD | NEW |