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

Side by Side Diff: src/arm/deoptimizer-arm.cc

Issue 7585006: ARM: Fix deoptimizer for two-word call sites. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporated review by Kevin Millikin. Created 9 years, 4 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 | « no previous file | src/arm/macro-assembler-arm.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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Get the optimized code. 59 // Get the optimized code.
60 Code* code = function->code(); 60 Code* code = function->code();
61 61
62 // Invalidate the relocation information, as it will become invalid by the 62 // Invalidate the relocation information, as it will become invalid by the
63 // code patching below, and is not needed any more. 63 // code patching below, and is not needed any more.
64 code->InvalidateRelocation(); 64 code->InvalidateRelocation();
65 65
66 // For each return after a safepoint insert an absolute call to the 66 // For each return after a safepoint insert an absolute call to the
67 // corresponding deoptimization entry. 67 // corresponding deoptimization entry.
68 ASSERT(patch_size() % Assembler::kInstrSize == 0);
69 int call_size_in_words = patch_size() / Assembler::kInstrSize;
70 unsigned last_pc_offset = 0; 68 unsigned last_pc_offset = 0;
71 SafepointTable table(function->code()); 69 SafepointTable table(function->code());
72 for (unsigned i = 0; i < table.length(); i++) { 70 for (unsigned i = 0; i < table.length(); i++) {
73 unsigned pc_offset = table.GetPcOffset(i); 71 unsigned pc_offset = table.GetPcOffset(i);
74 SafepointEntry safepoint_entry = table.GetEntry(i); 72 SafepointEntry safepoint_entry = table.GetEntry(i);
75 int deoptimization_index = safepoint_entry.deoptimization_index(); 73 int deoptimization_index = safepoint_entry.deoptimization_index();
76 int gap_code_size = safepoint_entry.gap_code_size(); 74 int gap_code_size = safepoint_entry.gap_code_size();
77 // Check that we did not shoot past next safepoint. 75 // Check that we did not shoot past next safepoint.
78 CHECK(pc_offset >= last_pc_offset); 76 CHECK(pc_offset >= last_pc_offset);
79 #ifdef DEBUG 77 #ifdef DEBUG
80 // Destroy the code which is not supposed to be run again. 78 // Destroy the code which is not supposed to be run again.
81 int instructions = (pc_offset - last_pc_offset) / Assembler::kInstrSize; 79 int instructions = (pc_offset - last_pc_offset) / Assembler::kInstrSize;
82 CodePatcher destroyer(code->instruction_start() + last_pc_offset, 80 CodePatcher destroyer(code->instruction_start() + last_pc_offset,
83 instructions); 81 instructions);
84 for (int x = 0; x < instructions; x++) { 82 for (int x = 0; x < instructions; x++) {
85 destroyer.masm()->bkpt(0); 83 destroyer.masm()->bkpt(0);
86 } 84 }
87 #endif 85 #endif
88 last_pc_offset = pc_offset; 86 last_pc_offset = pc_offset;
89 if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) { 87 if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) {
88 Address deoptimization_entry = Deoptimizer::GetDeoptimizationEntry(
89 deoptimization_index, Deoptimizer::LAZY);
90 last_pc_offset += gap_code_size; 90 last_pc_offset += gap_code_size;
91 int call_size_in_bytes = MacroAssembler::CallSize(deoptimization_entry,
92 RelocInfo::NONE);
93 int call_size_in_words = call_size_in_bytes / Assembler::kInstrSize;
94 ASSERT(call_size_in_bytes % Assembler::kInstrSize == 0);
95 ASSERT(call_size_in_bytes <= patch_size());
91 CodePatcher patcher(code->instruction_start() + last_pc_offset, 96 CodePatcher patcher(code->instruction_start() + last_pc_offset,
92 call_size_in_words); 97 call_size_in_words);
93 Address deoptimization_entry = Deoptimizer::GetDeoptimizationEntry(
94 deoptimization_index, Deoptimizer::LAZY);
95 patcher.masm()->Call(deoptimization_entry, RelocInfo::NONE); 98 patcher.masm()->Call(deoptimization_entry, RelocInfo::NONE);
96 last_pc_offset += patch_size(); 99 last_pc_offset += call_size_in_bytes;
97 } 100 }
98 } 101 }
99 102
100 103
101 #ifdef DEBUG 104 #ifdef DEBUG
102 // Destroy the code which is not supposed to be run again. 105 // Destroy the code which is not supposed to be run again.
103 int instructions = 106 int instructions =
104 (code->safepoint_table_offset() - last_pc_offset) / Assembler::kInstrSize; 107 (code->safepoint_table_offset() - last_pc_offset) / Assembler::kInstrSize;
105 CodePatcher destroyer(code->instruction_start() + last_pc_offset, 108 CodePatcher destroyer(code->instruction_start() + last_pc_offset,
106 instructions); 109 instructions);
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 __ push(ip); 763 __ push(ip);
761 __ b(&done); 764 __ b(&done);
762 ASSERT(masm()->pc_offset() - start == table_entry_size_); 765 ASSERT(masm()->pc_offset() - start == table_entry_size_);
763 } 766 }
764 __ bind(&done); 767 __ bind(&done);
765 } 768 }
766 769
767 #undef __ 770 #undef __
768 771
769 } } // namespace v8::internal 772 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698