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 start_environment->set_previous_ast_id(BailoutId::StubEntry()); |
115 | 116 |
116 HConstant* undefined_constant = new(zone) HConstant( | 117 HConstant* undefined_constant = new(zone) HConstant( |
117 isolate()->factory()->undefined_value(), Representation::Tagged()); | 118 isolate()->factory()->undefined_value(), Representation::Tagged()); |
118 AddInstruction(undefined_constant); | 119 AddInstruction(undefined_constant); |
119 graph()->set_undefined_constant(undefined_constant); | 120 graph()->set_undefined_constant(undefined_constant); |
120 | 121 |
121 for (int i = 0; i < param_count; ++i) { | 122 for (int i = 0; i < param_count; ++i) { |
122 HParameter* param = | 123 HParameter* param = |
123 new(zone) HParameter(i, HParameter::REGISTER_PARAMETER); | 124 new(zone) HParameter(i, HParameter::REGISTER_PARAMETER); |
124 AddInstruction(param); | 125 AddInstruction(param); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { | 180 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { |
180 Zone* zone = this->zone(); | 181 Zone* zone = this->zone(); |
181 Factory* factory = isolate()->factory(); | 182 Factory* factory = isolate()->factory(); |
182 | 183 |
183 HInstruction* boilerplate = | 184 HInstruction* boilerplate = |
184 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), | 185 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), |
185 GetParameter(1), | 186 GetParameter(1), |
186 NULL, | 187 NULL, |
187 FAST_ELEMENTS)); | 188 FAST_ELEMENTS)); |
188 | 189 |
189 CheckBuilder builder(this, BailoutId::StubEntry()); | 190 CheckBuilder builder(this); |
190 builder.CheckNotUndefined(boilerplate); | 191 builder.CheckNotUndefined(boilerplate); |
191 | 192 |
192 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 193 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
193 HValue* boilerplate_size = | 194 HValue* boilerplate_size = |
194 AddInstruction(new(zone) HInstanceSize(boilerplate)); | 195 AddInstruction(new(zone) HInstanceSize(boilerplate)); |
195 HValue* size_in_words = | 196 HValue* size_in_words = |
196 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, | 197 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, |
197 Representation::Integer32())); | 198 Representation::Integer32())); |
198 builder.CheckIntegerEq(boilerplate_size, size_in_words); | 199 builder.CheckIntegerEq(boilerplate_size, size_in_words); |
199 | 200 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); | 275 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); |
275 | 276 |
276 HInstruction* array_length = | 277 HInstruction* array_length = |
277 AddInstruction(new(zone) HJSArrayLength(js_array, | 278 AddInstruction(new(zone) HJSArrayLength(js_array, |
278 js_array, | 279 js_array, |
279 HType::Smi())); | 280 HType::Smi())); |
280 | 281 |
281 ElementsKind to_kind = casted_stub()->to_kind(); | 282 ElementsKind to_kind = casted_stub()->to_kind(); |
282 BuildNewSpaceArrayCheck(array_length, to_kind); | 283 BuildNewSpaceArrayCheck(array_length, to_kind); |
283 | 284 |
284 IfBuilder if_builder(this, BailoutId::StubEntry()); | 285 IfBuilder if_builder(this); |
285 | 286 |
286 if_builder.BeginIf(array_length, graph()->GetConstant0(), Token::EQ); | 287 if_builder.BeginIf(array_length, graph()->GetConstant0(), Token::EQ); |
287 | 288 |
288 // Nothing to do, just change the map. | 289 // Nothing to do, just change the map. |
289 | 290 |
290 if_builder.BeginElse(); | 291 if_builder.BeginElse(); |
291 | 292 |
292 HInstruction* elements = | 293 HInstruction* elements = |
293 AddInstruction(new(zone) HLoadElements(js_array, js_array)); | 294 AddInstruction(new(zone) HLoadElements(js_array, js_array)); |
294 | 295 |
295 HInstruction* elements_length = | 296 HInstruction* elements_length = |
296 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); | 297 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
297 | 298 |
298 HValue* new_elements = | 299 HValue* new_elements = |
299 BuildAllocateElements(context(), to_kind, elements_length, | 300 BuildAllocateElements(context(), to_kind, elements_length); |
300 BailoutId::StubEntry()); | |
301 | 301 |
302 BuildCopyElements(context(), elements, | 302 BuildCopyElements(context(), elements, |
303 casted_stub()->from_kind(), new_elements, | 303 casted_stub()->from_kind(), new_elements, |
304 to_kind, array_length, elements_length, | 304 to_kind, array_length, elements_length); |
305 BailoutId::StubEntry()); | |
306 | 305 |
307 Factory* factory = isolate()->factory(); | 306 Factory* factory = isolate()->factory(); |
308 | 307 |
309 AddInstruction(new(zone) HStoreNamedField(js_array, | 308 AddInstruction(new(zone) HStoreNamedField(js_array, |
310 factory->elements_field_string(), | 309 factory->elements_field_string(), |
311 new_elements, true, | 310 new_elements, true, |
312 JSArray::kElementsOffset)); | 311 JSArray::kElementsOffset)); |
313 AddSimulate(BailoutId::StubEntry()); | 312 AddSimulate(BailoutId::StubEntry()); |
314 | 313 |
315 if_builder.End(); | 314 if_builder.End(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 current_block()->MarkAsDeoptimizing(); | 361 current_block()->MarkAsDeoptimizing(); |
363 return GetParameter(0); | 362 return GetParameter(0); |
364 } | 363 } |
365 | 364 |
366 | 365 |
367 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { | 366 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { |
368 return DoGenerateCode(this); | 367 return DoGenerateCode(this); |
369 } | 368 } |
370 | 369 |
371 } } // namespace v8::internal | 370 } } // namespace v8::internal |
OLD | NEW |