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 4252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4263 int entry = dictionary->FindEntry(key); | 4263 int entry = dictionary->FindEntry(key); |
4264 if ((entry != StringDictionary::kNotFound) && | 4264 if ((entry != StringDictionary::kNotFound) && |
4265 (dictionary->DetailsAt(entry).type() == NORMAL)) { | 4265 (dictionary->DetailsAt(entry).type() == NORMAL)) { |
4266 Object* value = dictionary->ValueAt(entry); | 4266 Object* value = dictionary->ValueAt(entry); |
4267 if (!receiver->IsGlobalObject()) return value; | 4267 if (!receiver->IsGlobalObject()) return value; |
4268 value = JSGlobalPropertyCell::cast(value)->value(); | 4268 value = JSGlobalPropertyCell::cast(value)->value(); |
4269 if (!value->IsTheHole()) return value; | 4269 if (!value->IsTheHole()) return value; |
4270 // If value is the hole do the general lookup. | 4270 // If value is the hole do the general lookup. |
4271 } | 4271 } |
4272 } | 4272 } |
4273 } else if (FLAG_smi_only_arrays && args.at<Object>(1)->IsSmi()) { | 4273 } else if (args.at<Object>(1)->IsSmi()) { |
| 4274 // Getting properties from FAST_DOUBLE_ELEMENTS arrays causes boxing. To |
| 4275 // proactively avoid excessive boxing, transition FAST_DOUBLE_ELEMENTS |
| 4276 // arrays to FAST_ELEMENTS if they are accessed via this function, which |
| 4277 // is called by the KeyedLoadIC::GenericStub. |
| 4278 Handle<JSObject> js_object(args.at<JSObject>(0)); |
| 4279 if (js_object->HasFastDoubleElements()) { |
| 4280 MaybeObject* maybe_object = |
| 4281 js_object->TransitionElementsKind(FAST_ELEMENTS); |
| 4282 if (maybe_object->IsFailure()) return maybe_object; |
| 4283 } |
| 4284 |
4274 // JSObject without a string key. If the key is a Smi, check for a | 4285 // JSObject without a string key. If the key is a Smi, check for a |
4275 // definite out-of-bounds access to elements, which is a strong indicator | 4286 // definite out-of-bounds access to elements, which is a strong indicator |
4276 // that subsequent accesses will also call the runtime. Proactively | 4287 // that subsequent accesses will also call the runtime. Proactively |
4277 // transition elements to FAST_ELEMENTS to avoid excessive boxing of | 4288 // transition elements to FAST_ELEMENTS to avoid excessive boxing of |
4278 // doubles for those future calls in the case that the elements would | 4289 // doubles for those future calls in the case that the elements would |
4279 // become FAST_DOUBLE_ELEMENTS. | 4290 // become FAST_DOUBLE_ELEMENTS. |
4280 Handle<JSObject> js_object(args.at<JSObject>(0)); | |
4281 ElementsKind elements_kind = js_object->GetElementsKind(); | 4291 ElementsKind elements_kind = js_object->GetElementsKind(); |
4282 if (elements_kind == FAST_SMI_ONLY_ELEMENTS || | 4292 if (elements_kind == FAST_SMI_ONLY_ELEMENTS || |
4283 elements_kind == FAST_DOUBLE_ELEMENTS) { | 4293 elements_kind == FAST_DOUBLE_ELEMENTS) { |
4284 FixedArrayBase* elements = js_object->elements(); | 4294 FixedArrayBase* elements = js_object->elements(); |
4285 if (args.at<Smi>(1)->value() >= elements->length()) { | 4295 if (args.at<Smi>(1)->value() >= elements->length()) { |
4286 MaybeObject* maybe_object = TransitionElements(js_object, | 4296 MaybeObject* maybe_object = TransitionElements(js_object, |
4287 FAST_ELEMENTS, | 4297 FAST_ELEMENTS, |
4288 isolate); | 4298 isolate); |
4289 if (maybe_object->IsFailure()) return maybe_object; | 4299 if (maybe_object->IsFailure()) return maybe_object; |
4290 } | 4300 } |
(...skipping 9363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13654 // Handle last resort GC and make sure to allow future allocations | 13664 // Handle last resort GC and make sure to allow future allocations |
13655 // to grow the heap without causing GCs (if possible). | 13665 // to grow the heap without causing GCs (if possible). |
13656 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13666 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13657 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13667 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13658 "Runtime::PerformGC"); | 13668 "Runtime::PerformGC"); |
13659 } | 13669 } |
13660 } | 13670 } |
13661 | 13671 |
13662 | 13672 |
13663 } } // namespace v8::internal | 13673 } } // namespace v8::internal |
OLD | NEW |