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

Side by Side Diff: src/arm/lithium-codegen-arm.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/arm/lithium-codegen-arm.h ('k') | src/arm64/lithium-codegen-arm64.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 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 #include "src/arm/lithium-codegen-arm.h" 7 #include "src/arm/lithium-codegen-arm.h"
8 #include "src/arm/lithium-gap-resolver-arm.h" 8 #include "src/arm/lithium-gap-resolver-arm.h"
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 for (int i = 0; i < length; i++) { 335 for (int i = 0; i < length; i++) {
336 Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i]; 336 Deoptimizer::JumpTableEntry* table_entry = &deopt_jump_table_[i];
337 __ bind(&table_entry->label); 337 __ bind(&table_entry->label);
338 338
339 Deoptimizer::BailoutType type = table_entry->bailout_type; 339 Deoptimizer::BailoutType type = table_entry->bailout_type;
340 DCHECK(type == deopt_jump_table_[0].bailout_type); 340 DCHECK(type == deopt_jump_table_[0].bailout_type);
341 Address entry = table_entry->address; 341 Address entry = table_entry->address;
342 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type); 342 int id = Deoptimizer::GetDeoptimizationId(isolate(), entry, type);
343 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id); 343 DCHECK_NE(Deoptimizer::kNotDeoptimizationEntry, id);
344 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id); 344 Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
345 DeoptComment(table_entry->mnemonic, table_entry->reason); 345 DeoptComment(table_entry->reason);
346 346
347 // Second-level deopt table entries are contiguous and small, so instead 347 // Second-level deopt table entries are contiguous and small, so instead
348 // of loading the full, absolute address of each one, load an immediate 348 // of loading the full, absolute address of each one, load an immediate
349 // offset which will be added to the base address later. 349 // offset which will be added to the base address later.
350 __ mov(entry_offset, Operand(entry - base)); 350 __ mov(entry_offset, Operand(entry - base));
351 351
352 if (table_entry->needs_frame) { 352 if (table_entry->needs_frame) {
353 DCHECK(!info()->saves_caller_doubles()); 353 DCHECK(!info()->saves_caller_doubles());
354 if (needs_frame.is_bound()) { 354 if (needs_frame.is_bound()) {
355 __ b(&needs_frame); 355 __ b(&needs_frame);
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 int pc_offset = masm()->pc_offset(); 839 int pc_offset = masm()->pc_offset();
840 environment->Register(deoptimization_index, 840 environment->Register(deoptimization_index,
841 translation.index(), 841 translation.index(),
842 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1); 842 (mode == Safepoint::kLazyDeopt) ? pc_offset : -1);
843 deoptimizations_.Add(environment, zone()); 843 deoptimizations_.Add(environment, zone());
844 } 844 }
845 } 845 }
846 846
847 847
848 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, 848 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
849 const char* reason, 849 const char* detail,
850 Deoptimizer::BailoutType bailout_type) { 850 Deoptimizer::BailoutType bailout_type) {
851 LEnvironment* environment = instr->environment(); 851 LEnvironment* environment = instr->environment();
852 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); 852 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt);
853 DCHECK(environment->HasBeenRegistered()); 853 DCHECK(environment->HasBeenRegistered());
854 int id = environment->deoptimization_index(); 854 int id = environment->deoptimization_index();
855 DCHECK(info()->IsOptimizing() || info()->IsStub()); 855 DCHECK(info()->IsOptimizing() || info()->IsStub());
856 Address entry = 856 Address entry =
857 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type); 857 Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
858 if (entry == NULL) { 858 if (entry == NULL) {
859 Abort(kBailoutWasNotPrepared); 859 Abort(kBailoutWasNotPrepared);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 if (condition != al) { 892 if (condition != al) {
893 condition = ne; 893 condition = ne;
894 __ cmp(scratch, Operand::Zero()); 894 __ cmp(scratch, Operand::Zero());
895 } 895 }
896 } 896 }
897 897
898 if (info()->ShouldTrapOnDeopt()) { 898 if (info()->ShouldTrapOnDeopt()) {
899 __ stop("trap_on_deopt", condition); 899 __ stop("trap_on_deopt", condition);
900 } 900 }
901 901
902 Deoptimizer::Reason reason(instr->Mnemonic(), detail);
902 DCHECK(info()->IsStub() || frame_is_built_); 903 DCHECK(info()->IsStub() || frame_is_built_);
903 // Go through jump table if we need to handle condition, build frame, or 904 // Go through jump table if we need to handle condition, build frame, or
904 // restore caller doubles. 905 // restore caller doubles.
905 if (condition == al && frame_is_built_ && 906 if (condition == al && frame_is_built_ &&
906 !info()->saves_caller_doubles()) { 907 !info()->saves_caller_doubles()) {
907 DeoptComment(instr->Mnemonic(), reason); 908 DeoptComment(reason);
908 __ Call(entry, RelocInfo::RUNTIME_ENTRY); 909 __ Call(entry, RelocInfo::RUNTIME_ENTRY);
909 } else { 910 } else {
910 // We often have several deopts to the same entry, reuse the last 911 // We often have several deopts to the same entry, reuse the last
911 // jump entry if this is the case. 912 // jump entry if this is the case.
912 if (deopt_jump_table_.is_empty() || 913 if (deopt_jump_table_.is_empty() ||
913 (deopt_jump_table_.last().address != entry) || 914 (deopt_jump_table_.last().address != entry) ||
914 (deopt_jump_table_.last().bailout_type != bailout_type) || 915 (deopt_jump_table_.last().bailout_type != bailout_type) ||
915 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) { 916 (deopt_jump_table_.last().needs_frame != !frame_is_built_)) {
916 Deoptimizer::JumpTableEntry table_entry(entry, instr->Mnemonic(), reason, 917 Deoptimizer::JumpTableEntry table_entry(entry, reason, bailout_type,
917 bailout_type, !frame_is_built_); 918 !frame_is_built_);
918 deopt_jump_table_.Add(table_entry, zone()); 919 deopt_jump_table_.Add(table_entry, zone());
919 } 920 }
920 __ b(condition, &deopt_jump_table_.last().label); 921 __ b(condition, &deopt_jump_table_.last().label);
921 } 922 }
922 } 923 }
923 924
924 925
925 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr, 926 void LCodeGen::DeoptimizeIf(Condition condition, LInstruction* instr,
926 const char* reason) { 927 const char* detail) {
927 Deoptimizer::BailoutType bailout_type = info()->IsStub() 928 Deoptimizer::BailoutType bailout_type = info()->IsStub()
928 ? Deoptimizer::LAZY 929 ? Deoptimizer::LAZY
929 : Deoptimizer::EAGER; 930 : Deoptimizer::EAGER;
930 DeoptimizeIf(condition, instr, reason, bailout_type); 931 DeoptimizeIf(condition, instr, detail, bailout_type);
931 } 932 }
932 933
933 934
934 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) { 935 void LCodeGen::PopulateDeoptimizationData(Handle<Code> code) {
935 int length = deoptimizations_.length(); 936 int length = deoptimizations_.length();
936 if (length == 0) return; 937 if (length == 0) return;
937 Handle<DeoptimizationInputData> data = 938 Handle<DeoptimizationInputData> data =
938 DeoptimizationInputData::New(isolate(), length, TENURED); 939 DeoptimizationInputData::New(isolate(), length, TENURED);
939 940
940 Handle<ByteArray> translations = 941 Handle<ByteArray> translations =
(...skipping 4969 matching lines...) Expand 10 before | Expand all | Expand 10 after
5910 __ Push(scope_info); 5911 __ Push(scope_info);
5911 __ push(ToRegister(instr->function())); 5912 __ push(ToRegister(instr->function()));
5912 CallRuntime(Runtime::kPushBlockContext, 2, instr); 5913 CallRuntime(Runtime::kPushBlockContext, 2, instr);
5913 RecordSafepoint(Safepoint::kNoLazyDeopt); 5914 RecordSafepoint(Safepoint::kNoLazyDeopt);
5914 } 5915 }
5915 5916
5916 5917
5917 #undef __ 5918 #undef __
5918 5919
5919 } } // namespace v8::internal 5920 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/arm64/lithium-codegen-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698