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