| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); | 568 Handle<JSObject> boilerplate(JSObject::cast(site->transition_info())); |
| 569 AllocationSiteUsageContext usage_context(isolate, site, true); | 569 AllocationSiteUsageContext usage_context(isolate, site, true); |
| 570 usage_context.EnterNewScope(); | 570 usage_context.EnterNewScope(); |
| 571 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context); | 571 Handle<JSObject> copy = JSObject::DeepCopy(boilerplate, &usage_context); |
| 572 usage_context.ExitScope(site, boilerplate); | 572 usage_context.ExitScope(site, boilerplate); |
| 573 RETURN_IF_EMPTY_HANDLE(isolate, copy); | 573 RETURN_IF_EMPTY_HANDLE(isolate, copy); |
| 574 return *copy; | 574 return *copy; |
| 575 } | 575 } |
| 576 | 576 |
| 577 | 577 |
| 578 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { | |
| 579 HandleScope scope(isolate); | |
| 580 ASSERT(args.length() == 3); | |
| 581 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | |
| 582 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | |
| 583 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | |
| 584 | |
| 585 Handle<AllocationSite> site = GetLiteralAllocationSite(isolate, literals, | |
| 586 literals_index, elements); | |
| 587 RETURN_IF_EMPTY_HANDLE(isolate, site); | |
| 588 | |
| 589 JSObject* boilerplate = JSObject::cast(site->transition_info()); | |
| 590 if (boilerplate->elements()->map() == | |
| 591 isolate->heap()->fixed_cow_array_map()) { | |
| 592 isolate->counters()->cow_arrays_created_runtime()->Increment(); | |
| 593 } | |
| 594 | |
| 595 if (AllocationSite::GetMode(boilerplate->GetElementsKind()) == | |
| 596 TRACK_ALLOCATION_SITE) { | |
| 597 return isolate->heap()->CopyJSObject(boilerplate, *site); | |
| 598 } | |
| 599 | |
| 600 return isolate->heap()->CopyJSObject(boilerplate); | |
| 601 } | |
| 602 | |
| 603 | |
| 604 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { | 578 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { |
| 605 HandleScope scope(isolate); | 579 HandleScope scope(isolate); |
| 606 ASSERT(args.length() == 1); | 580 ASSERT(args.length() == 1); |
| 607 Handle<Object> name(args[0], isolate); | 581 Handle<Object> name(args[0], isolate); |
| 608 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); | 582 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); |
| 609 Symbol* symbol; | 583 Symbol* symbol; |
| 610 MaybeObject* maybe = isolate->heap()->AllocateSymbol(); | 584 MaybeObject* maybe = isolate->heap()->AllocateSymbol(); |
| 611 if (!maybe->To(&symbol)) return maybe; | 585 if (!maybe->To(&symbol)) return maybe; |
| 612 if (name->IsString()) symbol->set_name(*name); | 586 if (name->IsString()) symbol->set_name(*name); |
| 613 return symbol; | 587 return symbol; |
| (...skipping 14252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14866 // Handle last resort GC and make sure to allow future allocations | 14840 // Handle last resort GC and make sure to allow future allocations |
| 14867 // to grow the heap without causing GCs (if possible). | 14841 // to grow the heap without causing GCs (if possible). |
| 14868 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14842 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14869 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14843 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14870 "Runtime::PerformGC"); | 14844 "Runtime::PerformGC"); |
| 14871 } | 14845 } |
| 14872 } | 14846 } |
| 14873 | 14847 |
| 14874 | 14848 |
| 14875 } } // namespace v8::internal | 14849 } } // namespace v8::internal |
| OLD | NEW |