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

Side by Side Diff: src/lithium-codegen.cc

Issue 874323003: Externalize deoptimization reasons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/lithium-codegen.h" 5 #include "src/lithium-codegen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 // Copy the string before recording it in the assembler to avoid 146 // Copy the string before recording it in the assembler to avoid
147 // issues when the stack allocated buffer goes out of scope. 147 // issues when the stack allocated buffer goes out of scope.
148 size_t length = builder.position(); 148 size_t length = builder.position();
149 Vector<char> copy = Vector<char>::New(static_cast<int>(length) + 1); 149 Vector<char> copy = Vector<char>::New(static_cast<int>(length) + 1);
150 MemCopy(copy.start(), builder.Finalize(), copy.length()); 150 MemCopy(copy.start(), builder.Finalize(), copy.length());
151 masm()->RecordComment(copy.start()); 151 masm()->RecordComment(copy.start());
152 } 152 }
153 153
154 154
155 void LCodeGenBase::Comment(bool force, const char* string) {
156 size_t length = strlen(string);
157 Vector<char> copy = Vector<char>::New(static_cast<int>(length) + 1);
158 MemCopy(copy.start(), string, copy.length());
159 masm()->RecordComment(copy.start(), force);
160 }
161
162
155 void LCodeGenBase::DeoptComment(const Deoptimizer::Reason& reason) { 163 void LCodeGenBase::DeoptComment(const Deoptimizer::Reason& reason) {
156 std::ostringstream os; 164 masm()->RecordDeoptReason(*reinterpret_cast<const int*>(&reason.deopt_reason),
157 os << ";;; deoptimize at " << HSourcePosition(reason.raw_position) << " " 165 reason.raw_position);
158 << reason.mnemonic;
159 if (reason.detail != NULL) os << ": " << reason.detail;
160 Comment("%s", os.str().c_str());
161 } 166 }
162 167
163 168
164 int LCodeGenBase::GetNextEmittedBlock() const { 169 int LCodeGenBase::GetNextEmittedBlock() const {
165 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { 170 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) {
166 if (!graph()->blocks()->at(i)->IsReachable()) continue; 171 if (!graph()->blocks()->at(i)->IsReachable()) continue;
167 if (!chunk_->GetLabel(i)->HasReplacement()) return i; 172 if (!chunk_->GetLabel(i)->HasReplacement()) return i;
168 } 173 }
169 return -1; 174 return -1;
170 } 175 }
(...skipping 16 matching lines...) Expand all
187 chunk_->AddDeprecationDependency(map); 192 chunk_->AddDeprecationDependency(map);
188 } 193 }
189 194
190 195
191 void LCodeGenBase::AddStabilityDependency(Handle<Map> map) { 196 void LCodeGenBase::AddStabilityDependency(Handle<Map> map) {
192 if (!map->is_stable()) return Retry(kMapBecameUnstable); 197 if (!map->is_stable()) return Retry(kMapBecameUnstable);
193 chunk_->AddStabilityDependency(map); 198 chunk_->AddStabilityDependency(map);
194 } 199 }
195 200
196 } } // namespace v8::internal 201 } } // namespace v8::internal
OLDNEW
« src/ia32/assembler-ia32.h ('K') | « src/lithium-codegen.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698