| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // and store it in a LanguageMode variable with the given name. | 129 // and store it in a LanguageMode variable with the given name. |
| 130 #define CONVERT_LANGUAGE_MODE_ARG(name, index) \ | 130 #define CONVERT_LANGUAGE_MODE_ARG(name, index) \ |
| 131 ASSERT(args[index]->IsSmi()); \ | 131 ASSERT(args[index]->IsSmi()); \ |
| 132 ASSERT(args.smi_at(index) == CLASSIC_MODE || \ | 132 ASSERT(args.smi_at(index) == CLASSIC_MODE || \ |
| 133 args.smi_at(index) == STRICT_MODE || \ | 133 args.smi_at(index) == STRICT_MODE || \ |
| 134 args.smi_at(index) == EXTENDED_MODE); \ | 134 args.smi_at(index) == EXTENDED_MODE); \ |
| 135 LanguageMode name = \ | 135 LanguageMode name = \ |
| 136 static_cast<LanguageMode>(args.smi_at(index)); | 136 static_cast<LanguageMode>(args.smi_at(index)); |
| 137 | 137 |
| 138 | 138 |
| 139 MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate, | 139 |
| 140 JSObject* boilerplate) { | 140 MUST_USE_RESULT MaybeObject* Runtime::DeepCopyBoilerplate( |
| 141 Isolate* isolate, |
| 142 JSObject* boilerplate, |
| 143 AllocationSiteMode allocation_site_mode) { |
| 141 StackLimitCheck check(isolate); | 144 StackLimitCheck check(isolate); |
| 142 if (check.HasOverflowed()) return isolate->StackOverflow(); | 145 if (check.HasOverflowed()) return isolate->StackOverflow(); |
| 143 | 146 |
| 144 Heap* heap = isolate->heap(); | 147 Heap* heap = isolate->heap(); |
| 145 Object* result; | 148 Object* result; |
| 146 { MaybeObject* maybe_result = heap->CopyJSObject(boilerplate); | 149 AllocationSiteMode current_object_mode = DONT_TRACK_ALLOCATION_SITE; |
| 150 if (allocation_site_mode == TRACK_ALLOCATION_SITE && |
| 151 boilerplate->map()->CanTrackAllocationSite()) { |
| 152 current_object_mode = boilerplate->IsJSArray() |
| 153 ? AllocationSiteInfo::GetMode(boilerplate->GetElementsKind()) |
| 154 : TRACK_ALLOCATION_SITE; |
| 155 } |
| 156 |
| 157 { MaybeObject* maybe_result = heap->CopyJSObject(boilerplate, |
| 158 current_object_mode); |
| 147 if (!maybe_result->ToObject(&result)) return maybe_result; | 159 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 148 } | 160 } |
| 149 JSObject* copy = JSObject::cast(result); | 161 JSObject* copy = JSObject::cast(result); |
| 150 | 162 |
| 151 // Deep copy local properties. | 163 // Deep copy local properties. |
| 152 if (copy->HasFastProperties()) { | 164 if (copy->HasFastProperties()) { |
| 153 FixedArray* properties = copy->properties(); | 165 FixedArray* properties = copy->properties(); |
| 154 for (int i = 0; i < properties->length(); i++) { | 166 for (int i = 0; i < properties->length(); i++) { |
| 155 Object* value = properties->get(i); | 167 Object* value = properties->get(i); |
| 156 if (value->IsJSObject()) { | 168 if (value->IsJSObject()) { |
| 157 JSObject* js_object = JSObject::cast(value); | 169 JSObject* js_object = JSObject::cast(value); |
| 158 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object); | 170 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object, |
| 171 allocation_site_mode); |
| 159 if (!maybe_result->ToObject(&result)) return maybe_result; | 172 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 160 } | 173 } |
| 161 properties->set(i, result); | 174 properties->set(i, result); |
| 162 } | 175 } |
| 163 } | 176 } |
| 164 int nof = copy->map()->inobject_properties(); | 177 int nof = copy->map()->inobject_properties(); |
| 165 for (int i = 0; i < nof; i++) { | 178 for (int i = 0; i < nof; i++) { |
| 166 Object* value = copy->InObjectPropertyAt(i); | 179 Object* value = copy->InObjectPropertyAt(i); |
| 167 if (value->IsJSObject()) { | 180 if (value->IsJSObject()) { |
| 168 JSObject* js_object = JSObject::cast(value); | 181 JSObject* js_object = JSObject::cast(value); |
| 169 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object); | 182 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object, |
| 183 allocation_site_mode); |
| 170 if (!maybe_result->ToObject(&result)) return maybe_result; | 184 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 171 } | 185 } |
| 172 copy->InObjectPropertyAtPut(i, result); | 186 copy->InObjectPropertyAtPut(i, result); |
| 173 } | 187 } |
| 174 } | 188 } |
| 175 } else { | 189 } else { |
| 176 { MaybeObject* maybe_result = | 190 { MaybeObject* maybe_result = |
| 177 heap->AllocateFixedArray(copy->NumberOfLocalProperties()); | 191 heap->AllocateFixedArray(copy->NumberOfLocalProperties()); |
| 178 if (!maybe_result->ToObject(&result)) return maybe_result; | 192 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 179 } | 193 } |
| 180 FixedArray* names = FixedArray::cast(result); | 194 FixedArray* names = FixedArray::cast(result); |
| 181 copy->GetLocalPropertyNames(names, 0); | 195 copy->GetLocalPropertyNames(names, 0); |
| 182 for (int i = 0; i < names->length(); i++) { | 196 for (int i = 0; i < names->length(); i++) { |
| 183 ASSERT(names->get(i)->IsString()); | 197 ASSERT(names->get(i)->IsString()); |
| 184 String* key_string = String::cast(names->get(i)); | 198 String* key_string = String::cast(names->get(i)); |
| 185 PropertyAttributes attributes = | 199 PropertyAttributes attributes = |
| 186 copy->GetLocalPropertyAttribute(key_string); | 200 copy->GetLocalPropertyAttribute(key_string); |
| 187 // Only deep copy fields from the object literal expression. | 201 // Only deep copy fields from the object literal expression. |
| 188 // In particular, don't try to copy the length attribute of | 202 // In particular, don't try to copy the length attribute of |
| 189 // an array. | 203 // an array. |
| 190 if (attributes != NONE) continue; | 204 if (attributes != NONE) continue; |
| 191 Object* value = | 205 Object* value = |
| 192 copy->GetProperty(key_string, &attributes)->ToObjectUnchecked(); | 206 copy->GetProperty(key_string, &attributes)->ToObjectUnchecked(); |
| 193 if (value->IsJSObject()) { | 207 if (value->IsJSObject()) { |
| 194 JSObject* js_object = JSObject::cast(value); | 208 JSObject* js_object = JSObject::cast(value); |
| 195 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object); | 209 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object, |
| 210 allocation_site_mode); |
| 196 if (!maybe_result->ToObject(&result)) return maybe_result; | 211 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 197 } | 212 } |
| 198 { MaybeObject* maybe_result = | 213 { MaybeObject* maybe_result = |
| 199 // Creating object copy for literals. No strict mode needed. | 214 // Creating object copy for literals. No strict mode needed. |
| 200 copy->SetProperty(key_string, result, NONE, kNonStrictMode); | 215 copy->SetProperty(key_string, result, NONE, kNonStrictMode); |
| 201 if (!maybe_result->ToObject(&result)) return maybe_result; | 216 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 202 } | 217 } |
| 203 } | 218 } |
| 204 } | 219 } |
| 205 } | 220 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 222 #endif | 237 #endif |
| 223 } else { | 238 } else { |
| 224 for (int i = 0; i < elements->length(); i++) { | 239 for (int i = 0; i < elements->length(); i++) { |
| 225 Object* value = elements->get(i); | 240 Object* value = elements->get(i); |
| 226 ASSERT(value->IsSmi() || | 241 ASSERT(value->IsSmi() || |
| 227 value->IsTheHole() || | 242 value->IsTheHole() || |
| 228 (IsFastObjectElementsKind(copy->GetElementsKind()))); | 243 (IsFastObjectElementsKind(copy->GetElementsKind()))); |
| 229 if (value->IsJSObject()) { | 244 if (value->IsJSObject()) { |
| 230 JSObject* js_object = JSObject::cast(value); | 245 JSObject* js_object = JSObject::cast(value); |
| 231 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, | 246 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, |
| 232 js_object); | 247 js_object, |
| 248 allocation_site_mode); |
| 233 if (!maybe_result->ToObject(&result)) return maybe_result; | 249 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 234 } | 250 } |
| 235 elements->set(i, result); | 251 elements->set(i, result); |
| 236 } | 252 } |
| 237 } | 253 } |
| 238 } | 254 } |
| 239 break; | 255 break; |
| 240 } | 256 } |
| 241 case DICTIONARY_ELEMENTS: { | 257 case DICTIONARY_ELEMENTS: { |
| 242 SeededNumberDictionary* element_dictionary = copy->element_dictionary(); | 258 SeededNumberDictionary* element_dictionary = copy->element_dictionary(); |
| 243 int capacity = element_dictionary->Capacity(); | 259 int capacity = element_dictionary->Capacity(); |
| 244 for (int i = 0; i < capacity; i++) { | 260 for (int i = 0; i < capacity; i++) { |
| 245 Object* k = element_dictionary->KeyAt(i); | 261 Object* k = element_dictionary->KeyAt(i); |
| 246 if (element_dictionary->IsKey(k)) { | 262 if (element_dictionary->IsKey(k)) { |
| 247 Object* value = element_dictionary->ValueAt(i); | 263 Object* value = element_dictionary->ValueAt(i); |
| 248 if (value->IsJSObject()) { | 264 if (value->IsJSObject()) { |
| 249 JSObject* js_object = JSObject::cast(value); | 265 JSObject* js_object = JSObject::cast(value); |
| 250 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, | 266 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, |
| 251 js_object); | 267 js_object, |
| 268 allocation_site_mode); |
| 252 if (!maybe_result->ToObject(&result)) return maybe_result; | 269 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 253 } | 270 } |
| 254 element_dictionary->ValueAtPut(i, result); | 271 element_dictionary->ValueAtPut(i, result); |
| 255 } | 272 } |
| 256 } | 273 } |
| 257 } | 274 } |
| 258 break; | 275 break; |
| 259 } | 276 } |
| 260 case NON_STRICT_ARGUMENTS_ELEMENTS: | 277 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 261 UNIMPLEMENTED(); | 278 UNIMPLEMENTED(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 | 592 |
| 576 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) { | 593 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) { |
| 577 HandleScope scope(isolate); | 594 HandleScope scope(isolate); |
| 578 ASSERT(args.length() == 4); | 595 ASSERT(args.length() == 4); |
| 579 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 596 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
| 580 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 597 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
| 581 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); | 598 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); |
| 582 CONVERT_SMI_ARG_CHECKED(flags, 3); | 599 CONVERT_SMI_ARG_CHECKED(flags, 3); |
| 583 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; | 600 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; |
| 584 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; | 601 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; |
| 602 bool allocation_sites_allowed = |
| 603 (flags & ObjectLiteral::kAllocationSiteInfoAllowed) != 0; |
| 604 |
| 605 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 606 if (FLAG_track_allocation_sites && allocation_sites_allowed) { |
| 607 allocation_site_mode = TRACK_ALLOCATION_SITE; |
| 608 } |
| 585 | 609 |
| 586 // Check if boilerplate exists. If not, create it first. | 610 // Check if boilerplate exists. If not, create it first. |
| 587 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 611 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
| 588 if (*boilerplate == isolate->heap()->undefined_value()) { | 612 if (*boilerplate == isolate->heap()->undefined_value()) { |
| 589 boilerplate = CreateObjectLiteralBoilerplate(isolate, | 613 boilerplate = CreateObjectLiteralBoilerplate(isolate, |
| 590 literals, | 614 literals, |
| 591 constant_properties, | 615 constant_properties, |
| 592 should_have_fast_elements, | 616 should_have_fast_elements, |
| 593 has_function_literal); | 617 has_function_literal); |
| 594 if (boilerplate.is_null()) return Failure::Exception(); | 618 if (boilerplate.is_null()) return Failure::Exception(); |
| 595 // Update the functions literal and return the boilerplate. | 619 // Update the functions literal and return the boilerplate. |
| 596 literals->set(literals_index, *boilerplate); | 620 literals->set(literals_index, *boilerplate); |
| 597 } | 621 } |
| 598 return DeepCopyBoilerplate(isolate, JSObject::cast(*boilerplate)); | 622 |
| 623 return Runtime::DeepCopyBoilerplate(isolate, |
| 624 JSObject::cast(*boilerplate), |
| 625 allocation_site_mode); |
| 599 } | 626 } |
| 600 | 627 |
| 601 | 628 |
| 602 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { | 629 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { |
| 603 HandleScope scope(isolate); | 630 HandleScope scope(isolate); |
| 604 ASSERT(args.length() == 4); | 631 ASSERT(args.length() == 4); |
| 605 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 632 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
| 606 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 633 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
| 607 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); | 634 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); |
| 608 CONVERT_SMI_ARG_CHECKED(flags, 3); | 635 CONVERT_SMI_ARG_CHECKED(flags, 3); |
| 609 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; | 636 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; |
| 610 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; | 637 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; |
| 638 bool allocation_site_info_allowed = |
| 639 (flags & ObjectLiteral::kAllocationSiteInfoAllowed) != 0 |
| 640 && FLAG_track_allocation_sites; |
| 611 | 641 |
| 612 // Check if boilerplate exists. If not, create it first. | 642 // Check if boilerplate exists. If not, create it first. |
| 613 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 643 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
| 614 if (*boilerplate == isolate->heap()->undefined_value()) { | 644 if (*boilerplate == isolate->heap()->undefined_value()) { |
| 615 boilerplate = CreateObjectLiteralBoilerplate(isolate, | 645 boilerplate = CreateObjectLiteralBoilerplate(isolate, |
| 616 literals, | 646 literals, |
| 617 constant_properties, | 647 constant_properties, |
| 618 should_have_fast_elements, | 648 should_have_fast_elements, |
| 619 has_function_literal); | 649 has_function_literal); |
| 620 if (boilerplate.is_null()) return Failure::Exception(); | 650 if (boilerplate.is_null()) return Failure::Exception(); |
| 621 // Update the functions literal and return the boilerplate. | 651 // Update the functions literal and return the boilerplate. |
| 622 literals->set(literals_index, *boilerplate); | 652 literals->set(literals_index, *boilerplate); |
| 623 } | 653 } |
| 624 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate)); | 654 |
| 655 AllocationSiteMode mode = allocation_site_info_allowed |
| 656 ? TRACK_ALLOCATION_SITE |
| 657 : DONT_TRACK_ALLOCATION_SITE; |
| 658 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate), |
| 659 mode); |
| 625 } | 660 } |
| 626 | 661 |
| 627 | 662 |
| 628 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { | 663 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { |
| 629 HandleScope scope(isolate); | 664 HandleScope scope(isolate); |
| 630 ASSERT(args.length() == 3); | 665 ASSERT(args.length() == 4); |
| 631 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 666 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
| 632 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 667 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
| 633 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 668 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
| 669 CONVERT_SMI_ARG_CHECKED(flags, 3); |
| 670 bool allocation_sites_allowed = |
| 671 (flags & ArrayLiteral::kAllocationSiteInfoAllowed) != 0; |
| 672 |
| 673 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE; |
| 674 if (FLAG_track_allocation_sites && allocation_sites_allowed) { |
| 675 allocation_site_mode = TRACK_ALLOCATION_SITE; |
| 676 } |
| 634 | 677 |
| 635 // Check if boilerplate exists. If not, create it first. | 678 // Check if boilerplate exists. If not, create it first. |
| 636 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 679 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
| 637 if (*boilerplate == isolate->heap()->undefined_value()) { | 680 if (*boilerplate == isolate->heap()->undefined_value()) { |
| 638 ASSERT(*elements != isolate->heap()->empty_fixed_array()); | 681 ASSERT(*elements != isolate->heap()->empty_fixed_array()); |
| 639 boilerplate = | 682 boilerplate = |
| 640 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); | 683 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); |
| 641 if (boilerplate.is_null()) return Failure::Exception(); | 684 if (boilerplate.is_null()) return Failure::Exception(); |
| 642 // Update the functions literal and return the boilerplate. | 685 // Update the functions literal and return the boilerplate. |
| 643 literals->set(literals_index, *boilerplate); | 686 literals->set(literals_index, *boilerplate); |
| 644 } | 687 } |
| 645 return DeepCopyBoilerplate(isolate, JSObject::cast(*boilerplate)); | 688 |
| 689 return Runtime::DeepCopyBoilerplate(isolate, |
| 690 JSObject::cast(*boilerplate), |
| 691 allocation_site_mode); |
| 646 } | 692 } |
| 647 | 693 |
| 648 | 694 |
| 649 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { | 695 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { |
| 650 HandleScope scope(isolate); | 696 HandleScope scope(isolate); |
| 651 ASSERT(args.length() == 3); | 697 ASSERT(args.length() == 4); |
| 652 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); | 698 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); |
| 653 CONVERT_SMI_ARG_CHECKED(literals_index, 1); | 699 CONVERT_SMI_ARG_CHECKED(literals_index, 1); |
| 654 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); | 700 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); |
| 701 CONVERT_SMI_ARG_CHECKED(flags, 3); |
| 702 bool allocation_site_info_allowed = FLAG_track_allocation_sites && |
| 703 ((flags & ArrayLiteral::kAllocationSiteInfoAllowed) != 0); |
| 655 | 704 |
| 656 // Check if boilerplate exists. If not, create it first. | 705 // Check if boilerplate exists. If not, create it first. |
| 657 Handle<Object> boilerplate(literals->get(literals_index), isolate); | 706 Handle<Object> boilerplate(literals->get(literals_index), isolate); |
| 658 if (*boilerplate == isolate->heap()->undefined_value()) { | 707 if (*boilerplate == isolate->heap()->undefined_value()) { |
| 659 ASSERT(*elements != isolate->heap()->empty_fixed_array()); | 708 ASSERT(*elements != isolate->heap()->empty_fixed_array()); |
| 660 boilerplate = | 709 boilerplate = |
| 661 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); | 710 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); |
| 662 if (boilerplate.is_null()) return Failure::Exception(); | 711 if (boilerplate.is_null()) return Failure::Exception(); |
| 663 // Update the functions literal and return the boilerplate. | 712 // Update the functions literal and return the boilerplate. |
| 664 literals->set(literals_index, *boilerplate); | 713 literals->set(literals_index, *boilerplate); |
| 665 } | 714 } |
| 666 if (JSObject::cast(*boilerplate)->elements()->map() == | 715 if (JSObject::cast(*boilerplate)->elements()->map() == |
| 667 isolate->heap()->fixed_cow_array_map()) { | 716 isolate->heap()->fixed_cow_array_map()) { |
| 668 isolate->counters()->cow_arrays_created_runtime()->Increment(); | 717 isolate->counters()->cow_arrays_created_runtime()->Increment(); |
| 669 } | 718 } |
| 670 | 719 |
| 671 JSObject* boilerplate_object = JSObject::cast(*boilerplate); | 720 JSObject* boilerplate_object = JSObject::cast(*boilerplate); |
| 672 AllocationSiteMode mode = AllocationSiteInfo::GetMode( | 721 AllocationSiteMode mode = allocation_site_info_allowed |
| 673 boilerplate_object->GetElementsKind()); | 722 ? AllocationSiteInfo::GetMode(boilerplate_object->GetElementsKind()) |
| 723 : DONT_TRACK_ALLOCATION_SITE; |
| 674 return isolate->heap()->CopyJSObject(boilerplate_object, mode); | 724 return isolate->heap()->CopyJSObject(boilerplate_object, mode); |
| 675 } | 725 } |
| 676 | 726 |
| 677 | 727 |
| 678 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) { | 728 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) { |
| 679 ASSERT(args.length() == 2); | 729 ASSERT(args.length() == 2); |
| 680 CONVERT_ARG_CHECKED(JSReceiver, handler, 0); | 730 CONVERT_ARG_CHECKED(JSReceiver, handler, 0); |
| 681 Object* prototype = args[1]; | 731 Object* prototype = args[1]; |
| 682 Object* used_prototype = | 732 Object* used_prototype = |
| 683 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value(); | 733 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value(); |
| (...skipping 12833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13517 // Handle last resort GC and make sure to allow future allocations | 13567 // Handle last resort GC and make sure to allow future allocations |
| 13518 // to grow the heap without causing GCs (if possible). | 13568 // to grow the heap without causing GCs (if possible). |
| 13519 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13569 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13520 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13570 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13521 "Runtime::PerformGC"); | 13571 "Runtime::PerformGC"); |
| 13522 } | 13572 } |
| 13523 } | 13573 } |
| 13524 | 13574 |
| 13525 | 13575 |
| 13526 } } // namespace v8::internal | 13576 } } // namespace v8::internal |
| OLD | NEW |