| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 static_cast<LanguageMode>(args.smi_at(index)); | 137 static_cast<LanguageMode>(args.smi_at(index)); |
| 138 | 138 |
| 139 | 139 |
| 140 MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate, | 140 MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate, |
| 141 JSObject* boilerplate) { | 141 JSObject* boilerplate) { |
| 142 StackLimitCheck check(isolate); | 142 StackLimitCheck check(isolate); |
| 143 if (check.HasOverflowed()) return isolate->StackOverflow(); | 143 if (check.HasOverflowed()) return isolate->StackOverflow(); |
| 144 | 144 |
| 145 Heap* heap = isolate->heap(); | 145 Heap* heap = isolate->heap(); |
| 146 Object* result; | 146 Object* result; |
| 147 { MaybeObject* maybe_result = heap->CopyJSObject(boilerplate); | 147 { MaybeObject* maybe_result = heap->CopyJSObject(boilerplate, |
| 148 TRACK_ALLOCATION_ORIGIN); |
| 148 if (!maybe_result->ToObject(&result)) return maybe_result; | 149 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 149 } | 150 } |
| 150 JSObject* copy = JSObject::cast(result); | 151 JSObject* copy = JSObject::cast(result); |
| 151 | 152 |
| 152 // Deep copy local properties. | 153 // Deep copy local properties. |
| 153 if (copy->HasFastProperties()) { | 154 if (copy->HasFastProperties()) { |
| 154 FixedArray* properties = copy->properties(); | 155 FixedArray* properties = copy->properties(); |
| 155 for (int i = 0; i < properties->length(); i++) { | 156 for (int i = 0; i < properties->length(); i++) { |
| 156 Object* value = properties->get(i); | 157 Object* value = properties->get(i); |
| 157 if (value->IsJSObject()) { | 158 if (value->IsJSObject()) { |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 if (*boilerplate == isolate->heap()->undefined_value()) { | 616 if (*boilerplate == isolate->heap()->undefined_value()) { |
| 616 boilerplate = CreateObjectLiteralBoilerplate(isolate, | 617 boilerplate = CreateObjectLiteralBoilerplate(isolate, |
| 617 literals, | 618 literals, |
| 618 constant_properties, | 619 constant_properties, |
| 619 should_have_fast_elements, | 620 should_have_fast_elements, |
| 620 has_function_literal); | 621 has_function_literal); |
| 621 if (boilerplate.is_null()) return Failure::Exception(); | 622 if (boilerplate.is_null()) return Failure::Exception(); |
| 622 // Update the functions literal and return the boilerplate. | 623 // Update the functions literal and return the boilerplate. |
| 623 literals->set(literals_index, *boilerplate); | 624 literals->set(literals_index, *boilerplate); |
| 624 } | 625 } |
| 625 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate)); | 626 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate), |
| 627 TRACK_ALLOCATION_ORIGIN); |
| 626 } | 628 } |
| 627 | 629 |
| 628 | 630 |
| 629 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { | 631 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { |
| 630 HandleScope scope(isolate); | 632 HandleScope scope(isolate); |
| 631 ASSERT(args.length() == 3); | 633 ASSERT(args.length() == 3); |
| 632 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 634 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
| 633 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 635 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
| 634 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 636 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
| 635 | 637 |
| (...skipping 12665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13301 // Handle last resort GC and make sure to allow future allocations | 13303 // Handle last resort GC and make sure to allow future allocations |
| 13302 // to grow the heap without causing GCs (if possible). | 13304 // to grow the heap without causing GCs (if possible). |
| 13303 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13305 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13304 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13306 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13305 "Runtime::PerformGC"); | 13307 "Runtime::PerformGC"); |
| 13306 } | 13308 } |
| 13307 } | 13309 } |
| 13308 | 13310 |
| 13309 | 13311 |
| 13310 } } // namespace v8::internal | 13312 } } // namespace v8::internal |
| OLD | NEW |