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

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

Issue 6192005: ARM: Add deferred stack overflow checks to goto code generation in ARM... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 __ CallStub(&stub); 1143 __ CallStub(&stub);
1144 __ cmp(reg, Operand(0)); 1144 __ cmp(reg, Operand(0));
1145 __ ldm(ia_w, sp, saved_regs); 1145 __ ldm(ia_w, sp, saved_regs);
1146 EmitBranch(true_block, false_block, nz); 1146 EmitBranch(true_block, false_block, nz);
1147 } 1147 }
1148 } 1148 }
1149 } 1149 }
1150 1150
1151 1151
1152 void LCodeGen::EmitGoto(int block, LDeferredCode* deferred_stack_check) { 1152 void LCodeGen::EmitGoto(int block, LDeferredCode* deferred_stack_check) {
1153 // TODO(srdjan): Perform stack overflow check if this goto needs it
1154 // before jumping.
1155 block = chunk_->LookupDestination(block); 1153 block = chunk_->LookupDestination(block);
1156 int next_block = GetNextEmittedBlock(current_block_); 1154 int next_block = GetNextEmittedBlock(current_block_);
1157 if (block != next_block) { 1155 if (block != next_block) {
1158 __ jmp(chunk_->GetAssemblyLabel(block)); 1156 // Perform stack overflow check if this goto needs it before jumping.
1157 if (deferred_stack_check != NULL) {
1158 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
1159 __ cmp(sp, Operand(ip));
1160 __ b(hs, chunk_->GetAssemblyLabel(block));
1161 __ jmp(deferred_stack_check->entry());
1162 deferred_stack_check->SetExit(chunk_->GetAssemblyLabel(block));
1163 } else {
1164 __ jmp(chunk_->GetAssemblyLabel(block));
1165 }
1159 } 1166 }
1160 } 1167 }
1161 1168
1162 1169
1163 void LCodeGen::DoDeferredStackCheck(LGoto* instr) { 1170 void LCodeGen::DoDeferredStackCheck(LGoto* instr) {
1164 UNIMPLEMENTED(); 1171 __ PushSafepointRegisters();
1172 __ CallRuntimeSaveDoubles(Runtime::kStackGuard);
1173 RecordSafepointWithRegisters(
1174 instr->pointer_map(), 0, Safepoint::kNoDeoptimizationIndex);
1175 __ PopSafepointRegisters();
1165 } 1176 }
1166 1177
1167 1178
1168 void LCodeGen::DoGoto(LGoto* instr) { 1179 void LCodeGen::DoGoto(LGoto* instr) {
1169 // TODO(srdjan): Implement deferred stack check. 1180 class DeferredStackCheck: public LDeferredCode {
1170 EmitGoto(instr->block_id(), NULL); 1181 public:
1182 DeferredStackCheck(LCodeGen* codegen, LGoto* instr)
1183 : LDeferredCode(codegen), instr_(instr) { }
1184 virtual void Generate() { codegen()->DoDeferredStackCheck(instr_); }
1185 private:
1186 LGoto* instr_;
1187 };
1188
1189 DeferredStackCheck* deferred = NULL;
1190 if (instr->include_stack_check()) {
1191 deferred = new DeferredStackCheck(this, instr);
1192 }
1193 EmitGoto(instr->block_id(), deferred);
1171 } 1194 }
1172 1195
1173 1196
1174 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) { 1197 Condition LCodeGen::TokenToCondition(Token::Value op, bool is_unsigned) {
1175 Condition cond = no_condition; 1198 Condition cond = no_condition;
1176 switch (op) { 1199 switch (op) {
1177 case Token::EQ: 1200 case Token::EQ:
1178 case Token::EQ_STRICT: 1201 case Token::EQ_STRICT:
1179 cond = eq; 1202 cond = eq;
1180 break; 1203 break;
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2635 2658
2636 2659
2637 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { 2660 void LCodeGen::DoOsrEntry(LOsrEntry* instr) {
2638 Abort("DoOsrEntry unimplemented."); 2661 Abort("DoOsrEntry unimplemented.");
2639 } 2662 }
2640 2663
2641 2664
2642 #undef __ 2665 #undef __
2643 2666
2644 } } // namespace v8::internal 2667 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698