OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4561 | 4561 |
4562 return Runtime::SetObjectProperty(isolate, | 4562 return Runtime::SetObjectProperty(isolate, |
4563 object, | 4563 object, |
4564 key, | 4564 key, |
4565 value, | 4565 value, |
4566 attributes, | 4566 attributes, |
4567 strict_mode); | 4567 strict_mode); |
4568 } | 4568 } |
4569 | 4569 |
4570 | 4570 |
4571 MaybeObject* TransitionElements(Handle<Object> object, | |
4572 ElementsKind to_kind, | |
4573 Isolate* isolate) { | |
4574 HandleScope scope(isolate); | |
4575 if (!object->IsJSObject()) return isolate->ThrowIllegalOperation(); | |
4576 ElementsKind from_kind = | |
4577 Handle<JSObject>::cast(object)->map()->elements_kind(); | |
4578 // Only handle valid transitions. | |
4579 if ((from_kind == FAST_SMI_ONLY_ELEMENTS && | |
4580 (to_kind == FAST_DOUBLE_ELEMENTS || to_kind == FAST_ELEMENTS)) || | |
4581 (from_kind == FAST_DOUBLE_ELEMENTS && to_kind == FAST_ELEMENTS)) { | |
danno
2011/10/18 08:57:03
Add a predicate IsValidFastElementTransition somew
Jakob Kummerow
2011/10/18 12:05:15
Done.
| |
4582 Handle<Object> result = | |
4583 TransitionElementsKind(Handle<JSObject>::cast(object), to_kind); | |
4584 if (result.is_null()) return isolate->ThrowIllegalOperation(); | |
4585 return *result; | |
4586 } | |
4587 return isolate->ThrowIllegalOperation(); | |
4588 } | |
4589 | |
4590 | |
4591 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsSmiToDouble) { | |
4592 NoHandleAllocation ha; | |
4593 RUNTIME_ASSERT(args.length() == 1); | |
4594 Handle<Object> object = args.at<Object>(0); | |
4595 return TransitionElements(object, FAST_DOUBLE_ELEMENTS, isolate); | |
4596 } | |
4597 | |
4598 | |
4599 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsDoubleToObject) { | |
4600 NoHandleAllocation ha; | |
4601 RUNTIME_ASSERT(args.length() == 1); | |
4602 Handle<Object> object = args.at<Object>(0); | |
4603 return TransitionElements(object, FAST_ELEMENTS, isolate); | |
4604 } | |
4605 | |
4606 | |
4571 // Set the native flag on the function. | 4607 // Set the native flag on the function. |
4572 // This is used to decide if we should transform null and undefined | 4608 // This is used to decide if we should transform null and undefined |
4573 // into the global object when doing call and apply. | 4609 // into the global object when doing call and apply. |
4574 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) { | 4610 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) { |
4575 NoHandleAllocation ha; | 4611 NoHandleAllocation ha; |
4576 RUNTIME_ASSERT(args.length() == 1); | 4612 RUNTIME_ASSERT(args.length() == 1); |
4577 | 4613 |
4578 Handle<Object> object = args.at<Object>(0); | 4614 Handle<Object> object = args.at<Object>(0); |
4579 | 4615 |
4580 if (object->IsJSFunction()) { | 4616 if (object->IsJSFunction()) { |
(...skipping 8707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13288 } else { | 13324 } else { |
13289 // Handle last resort GC and make sure to allow future allocations | 13325 // Handle last resort GC and make sure to allow future allocations |
13290 // to grow the heap without causing GCs (if possible). | 13326 // to grow the heap without causing GCs (if possible). |
13291 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13327 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13292 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13328 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13293 } | 13329 } |
13294 } | 13330 } |
13295 | 13331 |
13296 | 13332 |
13297 } } // namespace v8::internal | 13333 } } // namespace v8::internal |
OLD | NEW |