| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 288 } |
| 289 | 289 |
| 290 | 290 |
| 291 template <> | 291 template <> |
| 292 HValue* CodeStubGraphBuilder<ToNumberStub>::BuildCodeStub() { | 292 HValue* CodeStubGraphBuilder<ToNumberStub>::BuildCodeStub() { |
| 293 HValue* value = GetParameter(0); | 293 HValue* value = GetParameter(0); |
| 294 | 294 |
| 295 // Check if the parameter is already a SMI or heap number. | 295 // Check if the parameter is already a SMI or heap number. |
| 296 IfBuilder if_number(this); | 296 IfBuilder if_number(this); |
| 297 if_number.If<HIsSmiAndBranch>(value); | 297 if_number.If<HIsSmiAndBranch>(value); |
| 298 if_number.OrIf<HCompareMap>(value, isolate()->factory()->heap_number_map()); | 298 if_number.OrIf<HCompareMap>(value, isolate()->factory()->heap_number_map(), |
| 299 top_info()); |
| 299 if_number.Then(); | 300 if_number.Then(); |
| 300 | 301 |
| 301 // Return the number. | 302 // Return the number. |
| 302 Push(value); | 303 Push(value); |
| 303 | 304 |
| 304 if_number.Else(); | 305 if_number.Else(); |
| 305 | 306 |
| 306 // Convert the parameter to number using the builtin. | 307 // Convert the parameter to number using the builtin. |
| 307 HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER); | 308 HValue* function = AddLoadJSBuiltin(Builtins::TO_NUMBER); |
| 308 Add<HPushArgument>(value); | 309 Add<HPushArgument>(value); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 352 |
| 352 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( | 353 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset( |
| 353 AllocationSite::kTransitionInfoOffset); | 354 AllocationSite::kTransitionInfoOffset); |
| 354 HInstruction* boilerplate = Add<HLoadNamedField>( | 355 HInstruction* boilerplate = Add<HLoadNamedField>( |
| 355 allocation_site, static_cast<HValue*>(NULL), access); | 356 allocation_site, static_cast<HValue*>(NULL), access); |
| 356 HValue* push_value; | 357 HValue* push_value; |
| 357 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { | 358 if (mode == FastCloneShallowArrayStub::CLONE_ANY_ELEMENTS) { |
| 358 HValue* elements = AddLoadElements(boilerplate); | 359 HValue* elements = AddLoadElements(boilerplate); |
| 359 | 360 |
| 360 IfBuilder if_fixed_cow(this); | 361 IfBuilder if_fixed_cow(this); |
| 361 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map()); | 362 if_fixed_cow.If<HCompareMap>(elements, factory->fixed_cow_array_map(), |
| 363 top_info()); |
| 362 if_fixed_cow.Then(); | 364 if_fixed_cow.Then(); |
| 363 push_value = BuildCloneShallowArray(boilerplate, | 365 push_value = BuildCloneShallowArray(boilerplate, |
| 364 allocation_site, | 366 allocation_site, |
| 365 alloc_site_mode, | 367 alloc_site_mode, |
| 366 FAST_ELEMENTS, | 368 FAST_ELEMENTS, |
| 367 0/*copy-on-write*/); | 369 0/*copy-on-write*/); |
| 368 environment()->Push(push_value); | 370 environment()->Push(push_value); |
| 369 if_fixed_cow.Else(); | 371 if_fixed_cow.Else(); |
| 370 | 372 |
| 371 IfBuilder if_fixed(this); | 373 IfBuilder if_fixed(this); |
| 372 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map()); | 374 if_fixed.If<HCompareMap>(elements, factory->fixed_array_map(), top_info()); |
| 373 if_fixed.Then(); | 375 if_fixed.Then(); |
| 374 push_value = BuildCloneShallowArray(boilerplate, | 376 push_value = BuildCloneShallowArray(boilerplate, |
| 375 allocation_site, | 377 allocation_site, |
| 376 alloc_site_mode, | 378 alloc_site_mode, |
| 377 FAST_ELEMENTS, | 379 FAST_ELEMENTS, |
| 378 length); | 380 length); |
| 379 environment()->Push(push_value); | 381 environment()->Push(push_value); |
| 380 if_fixed.Else(); | 382 if_fixed.Else(); |
| 381 push_value = BuildCloneShallowArray(boilerplate, | 383 push_value = BuildCloneShallowArray(boilerplate, |
| 382 allocation_site, | 384 allocation_site, |
| (...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1395 return BuildRegExpConstructResult(length, index, input); | 1397 return BuildRegExpConstructResult(length, index, input); |
| 1396 } | 1398 } |
| 1397 | 1399 |
| 1398 | 1400 |
| 1399 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { | 1401 Handle<Code> RegExpConstructResultStub::GenerateCode(Isolate* isolate) { |
| 1400 return DoGenerateCode(isolate, this); | 1402 return DoGenerateCode(isolate, this); |
| 1401 } | 1403 } |
| 1402 | 1404 |
| 1403 | 1405 |
| 1404 } } // namespace v8::internal | 1406 } } // namespace v8::internal |
| OLD | NEW |