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 4651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4662 RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { | 4662 RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { |
4663 RUNTIME_ASSERT(args.length() == 5); | 4663 RUNTIME_ASSERT(args.length() == 5); |
4664 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); | 4664 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); |
4665 CONVERT_SMI_ARG_CHECKED(store_index, 1); | 4665 CONVERT_SMI_ARG_CHECKED(store_index, 1); |
4666 Handle<Object> value = args.at<Object>(2); | 4666 Handle<Object> value = args.at<Object>(2); |
4667 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3); | 4667 CONVERT_ARG_HANDLE_CHECKED(FixedArray, literals, 3); |
4668 CONVERT_SMI_ARG_CHECKED(literal_index, 4); | 4668 CONVERT_SMI_ARG_CHECKED(literal_index, 4); |
4669 HandleScope scope; | 4669 HandleScope scope; |
4670 | 4670 |
4671 Object* raw_boilerplate_object = literals->get(literal_index); | 4671 Object* raw_boilerplate_object = literals->get(literal_index); |
4672 Handle<JSArray> boilerplate_object(JSArray::cast(raw_boilerplate_object)); | 4672 Handle<JSArray> boilerplate(JSArray::cast(raw_boilerplate_object)); |
4673 #if DEBUG | 4673 #if DEBUG |
4674 ElementsKind elements_kind = object->GetElementsKind(); | 4674 ElementsKind elements_kind = object->GetElementsKind(); |
4675 #endif | 4675 #endif |
4676 ASSERT(elements_kind <= FAST_DOUBLE_ELEMENTS); | 4676 ASSERT(elements_kind <= FAST_DOUBLE_ELEMENTS); |
4677 // Smis should never trigger transitions. | 4677 // Smis should never trigger transitions. |
4678 ASSERT(!value->IsSmi()); | 4678 ASSERT(!value->IsSmi()); |
4679 | 4679 |
4680 if (value->IsNumber()) { | 4680 if (value->IsNumber()) { |
4681 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS); | 4681 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS); |
4682 JSObject::TransitionElementsKind(object, FAST_DOUBLE_ELEMENTS); | 4682 JSObject::TransitionElementsKind(object, FAST_DOUBLE_ELEMENTS); |
4683 JSObject::TransitionElementsKind(boilerplate_object, FAST_DOUBLE_ELEMENTS); | 4683 if (IsMoreGeneralElementsKindTransition(boilerplate->GetElementsKind(), |
4684 FAST_DOUBLE_ELEMENTS)) { | |
4685 ASSERT(elements_kind == boilerplate->GetElementsKind()); | |
danno
2012/04/03 16:38:10
This assertion isn't needed and misleading now (si
Michael Starzinger
2012/04/03 16:55:03
Done.
| |
4686 JSObject::TransitionElementsKind(boilerplate, FAST_DOUBLE_ELEMENTS); | |
4687 } | |
4684 ASSERT(object->GetElementsKind() == FAST_DOUBLE_ELEMENTS); | 4688 ASSERT(object->GetElementsKind() == FAST_DOUBLE_ELEMENTS); |
4685 FixedDoubleArray* double_array = | 4689 FixedDoubleArray* double_array = FixedDoubleArray::cast(object->elements()); |
4686 FixedDoubleArray::cast(object->elements()); | |
4687 HeapNumber* number = HeapNumber::cast(*value); | 4690 HeapNumber* number = HeapNumber::cast(*value); |
4688 double_array->set(store_index, number->Number()); | 4691 double_array->set(store_index, number->Number()); |
4689 } else { | 4692 } else { |
4690 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS || | 4693 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS || |
4691 elements_kind == FAST_DOUBLE_ELEMENTS); | 4694 elements_kind == FAST_DOUBLE_ELEMENTS); |
4692 JSObject::TransitionElementsKind(object, FAST_ELEMENTS); | 4695 JSObject::TransitionElementsKind(object, FAST_ELEMENTS); |
4693 JSObject::TransitionElementsKind(boilerplate_object, FAST_ELEMENTS); | 4696 if (IsMoreGeneralElementsKindTransition(boilerplate->GetElementsKind(), |
4694 FixedArray* object_array = | 4697 FAST_ELEMENTS)) { |
4695 FixedArray::cast(object->elements()); | 4698 ASSERT(elements_kind == boilerplate->GetElementsKind()); |
danno
2012/04/03 16:38:10
This will assert when elements_kind is FAST_SMI_ON
Michael Starzinger
2012/04/03 16:55:03
Done.
| |
4699 JSObject::TransitionElementsKind(boilerplate, FAST_ELEMENTS); | |
4700 } | |
4701 FixedArray* object_array = FixedArray::cast(object->elements()); | |
4696 object_array->set(store_index, *value); | 4702 object_array->set(store_index, *value); |
4697 } | 4703 } |
4698 return *object; | 4704 return *object; |
4699 } | 4705 } |
4700 | 4706 |
4701 | 4707 |
4702 // Set a local property, even if it is READ_ONLY. If the property does not | 4708 // Set a local property, even if it is READ_ONLY. If the property does not |
4703 // exist, it will be added with attributes NONE. | 4709 // exist, it will be added with attributes NONE. |
4704 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { | 4710 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { |
4705 NoHandleAllocation ha; | 4711 NoHandleAllocation ha; |
(...skipping 8636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13342 // Handle last resort GC and make sure to allow future allocations | 13348 // Handle last resort GC and make sure to allow future allocations |
13343 // to grow the heap without causing GCs (if possible). | 13349 // to grow the heap without causing GCs (if possible). |
13344 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13350 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13345 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13351 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13346 "Runtime::PerformGC"); | 13352 "Runtime::PerformGC"); |
13347 } | 13353 } |
13348 } | 13354 } |
13349 | 13355 |
13350 | 13356 |
13351 } } // namespace v8::internal | 13357 } } // namespace v8::internal |
OLD | NEW |