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

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

Issue 7216009: Change the handling of stack check on backward branches (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Changed stack check elimination to remove the stack check instruction Created 9 years, 5 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/ia32/lithium-ia32.h ('k') | src/x64/lithium-codegen-x64.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 2011 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
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 for (int i = 0; i < graph()->blocks()->length(); ++i) { 384 for (int i = 0; i < graph()->blocks()->length(); ++i) {
385 HBasicBlock* block = graph()->blocks()->at(i); 385 HBasicBlock* block = graph()->blocks()->at(i);
386 int first = block->first_instruction_index(); 386 int first = block->first_instruction_index();
387 int last = block->last_instruction_index(); 387 int last = block->last_instruction_index();
388 LInstruction* first_instr = instructions()->at(first); 388 LInstruction* first_instr = instructions()->at(first);
389 LInstruction* last_instr = instructions()->at(last); 389 LInstruction* last_instr = instructions()->at(last);
390 390
391 LLabel* label = LLabel::cast(first_instr); 391 LLabel* label = LLabel::cast(first_instr);
392 if (last_instr->IsGoto()) { 392 if (last_instr->IsGoto()) {
393 LGoto* goto_instr = LGoto::cast(last_instr); 393 LGoto* goto_instr = LGoto::cast(last_instr);
394 if (!goto_instr->include_stack_check() && 394 if (label->IsRedundant() &&
395 label->IsRedundant() &&
396 !label->is_loop_header()) { 395 !label->is_loop_header()) {
397 bool can_eliminate = true; 396 bool can_eliminate = true;
398 for (int i = first + 1; i < last && can_eliminate; ++i) { 397 for (int i = first + 1; i < last && can_eliminate; ++i) {
399 LInstruction* cur = instructions()->at(i); 398 LInstruction* cur = instructions()->at(i);
400 if (cur->IsGap()) { 399 if (cur->IsGap()) {
401 LGap* gap = LGap::cast(cur); 400 LGap* gap = LGap::cast(cur);
402 if (!gap->IsRedundant()) { 401 if (!gap->IsRedundant()) {
403 can_eliminate = false; 402 can_eliminate = false;
404 } 403 }
405 } else { 404 } else {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 op = UseAny(value); 1030 op = UseAny(value);
1032 } 1031 }
1033 result->AddValue(op, value->representation()); 1032 result->AddValue(op, value->representation());
1034 } 1033 }
1035 1034
1036 return result; 1035 return result;
1037 } 1036 }
1038 1037
1039 1038
1040 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) { 1039 LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
1041 LGoto* result = new LGoto(instr->FirstSuccessor()->block_id(), 1040 return new LGoto(instr->FirstSuccessor()->block_id());
1042 instr->include_stack_check());
1043 return (instr->include_stack_check())
1044 ? AssignPointerMap(result)
1045 : result;
1046 } 1041 }
1047 1042
1048 1043
1049 LInstruction* LChunkBuilder::DoTest(HTest* instr) { 1044 LInstruction* LChunkBuilder::DoTest(HTest* instr) {
1050 HValue* v = instr->value(); 1045 HValue* v = instr->value();
1051 if (!v->EmitAtUses()) return new LBranch(UseRegisterAtStart(v)); 1046 if (!v->EmitAtUses()) return new LBranch(UseRegisterAtStart(v));
1052 ASSERT(!v->HasSideEffects()); 1047 ASSERT(!v->HasSideEffects());
1053 if (v->IsClassOfTest()) { 1048 if (v->IsClassOfTest()) {
1054 HClassOfTest* compare = HClassOfTest::cast(v); 1049 HClassOfTest* compare = HClassOfTest::cast(v);
1055 ASSERT(compare->value()->representation().IsTagged()); 1050 ASSERT(compare->value()->representation().IsTagged());
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 set_deoptimization_environment(result->environment()); 2256 set_deoptimization_environment(result->environment());
2262 ClearInstructionPendingDeoptimizationEnvironment(); 2257 ClearInstructionPendingDeoptimizationEnvironment();
2263 return result; 2258 return result;
2264 } 2259 }
2265 2260
2266 return NULL; 2261 return NULL;
2267 } 2262 }
2268 2263
2269 2264
2270 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2265 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2271 return MarkAsCall(new LStackCheck, instr); 2266 if (instr->is_function_entry()) {
2267 return MarkAsCall(new LStackCheck, instr);
2268 } else {
2269 ASSERT(instr->is_backwards_branch());
2270 return AssignEnvironment(AssignPointerMap(new LStackCheck));
2271 }
2272 } 2272 }
2273 2273
2274 2274
2275 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { 2275 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2276 HEnvironment* outer = current_block_->last_environment(); 2276 HEnvironment* outer = current_block_->last_environment();
2277 HConstant* undefined = graph()->GetConstantUndefined(); 2277 HConstant* undefined = graph()->GetConstantUndefined();
2278 HEnvironment* inner = outer->CopyForInlining(instr->closure(), 2278 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2279 instr->function(), 2279 instr->function(),
2280 HEnvironment::LITHIUM, 2280 HEnvironment::LITHIUM,
2281 undefined, 2281 undefined,
(...skipping 15 matching lines...) Expand all
2297 LOperand* key = UseOrConstantAtStart(instr->key()); 2297 LOperand* key = UseOrConstantAtStart(instr->key());
2298 LOperand* object = UseOrConstantAtStart(instr->object()); 2298 LOperand* object = UseOrConstantAtStart(instr->object());
2299 LIn* result = new LIn(key, object); 2299 LIn* result = new LIn(key, object);
2300 return MarkAsCall(DefineFixed(result, eax), instr); 2300 return MarkAsCall(DefineFixed(result, eax), instr);
2301 } 2301 }
2302 2302
2303 2303
2304 } } // namespace v8::internal 2304 } } // namespace v8::internal
2305 2305
2306 #endif // V8_TARGET_ARCH_IA32 2306 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698