OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // arguments above | 153 // arguments above |
154 HInstruction* stack_pop_count = stack_parameter_count; | 154 HInstruction* stack_pop_count = stack_parameter_count; |
155 if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) { | 155 if (descriptor_->function_mode_ == JS_FUNCTION_STUB_MODE) { |
156 HInstruction* amount = graph()->GetConstant1(); | 156 HInstruction* amount = graph()->GetConstant1(); |
157 stack_pop_count = AddInstruction( | 157 stack_pop_count = AddInstruction( |
158 HAdd::New(zone, context_, stack_parameter_count, amount)); | 158 HAdd::New(zone, context_, stack_parameter_count, amount)); |
159 stack_pop_count->ChangeRepresentation(Representation::Integer32()); | 159 stack_pop_count->ChangeRepresentation(Representation::Integer32()); |
160 stack_pop_count->ClearFlag(HValue::kCanOverflow); | 160 stack_pop_count->ClearFlag(HValue::kCanOverflow); |
161 } | 161 } |
162 | 162 |
163 HReturn* hreturn_instruction = new(zone) HReturn(return_value, | 163 if (!current_block()->IsFinished()) { |
164 context_, | 164 HReturn* hreturn_instruction = new(zone) HReturn(return_value, |
165 stack_pop_count); | 165 context_, |
166 current_block()->Finish(hreturn_instruction); | 166 stack_pop_count); |
| 167 current_block()->Finish(hreturn_instruction); |
| 168 } |
167 return true; | 169 return true; |
168 } | 170 } |
169 | 171 |
170 | 172 |
171 template <class Stub> | 173 template <class Stub> |
172 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { | 174 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { |
173 public: | 175 public: |
174 explicit CodeStubGraphBuilder(Stub* stub) | 176 explicit CodeStubGraphBuilder(Stub* stub) |
175 : CodeStubGraphBuilderBase(Isolate::Current(), stub) {} | 177 : CodeStubGraphBuilderBase(Isolate::Current(), stub) {} |
176 | 178 |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 AddInstruction(deopt); | 504 AddInstruction(deopt); |
503 current_block()->MarkAsDeoptimizing(); | 505 current_block()->MarkAsDeoptimizing(); |
504 return GetParameter(0); | 506 return GetParameter(0); |
505 } | 507 } |
506 | 508 |
507 | 509 |
508 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { | 510 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { |
509 return DoGenerateCode(this); | 511 return DoGenerateCode(this); |
510 } | 512 } |
511 | 513 |
| 514 |
| 515 template <> |
| 516 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeUninitializedStub() { |
| 517 CompareNilICStub* stub = casted_stub(); |
| 518 HIfContinuation continuation; |
| 519 Handle<Map> sentinel_map(graph()->isolate()->heap()->meta_map()); |
| 520 BuildCompareNil(GetParameter(0), stub->GetKind(), |
| 521 stub->GetTypes(), sentinel_map, |
| 522 RelocInfo::kNoPosition, &continuation); |
| 523 IfBuilder if_nil(this, &continuation); |
| 524 if_nil.Then(); |
| 525 if (continuation.IsFalseReachable()) { |
| 526 if_nil.Else(); |
| 527 if_nil.Return(graph()->GetConstantSmi0()); |
| 528 } |
| 529 if_nil.End(); |
| 530 return continuation.IsTrueReachable() |
| 531 ? graph()->GetConstantSmi1() |
| 532 : graph()->GetConstantUndefined(); |
| 533 } |
| 534 |
| 535 |
| 536 Handle<Code> CompareNilICStub::GenerateCode() { |
| 537 return DoGenerateCode(this); |
| 538 } |
| 539 |
512 } } // namespace v8::internal | 540 } } // namespace v8::internal |
OLD | NEW |