| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  138   } |  138   } | 
|  139  |  139  | 
|  140   // We will overwrite the code's relocation info in-place. Relocation info |  140   // We will overwrite the code's relocation info in-place. Relocation info | 
|  141   // is written backward. The relocation info is the payload of a byte |  141   // is written backward. The relocation info is the payload of a byte | 
|  142   // array.  Later on we will slide this to the start of the byte array and |  142   // array.  Later on we will slide this to the start of the byte array and | 
|  143   // create a filler object in the remaining space. |  143   // create a filler object in the remaining space. | 
|  144   ByteArray* reloc_info = code->relocation_info(); |  144   ByteArray* reloc_info = code->relocation_info(); | 
|  145   Address reloc_end_address = reloc_info->address() + reloc_info->Size(); |  145   Address reloc_end_address = reloc_info->address() + reloc_info->Size(); | 
|  146   RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address); |  146   RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address); | 
|  147  |  147  | 
|  148   // For each LLazyBailout instruction insert a call to the corresponding |  | 
|  149   // deoptimization entry. |  | 
|  150  |  | 
|  151   // Since the call is a relative encoding, write new |  148   // Since the call is a relative encoding, write new | 
|  152   // reloc info.  We do not need any of the existing reloc info because the |  149   // reloc info.  We do not need any of the existing reloc info because the | 
|  153   // existing code will not be used again (we zap it in debug builds). |  150   // existing code will not be used again (we zap it in debug builds). | 
|  154   // |  151   // | 
|  155   // Emit call to lazy deoptimization at all lazy deopt points. |  152   // Emit call to lazy deoptimization at all lazy deopt points. | 
|  156   DeoptimizationInputData* deopt_data = |  153   DeoptimizationInputData* deopt_data = | 
|  157       DeoptimizationInputData::cast(code->deoptimization_data()); |  154       DeoptimizationInputData::cast(code->deoptimization_data()); | 
 |  155   SharedFunctionInfo* shared = | 
 |  156       SharedFunctionInfo::cast(deopt_data->SharedFunctionInfo()); | 
 |  157   shared->EvictFromOptimizedCodeMap(code, "deoptimized code"); | 
|  158 #ifdef DEBUG |  158 #ifdef DEBUG | 
|  159   Address prev_call_address = NULL; |  159   Address prev_call_address = NULL; | 
|  160 #endif |  160 #endif | 
 |  161   // For each LLazyBailout instruction insert a call to the corresponding | 
 |  162   // deoptimization entry. | 
|  161   for (int i = 0; i < deopt_data->DeoptCount(); i++) { |  163   for (int i = 0; i < deopt_data->DeoptCount(); i++) { | 
|  162     if (deopt_data->Pc(i)->value() == -1) continue; |  164     if (deopt_data->Pc(i)->value() == -1) continue; | 
|  163     // Patch lazy deoptimization entry. |  165     // Patch lazy deoptimization entry. | 
|  164     Address call_address = code_start_address + deopt_data->Pc(i)->value(); |  166     Address call_address = code_start_address + deopt_data->Pc(i)->value(); | 
|  165     CodePatcher patcher(call_address, patch_size()); |  167     CodePatcher patcher(call_address, patch_size()); | 
|  166     Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); |  168     Address deopt_entry = GetDeoptimizationEntry(isolate, i, LAZY); | 
|  167     patcher.masm()->call(deopt_entry, RelocInfo::NONE32); |  169     patcher.masm()->call(deopt_entry, RelocInfo::NONE32); | 
|  168     // We use RUNTIME_ENTRY for deoptimization bailouts. |  170     // We use RUNTIME_ENTRY for deoptimization bailouts. | 
|  169     RelocInfo rinfo(call_address + 1,  // 1 after the call opcode. |  171     RelocInfo rinfo(call_address + 1,  // 1 after the call opcode. | 
|  170                     RelocInfo::RUNTIME_ENTRY, |  172                     RelocInfo::RUNTIME_ENTRY, | 
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  460   SetFrameSlot(offset, value); |  462   SetFrameSlot(offset, value); | 
|  461 } |  463 } | 
|  462  |  464  | 
|  463  |  465  | 
|  464 #undef __ |  466 #undef __ | 
|  465  |  467  | 
|  466  |  468  | 
|  467 } }  // namespace v8::internal |  469 } }  // namespace v8::internal | 
|  468  |  470  | 
|  469 #endif  // V8_TARGET_ARCH_IA32 |  471 #endif  // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |