Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/runtime.cc

Issue 12114054: Supporting AllocationSiteInfo for Nested arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing a port compile failure Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // and store it in a LanguageMode variable with the given name. 131 // and store it in a LanguageMode variable with the given name.
132 #define CONVERT_LANGUAGE_MODE_ARG(name, index) \ 132 #define CONVERT_LANGUAGE_MODE_ARG(name, index) \
133 ASSERT(args[index]->IsSmi()); \ 133 ASSERT(args[index]->IsSmi()); \
134 ASSERT(args.smi_at(index) == CLASSIC_MODE || \ 134 ASSERT(args.smi_at(index) == CLASSIC_MODE || \
135 args.smi_at(index) == STRICT_MODE || \ 135 args.smi_at(index) == STRICT_MODE || \
136 args.smi_at(index) == EXTENDED_MODE); \ 136 args.smi_at(index) == EXTENDED_MODE); \
137 LanguageMode name = \ 137 LanguageMode name = \
138 static_cast<LanguageMode>(args.smi_at(index)); 138 static_cast<LanguageMode>(args.smi_at(index));
139 139
140 140
141 MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate, 141
142 JSObject* boilerplate) { 142 MUST_USE_RESULT MaybeObject* Runtime::DeepCopyBoilerplate(
143 Isolate* isolate,
144 JSObject* boilerplate,
145 AllocationSiteMode allocation_site_mode) {
143 StackLimitCheck check(isolate); 146 StackLimitCheck check(isolate);
144 if (check.HasOverflowed()) return isolate->StackOverflow(); 147 if (check.HasOverflowed()) return isolate->StackOverflow();
145 148
146 Heap* heap = isolate->heap(); 149 Heap* heap = isolate->heap();
147 Object* result; 150 Object* result;
148 { MaybeObject* maybe_result = heap->CopyJSObject(boilerplate); 151 MaybeObject* maybe_result;
149 if (!maybe_result->ToObject(&result)) return maybe_result; 152 if (allocation_site_mode == TRACK_ALLOCATION_SITE &&
153 boilerplate->ShouldTrackAllocationInfo()) {
154 maybe_result = heap->CopyJSObjectWithAllocationSite(boilerplate);
155 } else {
156 maybe_result = heap->CopyJSObject(boilerplate);
150 } 157 }
158
159 if (!maybe_result->ToObject(&result)) return maybe_result;
160
151 JSObject* copy = JSObject::cast(result); 161 JSObject* copy = JSObject::cast(result);
152 162
153 // Deep copy local properties. 163 // Deep copy local properties.
154 if (copy->HasFastProperties()) { 164 if (copy->HasFastProperties()) {
155 FixedArray* properties = copy->properties(); 165 FixedArray* properties = copy->properties();
156 for (int i = 0; i < properties->length(); i++) { 166 for (int i = 0; i < properties->length(); i++) {
157 Object* value = properties->get(i); 167 Object* value = properties->get(i);
158 if (value->IsJSObject()) { 168 if (value->IsJSObject()) {
159 JSObject* js_object = JSObject::cast(value); 169 JSObject* js_object = JSObject::cast(value);
160 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object); 170 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object,
171 allocation_site_mode);
161 if (!maybe_result->ToObject(&result)) return maybe_result; 172 if (!maybe_result->ToObject(&result)) return maybe_result;
162 } 173 }
163 properties->set(i, result); 174 properties->set(i, result);
164 } 175 }
165 } 176 }
166 int nof = copy->map()->inobject_properties(); 177 int nof = copy->map()->inobject_properties();
167 for (int i = 0; i < nof; i++) { 178 for (int i = 0; i < nof; i++) {
168 Object* value = copy->InObjectPropertyAt(i); 179 Object* value = copy->InObjectPropertyAt(i);
169 if (value->IsJSObject()) { 180 if (value->IsJSObject()) {
170 JSObject* js_object = JSObject::cast(value); 181 JSObject* js_object = JSObject::cast(value);
171 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object); 182 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object,
183 allocation_site_mode);
172 if (!maybe_result->ToObject(&result)) return maybe_result; 184 if (!maybe_result->ToObject(&result)) return maybe_result;
173 } 185 }
174 copy->InObjectPropertyAtPut(i, result); 186 copy->InObjectPropertyAtPut(i, result);
175 } 187 }
176 } 188 }
177 } else { 189 } else {
178 { MaybeObject* maybe_result = 190 { MaybeObject* maybe_result =
179 heap->AllocateFixedArray(copy->NumberOfLocalProperties()); 191 heap->AllocateFixedArray(copy->NumberOfLocalProperties());
180 if (!maybe_result->ToObject(&result)) return maybe_result; 192 if (!maybe_result->ToObject(&result)) return maybe_result;
181 } 193 }
182 FixedArray* names = FixedArray::cast(result); 194 FixedArray* names = FixedArray::cast(result);
183 copy->GetLocalPropertyNames(names, 0); 195 copy->GetLocalPropertyNames(names, 0);
184 for (int i = 0; i < names->length(); i++) { 196 for (int i = 0; i < names->length(); i++) {
185 ASSERT(names->get(i)->IsString()); 197 ASSERT(names->get(i)->IsString());
186 String* key_string = String::cast(names->get(i)); 198 String* key_string = String::cast(names->get(i));
187 PropertyAttributes attributes = 199 PropertyAttributes attributes =
188 copy->GetLocalPropertyAttribute(key_string); 200 copy->GetLocalPropertyAttribute(key_string);
189 // Only deep copy fields from the object literal expression. 201 // Only deep copy fields from the object literal expression.
190 // In particular, don't try to copy the length attribute of 202 // In particular, don't try to copy the length attribute of
191 // an array. 203 // an array.
192 if (attributes != NONE) continue; 204 if (attributes != NONE) continue;
193 Object* value = 205 Object* value =
194 copy->GetProperty(key_string, &attributes)->ToObjectUnchecked(); 206 copy->GetProperty(key_string, &attributes)->ToObjectUnchecked();
195 if (value->IsJSObject()) { 207 if (value->IsJSObject()) {
196 JSObject* js_object = JSObject::cast(value); 208 JSObject* js_object = JSObject::cast(value);
197 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object); 209 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, js_object,
210 allocation_site_mode);
198 if (!maybe_result->ToObject(&result)) return maybe_result; 211 if (!maybe_result->ToObject(&result)) return maybe_result;
199 } 212 }
200 { MaybeObject* maybe_result = 213 { MaybeObject* maybe_result =
201 // Creating object copy for literals. No strict mode needed. 214 // Creating object copy for literals. No strict mode needed.
202 copy->SetProperty(key_string, result, NONE, kNonStrictMode); 215 copy->SetProperty(key_string, result, NONE, kNonStrictMode);
203 if (!maybe_result->ToObject(&result)) return maybe_result; 216 if (!maybe_result->ToObject(&result)) return maybe_result;
204 } 217 }
205 } 218 }
206 } 219 }
207 } 220 }
(...skipping 16 matching lines...) Expand all
224 #endif 237 #endif
225 } else { 238 } else {
226 for (int i = 0; i < elements->length(); i++) { 239 for (int i = 0; i < elements->length(); i++) {
227 Object* value = elements->get(i); 240 Object* value = elements->get(i);
228 ASSERT(value->IsSmi() || 241 ASSERT(value->IsSmi() ||
229 value->IsTheHole() || 242 value->IsTheHole() ||
230 (IsFastObjectElementsKind(copy->GetElementsKind()))); 243 (IsFastObjectElementsKind(copy->GetElementsKind())));
231 if (value->IsJSObject()) { 244 if (value->IsJSObject()) {
232 JSObject* js_object = JSObject::cast(value); 245 JSObject* js_object = JSObject::cast(value);
233 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, 246 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate,
234 js_object); 247 js_object,
248 allocation_site_mode);
235 if (!maybe_result->ToObject(&result)) return maybe_result; 249 if (!maybe_result->ToObject(&result)) return maybe_result;
236 } 250 }
237 elements->set(i, result); 251 elements->set(i, result);
238 } 252 }
239 } 253 }
240 } 254 }
241 break; 255 break;
242 } 256 }
243 case DICTIONARY_ELEMENTS: { 257 case DICTIONARY_ELEMENTS: {
244 SeededNumberDictionary* element_dictionary = copy->element_dictionary(); 258 SeededNumberDictionary* element_dictionary = copy->element_dictionary();
245 int capacity = element_dictionary->Capacity(); 259 int capacity = element_dictionary->Capacity();
246 for (int i = 0; i < capacity; i++) { 260 for (int i = 0; i < capacity; i++) {
247 Object* k = element_dictionary->KeyAt(i); 261 Object* k = element_dictionary->KeyAt(i);
248 if (element_dictionary->IsKey(k)) { 262 if (element_dictionary->IsKey(k)) {
249 Object* value = element_dictionary->ValueAt(i); 263 Object* value = element_dictionary->ValueAt(i);
250 if (value->IsJSObject()) { 264 if (value->IsJSObject()) {
251 JSObject* js_object = JSObject::cast(value); 265 JSObject* js_object = JSObject::cast(value);
252 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, 266 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate,
253 js_object); 267 js_object,
268 allocation_site_mode);
254 if (!maybe_result->ToObject(&result)) return maybe_result; 269 if (!maybe_result->ToObject(&result)) return maybe_result;
255 } 270 }
256 element_dictionary->ValueAtPut(i, result); 271 element_dictionary->ValueAtPut(i, result);
257 } 272 }
258 } 273 }
259 } 274 }
260 break; 275 break;
261 } 276 }
262 case NON_STRICT_ARGUMENTS_ELEMENTS: 277 case NON_STRICT_ARGUMENTS_ELEMENTS:
263 UNIMPLEMENTED(); 278 UNIMPLEMENTED();
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 593
579 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) { 594 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteral) {
580 HandleScope scope(isolate); 595 HandleScope scope(isolate);
581 ASSERT(args.length() == 4); 596 ASSERT(args.length() == 4);
582 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 597 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
583 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 598 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
584 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); 599 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
585 CONVERT_SMI_ARG_CHECKED(flags, 3); 600 CONVERT_SMI_ARG_CHECKED(flags, 3);
586 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; 601 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0;
587 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; 602 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0;
603 bool allocation_sites_allowed =
604 (flags & ObjectLiteral::kCreateAllocationSiteInfos) != 0;
605
606 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
607 if (allocation_sites_allowed) {
608 allocation_site_mode = TRACK_ALLOCATION_SITE;
609 }
588 610
589 // Check if boilerplate exists. If not, create it first. 611 // Check if boilerplate exists. If not, create it first.
590 Handle<Object> boilerplate(literals->get(literals_index), isolate); 612 Handle<Object> boilerplate(literals->get(literals_index), isolate);
591 if (*boilerplate == isolate->heap()->undefined_value()) { 613 if (*boilerplate == isolate->heap()->undefined_value()) {
592 boilerplate = CreateObjectLiteralBoilerplate(isolate, 614 boilerplate = CreateObjectLiteralBoilerplate(isolate,
593 literals, 615 literals,
594 constant_properties, 616 constant_properties,
595 should_have_fast_elements, 617 should_have_fast_elements,
596 has_function_literal); 618 has_function_literal);
597 if (boilerplate.is_null()) return Failure::Exception(); 619 if (boilerplate.is_null()) return Failure::Exception();
598 // Update the functions literal and return the boilerplate. 620 // Update the functions literal and return the boilerplate.
599 literals->set(literals_index, *boilerplate); 621 literals->set(literals_index, *boilerplate);
600 } 622 }
601 return DeepCopyBoilerplate(isolate, JSObject::cast(*boilerplate)); 623
624 return Runtime::DeepCopyBoilerplate(isolate,
625 JSObject::cast(*boilerplate),
626 allocation_site_mode);
602 } 627 }
603 628
604 629
605 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) { 630 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateObjectLiteralShallow) {
606 HandleScope scope(isolate); 631 HandleScope scope(isolate);
607 ASSERT(args.length() == 4); 632 ASSERT(args.length() == 4);
608 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 633 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
609 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 634 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
610 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2); 635 CONVERT_ARG_HANDLE_CHECKED(FixedArray, constant_properties, 2);
611 CONVERT_SMI_ARG_CHECKED(flags, 3); 636 CONVERT_SMI_ARG_CHECKED(flags, 3);
612 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0; 637 bool should_have_fast_elements = (flags & ObjectLiteral::kFastElements) != 0;
613 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0; 638 bool has_function_literal = (flags & ObjectLiteral::kHasFunction) != 0;
639 bool allocation_site_info_allowed =
640 (flags & ObjectLiteral::kCreateAllocationSiteInfos) != 0;
614 641
615 // Check if boilerplate exists. If not, create it first. 642 // Check if boilerplate exists. If not, create it first.
616 Handle<Object> boilerplate(literals->get(literals_index), isolate); 643 Handle<Object> boilerplate(literals->get(literals_index), isolate);
617 if (*boilerplate == isolate->heap()->undefined_value()) { 644 if (*boilerplate == isolate->heap()->undefined_value()) {
618 boilerplate = CreateObjectLiteralBoilerplate(isolate, 645 boilerplate = CreateObjectLiteralBoilerplate(isolate,
619 literals, 646 literals,
620 constant_properties, 647 constant_properties,
621 should_have_fast_elements, 648 should_have_fast_elements,
622 has_function_literal); 649 has_function_literal);
623 if (boilerplate.is_null()) return Failure::Exception(); 650 if (boilerplate.is_null()) return Failure::Exception();
624 // Update the functions literal and return the boilerplate. 651 // Update the functions literal and return the boilerplate.
625 literals->set(literals_index, *boilerplate); 652 literals->set(literals_index, *boilerplate);
626 } 653 }
627 return isolate->heap()->CopyJSObject(JSObject::cast(*boilerplate)); 654
655 JSObject* boilerplate_object = JSObject::cast(*boilerplate);
656 if (allocation_site_info_allowed &&
657 boilerplate_object->ShouldTrackAllocationInfo()) {
658 return isolate->heap()->CopyJSObjectWithAllocationSite(
659 boilerplate_object);
660 }
661
662 return isolate->heap()->CopyJSObject(boilerplate_object);
628 } 663 }
629 664
630 665
631 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) { 666 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteral) {
632 HandleScope scope(isolate); 667 HandleScope scope(isolate);
633 ASSERT(args.length() == 3); 668 ASSERT(args.length() == 4);
634 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 669 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
635 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 670 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
636 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 671 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
672 CONVERT_SMI_ARG_CHECKED(flags, 3);
673 bool allocation_sites_allowed =
674 (flags & ArrayLiteral::kCreateAllocationSiteInfos) != 0;
675
676 AllocationSiteMode allocation_site_mode = DONT_TRACK_ALLOCATION_SITE;
677 if (allocation_sites_allowed) {
678 allocation_site_mode = TRACK_ALLOCATION_SITE;
679 }
637 680
638 // Check if boilerplate exists. If not, create it first. 681 // Check if boilerplate exists. If not, create it first.
639 Handle<Object> boilerplate(literals->get(literals_index), isolate); 682 Handle<Object> boilerplate(literals->get(literals_index), isolate);
640 if (*boilerplate == isolate->heap()->undefined_value()) { 683 if (*boilerplate == isolate->heap()->undefined_value()) {
641 ASSERT(*elements != isolate->heap()->empty_fixed_array()); 684 ASSERT(*elements != isolate->heap()->empty_fixed_array());
642 boilerplate = 685 boilerplate =
643 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); 686 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements);
644 if (boilerplate.is_null()) return Failure::Exception(); 687 if (boilerplate.is_null()) return Failure::Exception();
645 // Update the functions literal and return the boilerplate. 688 // Update the functions literal and return the boilerplate.
646 literals->set(literals_index, *boilerplate); 689 literals->set(literals_index, *boilerplate);
647 } 690 }
648 return DeepCopyBoilerplate(isolate, JSObject::cast(*boilerplate)); 691
692 return Runtime::DeepCopyBoilerplate(isolate,
693 JSObject::cast(*boilerplate),
694 allocation_site_mode);
649 } 695 }
650 696
651 697
652 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) { 698 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateArrayLiteralShallow) {
653 HandleScope scope(isolate); 699 HandleScope scope(isolate);
654 ASSERT(args.length() == 3); 700 ASSERT(args.length() == 4);
655 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0); 701 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 0);
656 CONVERT_SMI_ARG_CHECKED(literals_index, 1); 702 CONVERT_SMI_ARG_CHECKED(literals_index, 1);
657 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2); 703 CONVERT_ARG_HANDLE_CHECKED(FixedArray, elements, 2);
704 CONVERT_SMI_ARG_CHECKED(flags, 3);
705 bool allocation_site_info_allowed =
706 ((flags & ArrayLiteral::kCreateAllocationSiteInfos) != 0);
658 707
659 // Check if boilerplate exists. If not, create it first. 708 // Check if boilerplate exists. If not, create it first.
660 Handle<Object> boilerplate(literals->get(literals_index), isolate); 709 Handle<Object> boilerplate(literals->get(literals_index), isolate);
661 if (*boilerplate == isolate->heap()->undefined_value()) { 710 if (*boilerplate == isolate->heap()->undefined_value()) {
662 ASSERT(*elements != isolate->heap()->empty_fixed_array()); 711 ASSERT(*elements != isolate->heap()->empty_fixed_array());
663 boilerplate = 712 boilerplate =
664 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements); 713 Runtime::CreateArrayLiteralBoilerplate(isolate, literals, elements);
665 if (boilerplate.is_null()) return Failure::Exception(); 714 if (boilerplate.is_null()) return Failure::Exception();
666 // Update the functions literal and return the boilerplate. 715 // Update the functions literal and return the boilerplate.
667 literals->set(literals_index, *boilerplate); 716 literals->set(literals_index, *boilerplate);
668 } 717 }
669 if (JSObject::cast(*boilerplate)->elements()->map() == 718 if (JSObject::cast(*boilerplate)->elements()->map() ==
670 isolate->heap()->fixed_cow_array_map()) { 719 isolate->heap()->fixed_cow_array_map()) {
671 isolate->counters()->cow_arrays_created_runtime()->Increment(); 720 isolate->counters()->cow_arrays_created_runtime()->Increment();
672 } 721 }
673 722
674 JSObject* boilerplate_object = JSObject::cast(*boilerplate); 723 JSObject* boilerplate_object = JSObject::cast(*boilerplate);
675 AllocationSiteMode mode = AllocationSiteInfo::GetMode( 724 bool create_info = allocation_site_info_allowed &&
676 boilerplate_object->GetElementsKind()); 725 boilerplate_object->ShouldTrackAllocationInfo();
726 AllocationSiteMode mode = create_info
727 ? TRACK_ALLOCATION_SITE
728 : DONT_TRACK_ALLOCATION_SITE;
677 if (mode == TRACK_ALLOCATION_SITE) { 729 if (mode == TRACK_ALLOCATION_SITE) {
678 return isolate->heap()->CopyJSObjectWithAllocationSite(boilerplate_object); 730 return isolate->heap()->CopyJSObjectWithAllocationSite(boilerplate_object);
679 } 731 }
680 732
681 return isolate->heap()->CopyJSObject(boilerplate_object); 733 return isolate->heap()->CopyJSObject(boilerplate_object);
682 } 734 }
683 735
684 736
685 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { 737 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) {
686 NoHandleAllocation ha(isolate); 738 NoHandleAllocation ha(isolate);
(...skipping 3785 matching lines...) Expand 10 before | Expand all | Expand 10 after
4472 ElementsKind elements_kind = object->GetElementsKind(); 4524 ElementsKind elements_kind = object->GetElementsKind();
4473 ASSERT(IsFastElementsKind(elements_kind)); 4525 ASSERT(IsFastElementsKind(elements_kind));
4474 // Smis should never trigger transitions. 4526 // Smis should never trigger transitions.
4475 ASSERT(!value->IsSmi()); 4527 ASSERT(!value->IsSmi());
4476 4528
4477 if (value->IsNumber()) { 4529 if (value->IsNumber()) {
4478 ASSERT(IsFastSmiElementsKind(elements_kind)); 4530 ASSERT(IsFastSmiElementsKind(elements_kind));
4479 ElementsKind transitioned_kind = IsFastHoleyElementsKind(elements_kind) 4531 ElementsKind transitioned_kind = IsFastHoleyElementsKind(elements_kind)
4480 ? FAST_HOLEY_DOUBLE_ELEMENTS 4532 ? FAST_HOLEY_DOUBLE_ELEMENTS
4481 : FAST_DOUBLE_ELEMENTS; 4533 : FAST_DOUBLE_ELEMENTS;
4482 if (IsMoreGeneralElementsKindTransition(
4483 boilerplate_object->GetElementsKind(),
4484 transitioned_kind)) {
4485 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind);
4486 }
4487 JSObject::TransitionElementsKind(object, transitioned_kind); 4534 JSObject::TransitionElementsKind(object, transitioned_kind);
4488 ASSERT(IsFastDoubleElementsKind(object->GetElementsKind())); 4535 ASSERT(IsFastDoubleElementsKind(object->GetElementsKind()));
4489 FixedDoubleArray* double_array = FixedDoubleArray::cast(object->elements()); 4536 FixedDoubleArray* double_array = FixedDoubleArray::cast(object->elements());
4490 HeapNumber* number = HeapNumber::cast(*value); 4537 HeapNumber* number = HeapNumber::cast(*value);
4491 double_array->set(store_index, number->Number()); 4538 double_array->set(store_index, number->Number());
4492 } else { 4539 } else {
4493 ASSERT(IsFastSmiElementsKind(elements_kind) || 4540 ASSERT(IsFastSmiElementsKind(elements_kind) ||
4494 IsFastDoubleElementsKind(elements_kind)); 4541 IsFastDoubleElementsKind(elements_kind));
4495 ElementsKind transitioned_kind = IsFastHoleyElementsKind(elements_kind) 4542 ElementsKind transitioned_kind = IsFastHoleyElementsKind(elements_kind)
4496 ? FAST_HOLEY_ELEMENTS 4543 ? FAST_HOLEY_ELEMENTS
4497 : FAST_ELEMENTS; 4544 : FAST_ELEMENTS;
4498 JSObject::TransitionElementsKind(object, transitioned_kind); 4545 JSObject::TransitionElementsKind(object, transitioned_kind);
4499 if (IsMoreGeneralElementsKindTransition(
4500 boilerplate_object->GetElementsKind(),
4501 transitioned_kind)) {
4502 JSObject::TransitionElementsKind(boilerplate_object, transitioned_kind);
4503 }
4504 FixedArray* object_array = FixedArray::cast(object->elements()); 4546 FixedArray* object_array = FixedArray::cast(object->elements());
4505 object_array->set(store_index, *value); 4547 object_array->set(store_index, *value);
4506 } 4548 }
4507 return *object; 4549 return *object;
4508 } 4550 }
4509 4551
4510 4552
4511 // Check whether debugger and is about to step into the callback that is passed 4553 // Check whether debugger and is about to step into the callback that is passed
4512 // to a built-in function such as Array.forEach. 4554 // to a built-in function such as Array.forEach.
4513 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugCallbackSupportsStepping) { 4555 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugCallbackSupportsStepping) {
(...skipping 8892 matching lines...) Expand 10 before | Expand all | Expand 10 after
13406 // Handle last resort GC and make sure to allow future allocations 13448 // Handle last resort GC and make sure to allow future allocations
13407 // to grow the heap without causing GCs (if possible). 13449 // to grow the heap without causing GCs (if possible).
13408 isolate->counters()->gc_last_resort_from_js()->Increment(); 13450 isolate->counters()->gc_last_resort_from_js()->Increment();
13409 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13451 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13410 "Runtime::PerformGC"); 13452 "Runtime::PerformGC");
13411 } 13453 }
13412 } 13454 }
13413 13455
13414 13456
13415 } } // namespace v8::internal 13457 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698