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

Side by Side Diff: src/x64/lithium-x64.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/x64/lithium-x64.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 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 for (int i = 0; i < graph()->blocks()->length(); ++i) { 383 for (int i = 0; i < graph()->blocks()->length(); ++i) {
384 HBasicBlock* block = graph()->blocks()->at(i); 384 HBasicBlock* block = graph()->blocks()->at(i);
385 int first = block->first_instruction_index(); 385 int first = block->first_instruction_index();
386 int last = block->last_instruction_index(); 386 int last = block->last_instruction_index();
387 LInstruction* first_instr = instructions()->at(first); 387 LInstruction* first_instr = instructions()->at(first);
388 LInstruction* last_instr = instructions()->at(last); 388 LInstruction* last_instr = instructions()->at(last);
389 389
390 LLabel* label = LLabel::cast(first_instr); 390 LLabel* label = LLabel::cast(first_instr);
391 if (last_instr->IsGoto()) { 391 if (last_instr->IsGoto()) {
392 LGoto* goto_instr = LGoto::cast(last_instr); 392 LGoto* goto_instr = LGoto::cast(last_instr);
393 if (!goto_instr->include_stack_check() && 393 if (label->IsRedundant() &&
394 label->IsRedundant() &&
395 !label->is_loop_header()) { 394 !label->is_loop_header()) {
396 bool can_eliminate = true; 395 bool can_eliminate = true;
397 for (int i = first + 1; i < last && can_eliminate; ++i) { 396 for (int i = first + 1; i < last && can_eliminate; ++i) {
398 LInstruction* cur = instructions()->at(i); 397 LInstruction* cur = instructions()->at(i);
399 if (cur->IsGap()) { 398 if (cur->IsGap()) {
400 LGap* gap = LGap::cast(cur); 399 LGap* gap = LGap::cast(cur);
401 if (!gap->IsRedundant()) { 400 if (!gap->IsRedundant()) {
402 can_eliminate = false; 401 can_eliminate = false;
403 } 402 }
404 } else { 403 } else {
(...skipping 626 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 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 set_deoptimization_environment(result->environment()); 2197 set_deoptimization_environment(result->environment());
2203 ClearInstructionPendingDeoptimizationEnvironment(); 2198 ClearInstructionPendingDeoptimizationEnvironment();
2204 return result; 2199 return result;
2205 } 2200 }
2206 2201
2207 return NULL; 2202 return NULL;
2208 } 2203 }
2209 2204
2210 2205
2211 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) { 2206 LInstruction* LChunkBuilder::DoStackCheck(HStackCheck* instr) {
2212 return MarkAsCall(new LStackCheck, instr); 2207 if (instr->is_function_entry()) {
2208 return MarkAsCall(new LStackCheck, instr);
2209 } else {
2210 ASSERT(instr->is_backwards_branch());
2211 return AssignEnvironment(AssignPointerMap(new LStackCheck));
2212 }
2213 } 2213 }
2214 2214
2215 2215
2216 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) { 2216 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
2217 HEnvironment* outer = current_block_->last_environment(); 2217 HEnvironment* outer = current_block_->last_environment();
2218 HConstant* undefined = graph()->GetConstantUndefined(); 2218 HConstant* undefined = graph()->GetConstantUndefined();
2219 HEnvironment* inner = outer->CopyForInlining(instr->closure(), 2219 HEnvironment* inner = outer->CopyForInlining(instr->closure(),
2220 instr->function(), 2220 instr->function(),
2221 HEnvironment::LITHIUM, 2221 HEnvironment::LITHIUM,
2222 undefined, 2222 undefined,
(...skipping 15 matching lines...) Expand all
2238 LOperand* key = UseOrConstantAtStart(instr->key()); 2238 LOperand* key = UseOrConstantAtStart(instr->key());
2239 LOperand* object = UseOrConstantAtStart(instr->object()); 2239 LOperand* object = UseOrConstantAtStart(instr->object());
2240 LIn* result = new LIn(key, object); 2240 LIn* result = new LIn(key, object);
2241 return MarkAsCall(DefineFixed(result, rax), instr); 2241 return MarkAsCall(DefineFixed(result, rax), instr);
2242 } 2242 }
2243 2243
2244 2244
2245 } } // namespace v8::internal 2245 } } // namespace v8::internal
2246 2246
2247 #endif // V8_TARGET_ARCH_X64 2247 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698