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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 if (FLAG_trace_hydrogen_stubs) { | 139 if (FLAG_trace_hydrogen_stubs) { |
140 const char* name = CodeStub::MajorName(stub()->MajorKey(), false); | 140 const char* name = CodeStub::MajorName(stub()->MajorKey(), false); |
141 PrintF("-----------------------------------------------------------\n"); | 141 PrintF("-----------------------------------------------------------\n"); |
142 PrintF("Compiling stub %s using hydrogen\n", name); | 142 PrintF("Compiling stub %s using hydrogen\n", name); |
143 isolate()->GetHTracer()->TraceCompilation(&info_); | 143 isolate()->GetHTracer()->TraceCompilation(&info_); |
144 } | 144 } |
145 | 145 |
146 int param_count = descriptor_->register_param_count_; | 146 int param_count = descriptor_->register_param_count_; |
147 HEnvironment* start_environment = graph()->start_environment(); | 147 HEnvironment* start_environment = graph()->start_environment(); |
148 HBasicBlock* next_block = CreateBasicBlock(start_environment); | 148 HBasicBlock* next_block = CreateBasicBlock(start_environment); |
149 current_block()->Goto(next_block); | 149 Goto(next_block); |
150 next_block->SetJoinId(BailoutId::StubEntry()); | 150 next_block->SetJoinId(BailoutId::StubEntry()); |
151 set_current_block(next_block); | 151 set_current_block(next_block); |
152 | 152 |
153 HConstant* undefined_constant = | 153 HConstant* undefined_constant = |
154 Add<HConstant>(isolate()->factory()->undefined_value()); | 154 Add<HConstant>(isolate()->factory()->undefined_value()); |
155 graph()->set_undefined_constant(undefined_constant); | 155 graph()->set_undefined_constant(undefined_constant); |
156 | 156 |
157 for (int i = 0; i < param_count; ++i) { | 157 for (int i = 0; i < param_count; ++i) { |
158 HParameter* param = | 158 HParameter* param = |
159 Add<HParameter>(i, HParameter::REGISTER_PARAMETER); | 159 Add<HParameter>(i, HParameter::REGISTER_PARAMETER); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 stack_pop_count->ClearFlag(HValue::kCanOverflow); | 200 stack_pop_count->ClearFlag(HValue::kCanOverflow); |
201 } else { | 201 } else { |
202 int count = descriptor_->hint_stack_parameter_count_; | 202 int count = descriptor_->hint_stack_parameter_count_; |
203 stack_pop_count = Add<HConstant>(count); | 203 stack_pop_count = Add<HConstant>(count); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 if (current_block() != NULL) { | 207 if (current_block() != NULL) { |
208 HReturn* hreturn_instruction = New<HReturn>(return_value, | 208 HReturn* hreturn_instruction = New<HReturn>(return_value, |
209 stack_pop_count); | 209 stack_pop_count); |
210 current_block()->Finish(hreturn_instruction); | 210 FinishCurrentBlock(hreturn_instruction); |
211 set_current_block(NULL); | |
212 } | 211 } |
213 return true; | 212 return true; |
214 } | 213 } |
215 | 214 |
216 | 215 |
217 template <class Stub> | 216 template <class Stub> |
218 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { | 217 class CodeStubGraphBuilder: public CodeStubGraphBuilderBase { |
219 public: | 218 public: |
220 explicit CodeStubGraphBuilder(Isolate* isolate, Stub* stub) | 219 explicit CodeStubGraphBuilder(Isolate* isolate, Stub* stub) |
221 : CodeStubGraphBuilderBase(isolate, stub) {} | 220 : CodeStubGraphBuilderBase(isolate, stub) {} |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 } | 837 } |
839 | 838 |
840 | 839 |
841 template <> | 840 template <> |
842 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { | 841 HValue* CodeStubGraphBuilder<CompareNilICStub>::BuildCodeInitializedStub() { |
843 Isolate* isolate = graph()->isolate(); | 842 Isolate* isolate = graph()->isolate(); |
844 CompareNilICStub* stub = casted_stub(); | 843 CompareNilICStub* stub = casted_stub(); |
845 HIfContinuation continuation; | 844 HIfContinuation continuation; |
846 Handle<Map> sentinel_map(isolate->heap()->meta_map()); | 845 Handle<Map> sentinel_map(isolate->heap()->meta_map()); |
847 Handle<Type> type = stub->GetType(isolate, sentinel_map); | 846 Handle<Type> type = stub->GetType(isolate, sentinel_map); |
848 BuildCompareNil(GetParameter(0), type, RelocInfo::kNoPosition, &continuation); | 847 BuildCompareNil(GetParameter(0), type, &continuation); |
849 IfBuilder if_nil(this, &continuation); | 848 IfBuilder if_nil(this, &continuation); |
850 if_nil.Then(); | 849 if_nil.Then(); |
851 if (continuation.IsFalseReachable()) { | 850 if (continuation.IsFalseReachable()) { |
852 if_nil.Else(); | 851 if_nil.Else(); |
853 if_nil.Return(graph()->GetConstant0()); | 852 if_nil.Return(graph()->GetConstant0()); |
854 } | 853 } |
855 if_nil.End(); | 854 if_nil.End(); |
856 return continuation.IsTrueReachable() | 855 return continuation.IsTrueReachable() |
857 ? graph()->GetConstant1() | 856 ? graph()->GetConstant1() |
858 : graph()->GetConstantUndefined(); | 857 : graph()->GetConstantUndefined(); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 return js_function; | 1241 return js_function; |
1243 } | 1242 } |
1244 | 1243 |
1245 | 1244 |
1246 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1245 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
1247 return DoGenerateCode(isolate, this); | 1246 return DoGenerateCode(isolate, this); |
1248 } | 1247 } |
1249 | 1248 |
1250 | 1249 |
1251 } } // namespace v8::internal | 1250 } } // namespace v8::internal |
OLD | NEW |