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

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

Issue 6683022: [Isolates] Merge 7111:7152 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 years, 9 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/arm/code-stubs-arm.cc ('k') | src/arm/lithium-codegen-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 28 matching lines...) Expand all
39 39
40 40
41 int Deoptimizer::patch_size() { 41 int Deoptimizer::patch_size() {
42 const int kCallInstructionSizeInWords = 3; 42 const int kCallInstructionSizeInWords = 3;
43 return kCallInstructionSizeInWords * Assembler::kInstrSize; 43 return kCallInstructionSizeInWords * Assembler::kInstrSize;
44 } 44 }
45 45
46 46
47 47
48 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 48 void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
49 HandleScope scope;
49 AssertNoAllocation no_allocation; 50 AssertNoAllocation no_allocation;
50 51
51 if (!function->IsOptimized()) return; 52 if (!function->IsOptimized()) return;
52 53
53 // Get the optimized code. 54 // Get the optimized code.
54 Code* code = function->code(); 55 Code* code = function->code();
55 56
56 // Invalidate the relocation information, as it will become invalid by the 57 // Invalidate the relocation information, as it will become invalid by the
57 // code patching below, and is not needed any more. 58 // code patching below, and is not needed any more.
58 code->InvalidateRelocation(); 59 code->InvalidateRelocation();
59 60
60 // For each return after a safepoint insert an absolute call to the 61 // For each return after a safepoint insert an absolute call to the
61 // corresponding deoptimization entry. 62 // corresponding deoptimization entry.
62 ASSERT(patch_size() % Assembler::kInstrSize == 0); 63 ASSERT(patch_size() % Assembler::kInstrSize == 0);
63 int call_size_in_words = patch_size() / Assembler::kInstrSize; 64 int call_size_in_words = patch_size() / Assembler::kInstrSize;
64 unsigned last_pc_offset = 0; 65 unsigned last_pc_offset = 0;
65 SafepointTable table(function->code()); 66 SafepointTable table(function->code());
66 for (unsigned i = 0; i < table.length(); i++) { 67 for (unsigned i = 0; i < table.length(); i++) {
67 unsigned pc_offset = table.GetPcOffset(i); 68 unsigned pc_offset = table.GetPcOffset(i);
68 SafepointEntry safepoint_entry = table.GetEntry(i); 69 SafepointEntry safepoint_entry = table.GetEntry(i);
69 int deoptimization_index = safepoint_entry.deoptimization_index(); 70 int deoptimization_index = safepoint_entry.deoptimization_index();
70 int gap_code_size = safepoint_entry.gap_code_size(); 71 int gap_code_size = safepoint_entry.gap_code_size();
71 // Check that we did not shoot past next safepoint. 72 // Check that we did not shoot past next safepoint.
72 // TODO(srdjan): How do we guarantee that safepoint code does not
73 // overlap other safepoint patching code?
74 CHECK(pc_offset >= last_pc_offset); 73 CHECK(pc_offset >= last_pc_offset);
75 #ifdef DEBUG 74 #ifdef DEBUG
76 // Destroy the code which is not supposed to be run again. 75 // Destroy the code which is not supposed to be run again.
77 int instructions = (pc_offset - last_pc_offset) / Assembler::kInstrSize; 76 int instructions = (pc_offset - last_pc_offset) / Assembler::kInstrSize;
78 CodePatcher destroyer(code->instruction_start() + last_pc_offset, 77 CodePatcher destroyer(code->instruction_start() + last_pc_offset,
79 instructions); 78 instructions);
80 for (int x = 0; x < instructions; x++) { 79 for (int x = 0; x < instructions; x++) {
81 destroyer.masm()->bkpt(0); 80 destroyer.masm()->bkpt(0);
82 } 81 }
83 #endif 82 #endif
(...skipping 27 matching lines...) Expand all
111 node->set_next(data->deoptimizing_code_list_); 110 node->set_next(data->deoptimizing_code_list_);
112 data->deoptimizing_code_list_ = node; 111 data->deoptimizing_code_list_ = node;
113 112
114 // Set the code for the function to non-optimized version. 113 // Set the code for the function to non-optimized version.
115 function->ReplaceCode(function->shared()->code()); 114 function->ReplaceCode(function->shared()->code());
116 115
117 if (FLAG_trace_deopt) { 116 if (FLAG_trace_deopt) {
118 PrintF("[forced deoptimization: "); 117 PrintF("[forced deoptimization: ");
119 function->PrintName(); 118 function->PrintName();
120 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function)); 119 PrintF(" / %x]\n", reinterpret_cast<uint32_t>(function));
120 #ifdef DEBUG
121 if (FLAG_print_code) {
122 code->PrintLn();
123 }
124 #endif
121 } 125 }
122 } 126 }
123 127
124 128
125 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after, 129 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after,
126 Code* check_code, 130 Code* check_code,
127 Code* replacement_code) { 131 Code* replacement_code) {
128 const int kInstrSize = Assembler::kInstrSize; 132 const int kInstrSize = Assembler::kInstrSize;
129 // The call of the stack guard check has the following form: 133 // The call of the stack guard check has the following form:
130 // e1 5d 00 0c cmp sp, <limit> 134 // e1 5d 00 0c cmp sp, <limit>
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 __ push(ip); 699 __ push(ip);
696 __ b(&done); 700 __ b(&done);
697 ASSERT(masm()->pc_offset() - start == table_entry_size_); 701 ASSERT(masm()->pc_offset() - start == table_entry_size_);
698 } 702 }
699 __ bind(&done); 703 __ bind(&done);
700 } 704 }
701 705
702 #undef __ 706 #undef __
703 707
704 } } // namespace v8::internal 708 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/lithium-codegen-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698