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 4168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4179 int entry = dictionary->FindEntry(key); | 4179 int entry = dictionary->FindEntry(key); |
4180 if ((entry != StringDictionary::kNotFound) && | 4180 if ((entry != StringDictionary::kNotFound) && |
4181 (dictionary->DetailsAt(entry).type() == NORMAL)) { | 4181 (dictionary->DetailsAt(entry).type() == NORMAL)) { |
4182 Object* value = dictionary->ValueAt(entry); | 4182 Object* value = dictionary->ValueAt(entry); |
4183 if (!receiver->IsGlobalObject()) return value; | 4183 if (!receiver->IsGlobalObject()) return value; |
4184 value = JSGlobalPropertyCell::cast(value)->value(); | 4184 value = JSGlobalPropertyCell::cast(value)->value(); |
4185 if (!value->IsTheHole()) return value; | 4185 if (!value->IsTheHole()) return value; |
4186 // If value is the hole do the general lookup. | 4186 // If value is the hole do the general lookup. |
4187 } | 4187 } |
4188 } | 4188 } |
4189 } else if (FLAG_smi_only_arrays && args.at<Object>(1)->IsSmi()) { | 4189 } else if (args.at<Object>(1)->IsSmi()) { |
4190 // Getting properties from FAST_DOUBLE_ELEMENTS arrays causes boxing. To | |
4191 // proactively avoid excessive boxing, proactively transition | |
Jakob Kummerow
2012/02/08 14:56:29
nit: one "proactively" per line is enough.
| |
4192 // FAST_DOUBLE_ELEMENTS arrays to FAST_ELEMENTS if they are accessed via | |
4193 // this function, which is called by the KeyedLoadIC::GenericStub. | |
4194 Handle<JSObject> js_object(args.at<JSObject>(0)); | |
4195 if (js_object->HasFastDoubleElements()) { | |
4196 MaybeObject* maybe_object = | |
4197 js_object->TransitionElementsKind(FAST_ELEMENTS); | |
4198 if (maybe_object->IsFailure()) return maybe_object; | |
4199 } | |
4200 | |
4190 // JSObject without a string key. If the key is a Smi, check for a | 4201 // JSObject without a string key. If the key is a Smi, check for a |
4191 // definite out-of-bounds access to elements, which is a strong indicator | 4202 // definite out-of-bounds access to elements, which is a strong indicator |
4192 // that subsequent accesses will also call the runtime. Proactively | 4203 // that subsequent accesses will also call the runtime. Proactively |
4193 // transition elements to FAST_ELEMENTS to avoid excessive boxing of | 4204 // transition elements to FAST_ELEMENTS to avoid excessive boxing of |
4194 // doubles for those future calls in the case that the elements would | 4205 // doubles for those future calls in the case that the elements would |
4195 // become FAST_DOUBLE_ELEMENTS. | 4206 // become FAST_DOUBLE_ELEMENTS. |
4196 Handle<JSObject> js_object(args.at<JSObject>(0)); | |
4197 ElementsKind elements_kind = js_object->GetElementsKind(); | 4207 ElementsKind elements_kind = js_object->GetElementsKind(); |
4198 if (elements_kind == FAST_SMI_ONLY_ELEMENTS || | 4208 if (elements_kind == FAST_SMI_ONLY_ELEMENTS || |
4199 elements_kind == FAST_DOUBLE_ELEMENTS) { | 4209 elements_kind == FAST_DOUBLE_ELEMENTS) { |
4200 FixedArrayBase* elements = js_object->elements(); | 4210 FixedArrayBase* elements = js_object->elements(); |
4201 if (args.at<Smi>(1)->value() >= elements->length()) { | 4211 if (args.at<Smi>(1)->value() >= elements->length()) { |
4202 MaybeObject* maybe_object = TransitionElements(js_object, | 4212 MaybeObject* maybe_object = TransitionElements(js_object, |
4203 FAST_ELEMENTS, | 4213 FAST_ELEMENTS, |
4204 isolate); | 4214 isolate); |
4205 if (maybe_object->IsFailure()) return maybe_object; | 4215 if (maybe_object->IsFailure()) return maybe_object; |
4206 } | 4216 } |
(...skipping 9335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13542 } else { | 13552 } else { |
13543 // Handle last resort GC and make sure to allow future allocations | 13553 // Handle last resort GC and make sure to allow future allocations |
13544 // to grow the heap without causing GCs (if possible). | 13554 // to grow the heap without causing GCs (if possible). |
13545 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13555 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13546 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13556 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13547 } | 13557 } |
13548 } | 13558 } |
13549 | 13559 |
13550 | 13560 |
13551 } } // namespace v8::internal | 13561 } } // namespace v8::internal |
OLD | NEW |