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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 if (FLAG_trace_hydrogen) { | 99 if (FLAG_trace_hydrogen) { |
100 const char* name = CodeStub::MajorName(stub()->MajorKey(), false); | 100 const char* name = CodeStub::MajorName(stub()->MajorKey(), false); |
101 PrintF("-----------------------------------------------------------\n"); | 101 PrintF("-----------------------------------------------------------\n"); |
102 PrintF("Compiling stub %s using hydrogen\n", name); | 102 PrintF("Compiling stub %s using hydrogen\n", name); |
103 isolate()->GetHTracer()->TraceCompilation(&info_); | 103 isolate()->GetHTracer()->TraceCompilation(&info_); |
104 } | 104 } |
105 | 105 |
106 Zone* zone = this->zone(); | 106 Zone* zone = this->zone(); |
107 int param_count = descriptor_->register_param_count_; | 107 int param_count = descriptor_->register_param_count_; |
108 HEnvironment* start_environment = graph()->start_environment(); | 108 HEnvironment* start_environment = graph()->start_environment(); |
109 HBasicBlock* next_block = CreateBasicBlock(start_environment); | 109 HBasicBlock* next_block = |
| 110 CreateBasicBlock(start_environment, BailoutId::StubEntry()); |
110 current_block()->Goto(next_block); | 111 current_block()->Goto(next_block); |
111 next_block->SetJoinId(BailoutId::StubEntry()); | 112 next_block->SetJoinId(BailoutId::StubEntry()); |
112 set_current_block(next_block); | 113 set_current_block(next_block); |
113 | 114 |
114 start_environment->set_ast_id(BailoutId::StubEntry()); | |
115 | |
116 HConstant* undefined_constant = new(zone) HConstant( | 115 HConstant* undefined_constant = new(zone) HConstant( |
117 isolate()->factory()->undefined_value(), Representation::Tagged()); | 116 isolate()->factory()->undefined_value(), Representation::Tagged()); |
118 AddInstruction(undefined_constant); | 117 AddInstruction(undefined_constant); |
119 graph()->set_undefined_constant(undefined_constant); | 118 graph()->set_undefined_constant(undefined_constant); |
120 | 119 |
121 for (int i = 0; i < param_count; ++i) { | 120 for (int i = 0; i < param_count; ++i) { |
122 HParameter* param = | 121 HParameter* param = |
123 new(zone) HParameter(i, HParameter::REGISTER_PARAMETER); | 122 new(zone) HParameter(i, HParameter::REGISTER_PARAMETER); |
124 AddInstruction(param); | 123 AddInstruction(param); |
125 start_environment->Bind(i, param); | 124 start_environment->Bind(i, param); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { | 178 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { |
180 Zone* zone = this->zone(); | 179 Zone* zone = this->zone(); |
181 Factory* factory = isolate()->factory(); | 180 Factory* factory = isolate()->factory(); |
182 | 181 |
183 HInstruction* boilerplate = | 182 HInstruction* boilerplate = |
184 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), | 183 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), |
185 GetParameter(1), | 184 GetParameter(1), |
186 NULL, | 185 NULL, |
187 FAST_ELEMENTS)); | 186 FAST_ELEMENTS)); |
188 | 187 |
189 CheckBuilder builder(this, BailoutId::StubEntry()); | 188 CheckBuilder builder(this); |
190 builder.CheckNotUndefined(boilerplate); | 189 builder.CheckNotUndefined(boilerplate); |
191 | 190 |
192 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 191 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
193 HValue* boilerplate_size = | 192 HValue* boilerplate_size = |
194 AddInstruction(new(zone) HInstanceSize(boilerplate)); | 193 AddInstruction(new(zone) HInstanceSize(boilerplate)); |
195 HValue* size_in_words = | 194 HValue* size_in_words = |
196 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, | 195 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, |
197 Representation::Integer32())); | 196 Representation::Integer32())); |
198 builder.CheckIntegerEq(boilerplate_size, size_in_words); | 197 builder.CheckIntegerEq(boilerplate_size, size_in_words); |
199 | 198 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); | 273 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); |
275 | 274 |
276 HInstruction* array_length = | 275 HInstruction* array_length = |
277 AddInstruction(new(zone) HJSArrayLength(js_array, | 276 AddInstruction(new(zone) HJSArrayLength(js_array, |
278 js_array, | 277 js_array, |
279 HType::Smi())); | 278 HType::Smi())); |
280 | 279 |
281 ElementsKind to_kind = casted_stub()->to_kind(); | 280 ElementsKind to_kind = casted_stub()->to_kind(); |
282 BuildNewSpaceArrayCheck(array_length, to_kind); | 281 BuildNewSpaceArrayCheck(array_length, to_kind); |
283 | 282 |
284 IfBuilder if_builder(this, BailoutId::StubEntry()); | 283 IfBuilder if_builder(this); |
285 | 284 |
286 if_builder.BeginIf(array_length, graph()->GetConstant0(), Token::EQ); | 285 if_builder.BeginIf(array_length, graph()->GetConstant0(), Token::EQ); |
287 | 286 |
288 // Nothing to do, just change the map. | 287 // Nothing to do, just change the map. |
289 | 288 |
290 if_builder.BeginElse(); | 289 if_builder.BeginElse(); |
291 | 290 |
292 HInstruction* elements = | 291 HInstruction* elements = |
293 AddInstruction(new(zone) HLoadElements(js_array, js_array)); | 292 AddInstruction(new(zone) HLoadElements(js_array, js_array)); |
294 | 293 |
295 HInstruction* elements_length = | 294 HInstruction* elements_length = |
296 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); | 295 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
297 | 296 |
298 HValue* new_elements = | 297 HValue* new_elements = |
299 BuildAllocateElements(context(), to_kind, elements_length, | 298 BuildAllocateElements(context(), to_kind, elements_length); |
300 BailoutId::StubEntry()); | |
301 | 299 |
302 BuildCopyElements(context(), elements, | 300 BuildCopyElements(context(), elements, |
303 casted_stub()->from_kind(), new_elements, | 301 casted_stub()->from_kind(), new_elements, |
304 to_kind, array_length, elements_length, | 302 to_kind, array_length, elements_length); |
305 BailoutId::StubEntry()); | |
306 | 303 |
307 Factory* factory = isolate()->factory(); | 304 Factory* factory = isolate()->factory(); |
308 | 305 |
309 AddInstruction(new(zone) HStoreNamedField(js_array, | 306 AddInstruction(new(zone) HStoreNamedField(js_array, |
310 factory->elements_field_string(), | 307 factory->elements_field_string(), |
311 new_elements, true, | 308 new_elements, true, |
312 JSArray::kElementsOffset)); | 309 JSArray::kElementsOffset)); |
313 AddSimulate(BailoutId::StubEntry()); | 310 AddSimulate(BailoutId::StubEntry()); |
314 | 311 |
315 if_builder.End(); | 312 if_builder.End(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 current_block()->MarkAsDeoptimizing(); | 359 current_block()->MarkAsDeoptimizing(); |
363 return GetParameter(0); | 360 return GetParameter(0); |
364 } | 361 } |
365 | 362 |
366 | 363 |
367 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { | 364 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { |
368 return DoGenerateCode(this); | 365 return DoGenerateCode(this); |
369 } | 366 } |
370 | 367 |
371 } } // namespace v8::internal | 368 } } // namespace v8::internal |
OLD | NEW |