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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 292 } |
293 | 293 |
294 | 294 |
295 template <> | 295 template <> |
296 HValue* CodeStubGraphBuilder<ToNumberStub>::BuildCodeStub() { | 296 HValue* CodeStubGraphBuilder<ToNumberStub>::BuildCodeStub() { |
297 HValue* value = GetParameter(0); | 297 HValue* value = GetParameter(0); |
298 | 298 |
299 // Check if the parameter is already a SMI or heap number. | 299 // Check if the parameter is already a SMI or heap number. |
300 IfBuilder if_number(this); | 300 IfBuilder if_number(this); |
301 if_number.If<HIsSmiAndBranch>(value); | 301 if_number.If<HIsSmiAndBranch>(value); |
302 if_number.OrIf<HCompareMap>(value, isolate()->factory()->heap_number_map(), | 302 if_number.OrIf<HCompareMap>(value, isolate()->factory()->heap_number_map()); |
303 top_info()); | |
304 if_number.Then(); | 303 if_number.Then(); |
305 | 304 |
306 // Return the number. | 305 // Return the number. |
307 Push(value); | 306 Push(value); |
308 | 307 |
309 if_number.Else(); | 308 if_number.Else(); |
310 | 309 |
311 // Convert the parameter to number using the builtin. | 310 // Convert the parameter to number using the builtin. |
312 HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER); | 311 HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER); |
313 Add<HPushArgument>(value); | 312 Add<HPushArgument>(value); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 355 |
357 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( | 356 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( |
358 AllocationSite::kTransitionInfoOffset); | 357 AllocationSite::kTransitionInfoOffset); |
359 HInstruction* boilerplate = Add<HLoadNamedField>( | 358 HInstruction* boilerplate = Add<HLoadNamedField>( |
360 allocation_site, static_cast<HValue*>(NULL), access); | 359 allocation_site, static_cast<HValue*>(NULL), access); |
361 HValue* push_value; | 360 HValue* push_value; |
362 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { | 361 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { |
363 HValue* elements = AddLoadElements(boilerplate); | 362 HValue* elements = AddLoadElements(boilerplate); |
364 | 363 |
365 IfBuilder if_fixed_cow(this); | 364 IfBuilder if_fixed_cow(this); |
366 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map(), | 365 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); |
367 top_info()); | |
368 if_fixed_cow.Then(); | 366 if_fixed_cow.Then(); |
369 push_value = BuildCloneShallowArray(boilerplate, | 367 push_value = BuildCloneShallowArray(boilerplate, |
370 allocation_site, | 368 allocation_site, |
371 alloc_site_mode, | 369 alloc_site_mode, |
372 FAST_ELEMENTS, | 370 FAST_ELEMENTS, |
373 0/*copy-on-write*/); | 371 0/*copy-on-write*/); |
374 environment()->Push(push_value); | 372 environment()->Push(push_value); |
375 if_fixed_cow.Else(); | 373 if_fixed_cow.Else(); |
376 | 374 |
377 IfBuilder if_fixed(this); | 375 IfBuilder if_fixed(this); |
378 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map(), top_info()); | 376 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map()); |
379 if_fixed.Then(); | 377 if_fixed.Then(); |
380 push_value = BuildCloneShallowArray(boilerplate, | 378 push_value = BuildCloneShallowArray(boilerplate, |
381 allocation_site, | 379 allocation_site, |
382 alloc_site_mode, | 380 alloc_site_mode, |
383 FAST_ELEMENTS, | 381 FAST_ELEMENTS, |
384 length); | 382 length); |
385 environment()->Push(push_value); | 383 environment()->Push(push_value); |
386 if_fixed.Else(); | 384 if_fixed.Else(); |
387 push_value = BuildCloneShallowArray(boilerplate, | 385 push_value = BuildCloneShallowArray(boilerplate, |
388 allocation_site, | 386 allocation_site, |
(...skipping 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 return BuildRegExpConstructResult(length, index, input); | 1415 return BuildRegExpConstructResult(length, index, input); |
1418 } | 1416 } |
1419 | 1417 |
1420 | 1418 |
1421 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { | 1419 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { |
1422 return DoGenerateCode(isolate, this); | 1420 return DoGenerateCode(isolate, this); |
1423 } | 1421 } |
1424 | 1422 |
1425 | 1423 |
1426 } } // namespace v8::internal | 1424 } } // namespace v8::internal |
OLD | NEW |