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 = | 109 HBasicBlock* next_block = CreateBasicBlock(start_environment); |
110 CreateBasicBlock(start_environment, BailoutId::StubEntry()); | |
111 current_block()->Goto(next_block); | 110 current_block()->Goto(next_block); |
112 next_block->SetJoinId(BailoutId::StubEntry()); | 111 next_block->SetJoinId(BailoutId::StubEntry()); |
113 set_current_block(next_block); | 112 set_current_block(next_block); |
114 | 113 |
115 HConstant* undefined_constant = new(zone) HConstant( | 114 HConstant* undefined_constant = new(zone) HConstant( |
116 isolate()->factory()->undefined_value(), Representation::Tagged()); | 115 isolate()->factory()->undefined_value(), Representation::Tagged()); |
117 AddInstruction(undefined_constant); | 116 AddInstruction(undefined_constant); |
118 graph()->set_undefined_constant(undefined_constant); | 117 graph()->set_undefined_constant(undefined_constant); |
119 | 118 |
120 for (int i = 0; i < param_count; ++i) { | 119 for (int i = 0; i < param_count; ++i) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); | 196 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); |
198 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); | 197 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); |
199 int length = casted_stub()->length(); | 198 int length = casted_stub()->length(); |
200 | 199 |
201 HInstruction* boilerplate = | 200 HInstruction* boilerplate = |
202 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), | 201 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), |
203 GetParameter(1), | 202 GetParameter(1), |
204 NULL, | 203 NULL, |
205 FAST_ELEMENTS)); | 204 FAST_ELEMENTS)); |
206 | 205 |
207 CheckBuilder builder(this); | 206 CheckBuilder builder(this, BailoutId::StubEntry()); |
208 builder.CheckNotUndefined(boilerplate); | 207 builder.CheckNotUndefined(boilerplate); |
209 | 208 |
210 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { | 209 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { |
211 HValue* elements = | 210 HValue* elements = |
212 AddInstruction(new(zone) HLoadElements(boilerplate, NULL)); | 211 AddInstruction(new(zone) HLoadElements(boilerplate, NULL)); |
213 | 212 |
214 IfBuilder if_fixed_cow(this); | 213 IfBuilder if_fixed_cow(this, BailoutId::StubEntry()); |
215 if_fixed_cow.BeginIfMapEquals(elements, factory->fixed_cow_array_map()); | 214 if_fixed_cow.BeginIfMapEquals(elements, factory->fixed_cow_array_map()); |
216 environment()->Push(BuildCloneShallowArray(context(), | 215 environment()->Push(BuildCloneShallowArray(context(), |
217 boilerplate, | 216 boilerplate, |
218 alloc_site_mode, | 217 alloc_site_mode, |
219 FAST_ELEMENTS, | 218 FAST_ELEMENTS, |
220 0/*copy-on-write*/)); | 219 0/*copy-on-write*/)); |
221 if_fixed_cow.BeginElse(); | 220 if_fixed_cow.BeginElse(); |
222 | 221 |
223 IfBuilder if_fixed(this); | 222 IfBuilder if_fixed(this, BailoutId::StubEntry()); |
224 if_fixed.BeginIfMapEquals(elements, factory->fixed_array_map()); | 223 if_fixed.BeginIfMapEquals(elements, factory->fixed_array_map()); |
225 environment()->Push(BuildCloneShallowArray(context(), | 224 environment()->Push(BuildCloneShallowArray(context(), |
226 boilerplate, | 225 boilerplate, |
227 alloc_site_mode, | 226 alloc_site_mode, |
228 FAST_ELEMENTS, | 227 FAST_ELEMENTS, |
229 length)); | 228 length)); |
230 if_fixed.BeginElse(); | 229 if_fixed.BeginElse(); |
231 | 230 |
232 environment()->Push(BuildCloneShallowArray(context(), | 231 environment()->Push(BuildCloneShallowArray(context(), |
233 boilerplate, | 232 boilerplate, |
(...skipping 24 matching lines...) Expand all Loading... |
258 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { | 257 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() { |
259 Zone* zone = this->zone(); | 258 Zone* zone = this->zone(); |
260 Factory* factory = isolate()->factory(); | 259 Factory* factory = isolate()->factory(); |
261 | 260 |
262 HInstruction* boilerplate = | 261 HInstruction* boilerplate = |
263 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), | 262 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), |
264 GetParameter(1), | 263 GetParameter(1), |
265 NULL, | 264 NULL, |
266 FAST_ELEMENTS)); | 265 FAST_ELEMENTS)); |
267 | 266 |
268 CheckBuilder builder(this); | 267 CheckBuilder builder(this, BailoutId::StubEntry()); |
269 builder.CheckNotUndefined(boilerplate); | 268 builder.CheckNotUndefined(boilerplate); |
270 | 269 |
271 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; | 270 int size = JSObject::kHeaderSize + casted_stub()->length() * kPointerSize; |
272 HValue* boilerplate_size = | 271 HValue* boilerplate_size = |
273 AddInstruction(new(zone) HInstanceSize(boilerplate)); | 272 AddInstruction(new(zone) HInstanceSize(boilerplate)); |
274 HValue* size_in_words = | 273 HValue* size_in_words = |
275 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, | 274 AddInstruction(new(zone) HConstant(size >> kPointerSizeLog2, |
276 Representation::Integer32())); | 275 Representation::Integer32())); |
277 builder.CheckIntegerEq(boilerplate_size, size_in_words); | 276 builder.CheckIntegerEq(boilerplate_size, size_in_words); |
278 | 277 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 | 349 |
351 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); | 350 AddInstruction(new(zone) HTrapAllocationMemento(js_array)); |
352 | 351 |
353 HInstruction* array_length = | 352 HInstruction* array_length = |
354 AddInstruction(HLoadNamedField::NewArrayLength( | 353 AddInstruction(HLoadNamedField::NewArrayLength( |
355 zone, js_array, js_array, HType::Smi())); | 354 zone, js_array, js_array, HType::Smi())); |
356 | 355 |
357 ElementsKind to_kind = casted_stub()->to_kind(); | 356 ElementsKind to_kind = casted_stub()->to_kind(); |
358 BuildNewSpaceArrayCheck(array_length, to_kind); | 357 BuildNewSpaceArrayCheck(array_length, to_kind); |
359 | 358 |
360 IfBuilder if_builder(this); | 359 IfBuilder if_builder(this, BailoutId::StubEntry()); |
361 | 360 |
362 if_builder.BeginIf(array_length, graph()->GetConstant0(), Token::EQ); | 361 if_builder.BeginIf(array_length, graph()->GetConstant0(), Token::EQ); |
363 | 362 |
364 // Nothing to do, just change the map. | 363 // Nothing to do, just change the map. |
365 | 364 |
366 if_builder.BeginElse(); | 365 if_builder.BeginElse(); |
367 | 366 |
368 HInstruction* elements = | 367 HInstruction* elements = |
369 AddInstruction(new(zone) HLoadElements(js_array, js_array)); | 368 AddInstruction(new(zone) HLoadElements(js_array, js_array)); |
370 | 369 |
371 HInstruction* elements_length = | 370 HInstruction* elements_length = |
372 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); | 371 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
373 | 372 |
374 HValue* new_elements = | 373 HValue* new_elements = |
375 BuildAllocateAndInitializeElements(context(), to_kind, elements_length); | 374 BuildAllocateAndInitializeElements(context(), to_kind, elements_length); |
376 | 375 |
377 BuildCopyElements(context(), elements, | 376 BuildCopyElements(context(), elements, |
378 casted_stub()->from_kind(), new_elements, | 377 casted_stub()->from_kind(), new_elements, |
379 to_kind, array_length, elements_length); | 378 to_kind, array_length, elements_length, |
| 379 BailoutId::StubEntry()); |
380 | 380 |
381 Factory* factory = isolate()->factory(); | 381 Factory* factory = isolate()->factory(); |
382 | 382 |
383 AddInstruction(new(zone) HStoreNamedField(js_array, | 383 AddInstruction(new(zone) HStoreNamedField(js_array, |
384 factory->elements_field_string(), | 384 factory->elements_field_string(), |
385 new_elements, true, | 385 new_elements, true, |
386 JSArray::kElementsOffset)); | 386 JSArray::kElementsOffset)); |
387 | 387 |
388 if_builder.End(); | 388 if_builder.End(); |
389 | 389 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 current_block()->MarkAsDeoptimizing(); | 434 current_block()->MarkAsDeoptimizing(); |
435 return GetParameter(0); | 435 return GetParameter(0); |
436 } | 436 } |
437 | 437 |
438 | 438 |
439 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { | 439 Handle<Code> ArrayNArgumentsConstructorStub::GenerateCode() { |
440 return DoGenerateCode(this); | 440 return DoGenerateCode(this); |
441 } | 441 } |
442 | 442 |
443 } } // namespace v8::internal | 443 } } // namespace v8::internal |
OLD | NEW |