| 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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 Handle<FixedArray> literals, | 511 Handle<FixedArray> literals, |
| 512 int literals_index, | 512 int literals_index, |
| 513 Handle<FixedArray> elements) { | 513 Handle<FixedArray> elements) { |
| 514 // Check if boilerplate exists. If not, create it first. | 514 // Check if boilerplate exists. If not, create it first. |
| 515 Handle<Object> literal_site(literals->get(literals_index), isolate); | 515 Handle<Object> literal_site(literals->get(literals_index), isolate); |
| 516 Handle<AllocationSite> site; | 516 Handle<AllocationSite> site; |
| 517 if (*literal_site == isolate->heap()->undefined_value()) { | 517 if (*literal_site == isolate->heap()->undefined_value()) { |
| 518 ASSERT(*elements != isolate->heap()->empty_fixed_array()); | 518 ASSERT(*elements != isolate->heap()->empty_fixed_array()); |
| 519 Handle<Object> boilerplate = | 519 Handle<Object> boilerplate = |
| 520 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); | 520 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); |
| 521 if (boilerplate.is_null()) return site; | 521 if (boilerplate.is_null()) { |
| 522 ASSERT(site.is_null()); |
| 523 return site; |
| 524 } |
| 522 site = isolate->factory()->NewAllocationSite(); | 525 site = isolate->factory()->NewAllocationSite(); |
| 523 site->set_transition_info(*boilerplate); | 526 site->set_transition_info(*boilerplate); |
| 524 literals->set(literals_index, *site); | 527 literals->set(literals_index, *site); |
| 525 } else { | 528 } else { |
| 526 site = Handle<AllocationSite>::cast(literal_site); | 529 site = Handle<AllocationSite>::cast(literal_site); |
| 527 } | 530 } |
| 528 | 531 |
| 529 return site; | 532 return site; |
| 530 } | 533 } |
| 531 | 534 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 561 | 564 |
| 562 JSObject* boilerplate = JSObject::cast(site->transition_info()); | 565 JSObject* boilerplate = JSObject::cast(site->transition_info()); |
| 563 if (boilerplate->elements()->map() == | 566 if (boilerplate->elements()->map() == |
| 564 isolate->heap()->fixed_cow_array_map()) { | 567 isolate->heap()->fixed_cow_array_map()) { |
| 565 isolate->counters()->cow_arrays_created_runtime()->Increment(); | 568 isolate->counters()->cow_arrays_created_runtime()->Increment(); |
| 566 } | 569 } |
| 567 | 570 |
| 568 AllocationSiteMode mode = AllocationSite::GetMode( | 571 AllocationSiteMode mode = AllocationSite::GetMode( |
| 569 boilerplate->GetElementsKind()); | 572 boilerplate->GetElementsKind()); |
| 570 if (mode == TRACK_ALLOCATION_SITE) { | 573 if (mode == TRACK_ALLOCATION_SITE) { |
| 571 return isolate->heap()->CopyJSObjectWithAllocationSite( | 574 return isolate->heap()->CopyJSObject(boilerplate, *site); |
| 572 boilerplate, *site); | |
| 573 } | 575 } |
| 574 | 576 |
| 575 return isolate->heap()->CopyJSObject(boilerplate); | 577 return isolate->heap()->CopyJSObject(boilerplate); |
| 576 } | 578 } |
| 577 | 579 |
| 578 | 580 |
| 579 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { | 581 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { |
| 580 HandleScope scope(isolate); | 582 HandleScope scope(isolate); |
| 581 ASSERT(args.length() == 1); | 583 ASSERT(args.length() == 1); |
| 582 Handle<Object> name(args[0], isolate); | 584 Handle<Object> name(args[0], isolate); |
| (...skipping 14214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14797 // Handle last resort GC and make sure to allow future allocations | 14799 // Handle last resort GC and make sure to allow future allocations |
| 14798 // to grow the heap without causing GCs (if possible). | 14800 // to grow the heap without causing GCs (if possible). |
| 14799 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14801 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14800 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14802 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14801 "Runtime::PerformGC"); | 14803 "Runtime::PerformGC"); |
| 14802 } | 14804 } |
| 14803 } | 14805 } |
| 14804 | 14806 |
| 14805 | 14807 |
| 14806 } } // namespace v8::internal | 14808 } } // namespace v8::internal |
| OLD | NEW |