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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
308 | 308 |
309 template <> | 309 template <> |
310 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { | 310 HValue* CodeStubGraphBuilder<FastCloneShallowArrayStub>::BuildCodeStub() { |
311 Zone* zone = this->zone(); | 311 Zone* zone = this->zone(); |
312 Factory* factory = isolate()->factory(); | 312 Factory* factory = isolate()->factory(); |
313 HValue* undefined = graph()->GetConstantUndefined(); | 313 HValue* undefined = graph()->GetConstantUndefined(); |
314 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); | 314 AllocationSiteMode alloc_site_mode = casted_stub()->allocation_site_mode(); |
315 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); | 315 FastCloneShallowArrayStub::Mode mode = casted_stub()->mode(); |
316 int length = casted_stub()->length(); | 316 int length = casted_stub()->length(); |
317 | 317 |
318 HInstruction* boilerplate = | 318 HValue* literals = GetParameter(0); |
319 AddInstruction(new(zone) HLoadKeyed(GetParameter(0), | 319 HInstruction* allocation_site = |
320 AddInstruction(new(zone) HLoadKeyed(literals, | |
Hannes Payer (out of office)
2013/06/25 16:35:07
literals is just used there, you could just use th
mvstanton
2013/07/02 13:55:11
Done.
| |
320 GetParameter(1), | 321 GetParameter(1), |
321 NULL, | 322 NULL, |
322 FAST_ELEMENTS)); | 323 FAST_ELEMENTS)); |
323 | |
324 IfBuilder checker(this); | 324 IfBuilder checker(this); |
325 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(boilerplate, undefined); | 325 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site, undefined); |
326 checker.Then(); | 326 checker.Then(); |
327 | 327 |
328 HObjectAccess access = HObjectAccess::ForAllocationSiteInfoPayload(); | |
329 HInstruction* boilerplate = AddLoad(allocation_site, access); | |
328 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { | 330 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { |
329 HValue* elements = AddLoadElements(boilerplate); | 331 HValue* elements = AddLoadElements(boilerplate); |
330 | 332 |
331 IfBuilder if_fixed_cow(this); | 333 IfBuilder if_fixed_cow(this); |
332 if_fixed_cow.IfCompareMap(elements, factory->fixed_cow_array_map()); | 334 if_fixed_cow.IfCompareMap(elements, factory->fixed_cow_array_map()); |
333 if_fixed_cow.Then(); | 335 if_fixed_cow.Then(); |
334 environment()->Push(BuildCloneShallowArray(context(), | 336 environment()->Push(BuildCloneShallowArray(context(), |
335 boilerplate, | 337 boilerplate, |
338 allocation_site, | |
336 alloc_site_mode, | 339 alloc_site_mode, |
337 FAST_ELEMENTS, | 340 FAST_ELEMENTS, |
338 0/*copy-on-write*/)); | 341 0/*copy-on-write*/)); |
339 if_fixed_cow.Else(); | 342 if_fixed_cow.Else(); |
340 | 343 |
341 IfBuilder if_fixed(this); | 344 IfBuilder if_fixed(this); |
342 if_fixed.IfCompareMap(elements, factory->fixed_array_map()); | 345 if_fixed.IfCompareMap(elements, factory->fixed_array_map()); |
343 if_fixed.Then(); | 346 if_fixed.Then(); |
344 environment()->Push(BuildCloneShallowArray(context(), | 347 environment()->Push(BuildCloneShallowArray(context(), |
345 boilerplate, | 348 boilerplate, |
349 allocation_site, | |
346 alloc_site_mode, | 350 alloc_site_mode, |
347 FAST_ELEMENTS, | 351 FAST_ELEMENTS, |
348 length)); | 352 length)); |
349 if_fixed.Else(); | 353 if_fixed.Else(); |
350 environment()->Push(BuildCloneShallowArray(context(), | 354 environment()->Push(BuildCloneShallowArray(context(), |
351 boilerplate, | 355 boilerplate, |
356 allocation_site, | |
352 alloc_site_mode, | 357 alloc_site_mode, |
353 FAST_DOUBLE_ELEMENTS, | 358 FAST_DOUBLE_ELEMENTS, |
354 length)); | 359 length)); |
355 } else { | 360 } else { |
356 ElementsKind elements_kind = casted_stub()->ComputeElementsKind(); | 361 ElementsKind elements_kind = casted_stub()->ComputeElementsKind(); |
357 environment()->Push(BuildCloneShallowArray(context(), | 362 environment()->Push(BuildCloneShallowArray(context(), |
358 boilerplate, | 363 boilerplate, |
364 allocation_site, | |
359 alloc_site_mode, | 365 alloc_site_mode, |
360 elements_kind, | 366 elements_kind, |
361 length)); | 367 length)); |
362 } | 368 } |
363 | 369 |
364 HValue* result = environment()->Pop(); | 370 HValue* result = environment()->Pop(); |
365 checker.ElseDeopt(); | 371 checker.ElseDeopt(); |
366 return result; | 372 return result; |
367 } | 373 } |
368 | 374 |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
770 return graph()->GetConstant0(); | 776 return graph()->GetConstant0(); |
771 } | 777 } |
772 | 778 |
773 | 779 |
774 Handle<Code> ToBooleanStub::GenerateCode() { | 780 Handle<Code> ToBooleanStub::GenerateCode() { |
775 return DoGenerateCode(this); | 781 return DoGenerateCode(this); |
776 } | 782 } |
777 | 783 |
778 | 784 |
779 } } // namespace v8::internal | 785 } } // namespace v8::internal |
OLD | NEW |