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

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

Issue 587623002: Introduce a class to carry around a deoptimization reason. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Re-added a few Comment calls which were accidentally removed. Created 6 years, 3 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/x87/lithium-codegen-x87.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 if (jump_table_.length() > 0) { 379 if (jump_table_.length() > 0) {
380 Comment(";;; -------------------- Jump table --------------------"); 380 Comment(";;; -------------------- Jump table --------------------");
381 } 381 }
382 for (int i = 0; i < jump_table_.length(); i++) { 382 for (int i = 0; i < jump_table_.length(); i++) {
383 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i]; 383 Deoptimizer::JumpTableEntry* table_entry = &jump_table_[i];
384 __ bind(&table_entry->label); 384 __ bind(&table_entry->label);
385 Address entry = table_entry->address; 385 Address entry = table_entry->address;
386 Deoptimizer::BailoutType type = table_entry->bailout_type; 386 Deoptimizer::BailoutType type = table_entry->bailout_type;
387 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); 387 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
388 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); 388 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
389 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); 389 DeoptComment(table_entry->reason);
390 DeoptComment(table_entry->mnemonic, table_entry->reason);
391 if (table_entry->needs_frame) { 390 if (table_entry->needs_frame) {
392 DCHECK(!info()->saves_caller_doubles()); 391 DCHECK(!info()->saves_caller_doubles());
393 __ push(Immediate(ExternalReference::ForDeoptEntry(entry))); 392 __ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
394 if (needs_frame.is_bound()) { 393 if (needs_frame.is_bound()) {
395 __ jmp(&needs_frame); 394 __ jmp(&needs_frame);
396 } else { 395 } else {
397 __ bind(&needs_frame); 396 __ bind(&needs_frame);
398 __ push(MemOperand(ebp, StandardFrameConstants::kContextOffset)); 397 __ push(MemOperand(ebp, StandardFrameConstants::kContextOffset));
399 // This variant of deopt can only be used with stubs. Since we don't 398 // This variant of deopt can only be used with stubs. Since we don't
400 // have a function pointer to install in the stack frame that we're 399 // have a function pointer to install in the stack frame that we're
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 int pc_offset = masm()->pc_offset(); 1078 int pc_offset = masm()->pc_offset();
1080 environment->Register(deoptimization_index, 1079 environment->Register(deoptimization_index,
1081 translation.index(), 1080 translation.index(),
1082 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); 1081 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
1083 deoptimizations_.Add(environment, zone()); 1082 deoptimizations_.Add(environment, zone());
1084 } 1083 }
1085 } 1084 }
1086 1085
1087 1086
1088 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, 1087 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
1089 const char* reason, 1088 const char* detail,
1090 Deoptimizer::BailoutType bailout_type) { 1089 Deoptimizer::BailoutType bailout_type) {
1091 LEnvironment* environment = instr->environment(); 1090 LEnvironment* environment = instr->environment();
1092 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 1091 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
1093 DCHECK(environment->HasBeenRegistered()); 1092 DCHECK(environment->HasBeenRegistered());
1094 int id = environment->deoptimization_index(); 1093 int id = environment->deoptimization_index();
1095 DCHECK(info()->IsOptimizing() || info()->IsStub()); 1094 DCHECK(info()->IsOptimizing() || info()->IsStub());
1096 Address entry = 1095 Address entry =
1097 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 1096 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
1098 if (entry == NULL) { 1097 if (entry == NULL) {
1099 Abort(kBailoutWasNotPrepared); 1098 Abort(kBailoutWasNotPrepared);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 __ bind(&done); 1141 __ bind(&done);
1143 } 1142 }
1144 1143
1145 if (info()->ShouldTrapOnDeopt()) { 1144 if (info()->ShouldTrapOnDeopt()) {
1146 Label done; 1145 Label done;
1147 if (cc != no_condition) __ j(NegateCondition(cc), &done, Label::kNear); 1146 if (cc != no_condition) __ j(NegateCondition(cc), &done, Label::kNear);
1148 __ int3(); 1147 __ int3();
1149 __ bind(&done); 1148 __ bind(&done);
1150 } 1149 }
1151 1150
1151 Deoptimizer::Reason reason(instr->Mnemonic(), detail);
1152 DCHECK(info()->IsStub() || frame_is_built_); 1152 DCHECK(info()->IsStub() || frame_is_built_);
1153 if (cc == no_condition && frame_is_built_) { 1153 if (cc == no_condition && frame_is_built_) {
1154 DeoptComment(instr->Mnemonic(), reason); 1154 DeoptComment(reason);
1155 __ call(entry, RelocInfo::RUNTIME_ENTRY); 1155 __ call(entry, RelocInfo::RUNTIME_ENTRY);
1156 } else { 1156 } else {
1157 // We often have several deopts to the same entry, reuse the last 1157 // We often have several deopts to the same entry, reuse the last
1158 // jump entry if this is the case. 1158 // jump entry if this is the case.
1159 if (jump_table_.is_empty() || 1159 if (jump_table_.is_empty() ||
1160 jump_table_.last().address != entry || 1160 jump_table_.last().address != entry ||
1161 jump_table_.last().needs_frame != !frame_is_built_ || 1161 jump_table_.last().needs_frame != !frame_is_built_ ||
1162 jump_table_.last().bailout_type != bailout_type) { 1162 jump_table_.last().bailout_type != bailout_type) {
1163 Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, 1163 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
1164 bailout_type, !frame_is_built_); 1164 !frame_is_built_);
1165 jump_table_.Add(table_entry, zone()); 1165 jump_table_.Add(table_entry, zone());
1166 } 1166 }
1167 if (cc == no_condition) { 1167 if (cc == no_condition) {
1168 __ jmp(&jump_table_.last().label); 1168 __ jmp(&jump_table_.last().label);
1169 } else { 1169 } else {
1170 __ j(cc, &jump_table_.last().label); 1170 __ j(cc, &jump_table_.last().label);
1171 } 1171 }
1172 } 1172 }
1173 } 1173 }
1174 1174
1175 1175
1176 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr, 1176 void LCodeGen::DeoptimizeIf(Condition cc, LInstruction* instr,
1177 const char* reason) { 1177 const char* detail) {
1178 Deoptimizer::BailoutType bailout_type = info()->IsStub() 1178 Deoptimizer::BailoutType bailout_type = info()->IsStub()
1179 ? Deoptimizer::LAZY 1179 ? Deoptimizer::LAZY
1180 : Deoptimizer::EAGER; 1180 : Deoptimizer::EAGER;
1181 DeoptimizeIf(cc, instr, reason, bailout_type); 1181 DeoptimizeIf(cc, instr, detail, bailout_type);
1182 } 1182 }
1183 1183
1184 1184
1185 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 1185 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
1186 int length = deoptimizations_.length(); 1186 int length = deoptimizations_.length();
1187 if (length == 0) return; 1187 if (length == 0) return;
1188 Handle<DeoptimizationInputData> data = 1188 Handle<DeoptimizationInputData> data =
1189 DeoptimizationInputData::New(isolate(), length, TENURED); 1189 DeoptimizationInputData::New(isolate(), length, TENURED);
1190 1190
1191 Handle<ByteArray> translations = 1191 Handle<ByteArray> translations =
(...skipping 5060 matching lines...) Expand 10 before | Expand all | Expand 10 after
6252 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6252 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6253 RecordSafepoint(Safepoint::kNoLazyDeopt); 6253 RecordSafepoint(Safepoint::kNoLazyDeopt);
6254 } 6254 }
6255 6255
6256 6256
6257 #undef __ 6257 #undef __
6258 6258
6259 } } // namespace v8::internal 6259 } } // namespace v8::internal
6260 6260
6261 #endif // V8_TARGET_ARCH_X87 6261 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/lithium-codegen-x87.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698