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 5213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5224 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsKind) { | 5224 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsKind) { |
5225 HandleScope scope(isolate); | 5225 HandleScope scope(isolate); |
5226 RUNTIME_ASSERT(args.length() == 2); | 5226 RUNTIME_ASSERT(args.length() == 2); |
5227 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); | 5227 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
5228 CONVERT_ARG_HANDLE_CHECKED(Map, map, 1); | 5228 CONVERT_ARG_HANDLE_CHECKED(Map, map, 1); |
5229 JSObject::TransitionElementsKind(array, map->elements_kind()); | 5229 JSObject::TransitionElementsKind(array, map->elements_kind()); |
5230 return *array; | 5230 return *array; |
5231 } | 5231 } |
5232 | 5232 |
5233 | 5233 |
5234 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsSmiToDouble) { | |
5235 SealHandleScope shs(isolate); | |
5236 RUNTIME_ASSERT(args.length() == 1); | |
5237 Handle<Object> object = args.at<Object>(0); | |
5238 if (object->IsJSObject()) { | |
5239 Handle<JSObject> js_object(Handle<JSObject>::cast(object)); | |
5240 ASSERT(!js_object->map()->is_observed()); | |
5241 ElementsKind new_kind = js_object->HasFastHoleyElements() | |
5242 ? FAST_HOLEY_DOUBLE_ELEMENTS | |
5243 : FAST_DOUBLE_ELEMENTS; | |
5244 return TransitionElements(object, new_kind, isolate); | |
5245 } else { | |
5246 return *object; | |
5247 } | |
5248 } | |
5249 | |
5250 | |
5251 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsDoubleToObject) { | |
5252 SealHandleScope shs(isolate); | |
5253 RUNTIME_ASSERT(args.length() == 1); | |
5254 Handle<Object> object = args.at<Object>(0); | |
5255 if (object->IsJSObject()) { | |
5256 Handle<JSObject> js_object(Handle<JSObject>::cast(object)); | |
5257 ASSERT(!js_object->map()->is_observed()); | |
5258 ElementsKind new_kind = js_object->HasFastHoleyElements() | |
5259 ? FAST_HOLEY_ELEMENTS | |
5260 : FAST_ELEMENTS; | |
5261 return TransitionElements(object, new_kind, isolate); | |
5262 } else { | |
5263 return *object; | |
5264 } | |
5265 } | |
5266 | |
5267 | |
5268 // Set the native flag on the function. | 5234 // Set the native flag on the function. |
5269 // This is used to decide if we should transform null and undefined | 5235 // This is used to decide if we should transform null and undefined |
5270 // into the global object when doing call and apply. | 5236 // into the global object when doing call and apply. |
5271 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) { | 5237 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) { |
5272 SealHandleScope shs(isolate); | 5238 SealHandleScope shs(isolate); |
5273 RUNTIME_ASSERT(args.length() == 1); | 5239 RUNTIME_ASSERT(args.length() == 1); |
5274 | 5240 |
5275 Handle<Object> object = args.at<Object>(0); | 5241 Handle<Object> object = args.at<Object>(0); |
5276 | 5242 |
5277 if (object->IsJSFunction()) { | 5243 if (object->IsJSFunction()) { |
(...skipping 8663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13941 // Handle last resort GC and make sure to allow future allocations | 13907 // Handle last resort GC and make sure to allow future allocations |
13942 // to grow the heap without causing GCs (if possible). | 13908 // to grow the heap without causing GCs (if possible). |
13943 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13909 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13944 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13910 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13945 "Runtime::PerformGC"); | 13911 "Runtime::PerformGC"); |
13946 } | 13912 } |
13947 } | 13913 } |
13948 | 13914 |
13949 | 13915 |
13950 } } // namespace v8::internal | 13916 } } // namespace v8::internal |
OLD | NEW |