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

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

Issue 6606002: Merge revision 6500-6600 from bleeding_edge to the isolates branch. (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
OLDNEW
1 // Copyright 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 21 matching lines...) Expand all
33 #include "deoptimizer.h" 33 #include "deoptimizer.h"
34 #include "full-codegen.h" 34 #include "full-codegen.h"
35 #include "safepoint-table.h" 35 #include "safepoint-table.h"
36 36
37 namespace v8 { 37 namespace v8 {
38 namespace internal { 38 namespace internal {
39 39
40 40
41 int Deoptimizer::table_entry_size_ = 10; 41 int Deoptimizer::table_entry_size_ = 10;
42 42
43
44 int Deoptimizer::patch_size() {
45 return Assembler::kCallInstructionLength;
46 }
47
48
43 void Deoptimizer::DeoptimizeFunction(JSFunction* function) { 49 void Deoptimizer::DeoptimizeFunction(JSFunction* function) {
44 AssertNoAllocation no_allocation; 50 AssertNoAllocation no_allocation;
45 51
46 if (!function->IsOptimized()) return; 52 if (!function->IsOptimized()) return;
47 53
48 // Get the optimized code. 54 // Get the optimized code.
49 Code* code = function->code(); 55 Code* code = function->code();
50 56
51 // Invalidate the relocation information, as it will become invalid by the 57 // Invalidate the relocation information, as it will become invalid by the
52 // code patching below, and is not needed any more. 58 // code patching below, and is not needed any more.
(...skipping 12 matching lines...) Expand all
65 // Destroy the code which is not supposed to run again. 71 // Destroy the code which is not supposed to run again.
66 unsigned instructions = pc_offset - last_pc_offset; 72 unsigned instructions = pc_offset - last_pc_offset;
67 CodePatcher destroyer(code->instruction_start() + last_pc_offset, 73 CodePatcher destroyer(code->instruction_start() + last_pc_offset,
68 instructions); 74 instructions);
69 for (unsigned i = 0; i < instructions; i++) { 75 for (unsigned i = 0; i < instructions; i++) {
70 destroyer.masm()->int3(); 76 destroyer.masm()->int3();
71 } 77 }
72 #endif 78 #endif
73 last_pc_offset = pc_offset; 79 last_pc_offset = pc_offset;
74 if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) { 80 if (deoptimization_index != Safepoint::kNoDeoptimizationIndex) {
75 CodePatcher patcher( 81 last_pc_offset += gap_code_size;
76 code->instruction_start() + pc_offset + gap_code_size, 82 CodePatcher patcher(code->instruction_start() + last_pc_offset,
77 Assembler::kCallInstructionLength); 83 patch_size());
78 patcher.masm()->Call(GetDeoptimizationEntry(deoptimization_index, LAZY), 84 patcher.masm()->Call(GetDeoptimizationEntry(deoptimization_index, LAZY),
79 RelocInfo::NONE); 85 RelocInfo::NONE);
80 last_pc_offset += gap_code_size + Assembler::kCallInstructionLength; 86 last_pc_offset += patch_size();
81 } 87 }
82 } 88 }
83 #ifdef DEBUG 89 #ifdef DEBUG
84 // Destroy the code which is not supposed to run again. 90 // Destroy the code which is not supposed to run again.
91 CHECK(code->safepoint_table_start() >= last_pc_offset);
85 unsigned instructions = code->safepoint_table_start() - last_pc_offset; 92 unsigned instructions = code->safepoint_table_start() - last_pc_offset;
86 CodePatcher destroyer(code->instruction_start() + last_pc_offset, 93 CodePatcher destroyer(code->instruction_start() + last_pc_offset,
87 instructions); 94 instructions);
88 for (unsigned i = 0; i < instructions; i++) { 95 for (unsigned i = 0; i < instructions; i++) {
89 destroyer.masm()->int3(); 96 destroyer.masm()->int3();
90 } 97 }
91 #endif 98 #endif
92 99
93 // Add the deoptimizing code to the list. 100 // Add the deoptimizing code to the list.
94 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code); 101 DeoptimizingCodeListNode* node = new DeoptimizingCodeListNode(code);
95 DeoptimizerData* data = Isolate::Current()->deoptimizer_data(); 102 DeoptimizerData* data = Isolate::Current()->deoptimizer_data();
96 node->set_next(data->deoptimizing_code_list_); 103 node->set_next(data->deoptimizing_code_list_);
97 data->deoptimizing_code_list_ = node; 104 data->deoptimizing_code_list_ = node;
98 105
99 // Set the code for the function to non-optimized version. 106 // Set the code for the function to non-optimized version.
100 function->ReplaceCode(function->shared()->code()); 107 function->ReplaceCode(function->shared()->code());
101 108
102 if (FLAG_trace_deopt) { 109 if (FLAG_trace_deopt) {
103 PrintF("[forced deoptimization: "); 110 PrintF("[forced deoptimization: ");
104 function->PrintName(); 111 function->PrintName();
105 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function)); 112 PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(function));
106 } 113 }
107 } 114 }
108 115
109 116
110 void Deoptimizer::PatchStackCheckCode(Code* unoptimized_code, 117 void Deoptimizer::PatchStackCheckCodeAt(Address pc_after,
111 Code* check_code, 118 Code* check_code,
112 Code* replacement_code) { 119 Code* replacement_code) {
113 UNIMPLEMENTED(); 120 UNIMPLEMENTED();
114 } 121 }
115 122
116 123
117 void Deoptimizer::RevertStackCheckCode(Code* unoptimized_code, 124 void Deoptimizer::RevertStackCheckCodeAt(Address pc_after,
118 Code* check_code, 125 Code* check_code,
119 Code* replacement_code) { 126 Code* replacement_code) {
120 UNIMPLEMENTED(); 127 UNIMPLEMENTED();
121 } 128 }
122 129
123 130
124 void Deoptimizer::DoComputeOsrOutputFrame() { 131 void Deoptimizer::DoComputeOsrOutputFrame() {
125 UNIMPLEMENTED(); 132 UNIMPLEMENTED();
126 } 133 }
127 134
128 135
129 void Deoptimizer::DoComputeFrame(TranslationIterator* iterator, 136 void Deoptimizer::DoComputeFrame(TranslationIterator* iterator,
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 } 508 }
502 __ bind(&done); 509 __ bind(&done);
503 } 510 }
504 511
505 #undef __ 512 #undef __
506 513
507 514
508 } } // namespace v8::internal 515 } } // namespace v8::internal
509 516
510 #endif // V8_TARGET_ARCH_X64 517 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/ast.cc ('K') | « src/x64/codegen-x64.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698