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 5212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5223 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsKind) { | 5223 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsKind) { |
5224 HandleScope scope(isolate); | 5224 HandleScope scope(isolate); |
5225 RUNTIME_ASSERT(args.length() == 2); | 5225 RUNTIME_ASSERT(args.length() == 2); |
5226 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); | 5226 CONVERT_ARG_HANDLE_CHECKED(JSArray, array, 0); |
5227 CONVERT_ARG_HANDLE_CHECKED(Map, map, 1); | 5227 CONVERT_ARG_HANDLE_CHECKED(Map, map, 1); |
5228 JSObject::TransitionElementsKind(array, map->elements_kind()); | 5228 JSObject::TransitionElementsKind(array, map->elements_kind()); |
5229 return *array; | 5229 return *array; |
5230 } | 5230 } |
5231 | 5231 |
5232 | 5232 |
| 5233 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsSmiToDouble) { |
| 5234 SealHandleScope shs(isolate); |
| 5235 RUNTIME_ASSERT(args.length() == 1); |
| 5236 Handle<Object> object = args.at<Object>(0); |
| 5237 if (object->IsJSObject()) { |
| 5238 Handle<JSObject> js_object(Handle<JSObject>::cast(object)); |
| 5239 ASSERT(!js_object->map()->is_observed()); |
| 5240 ElementsKind new_kind = js_object->HasFastHoleyElements() |
| 5241 ? FAST_HOLEY_DOUBLE_ELEMENTS |
| 5242 : FAST_DOUBLE_ELEMENTS; |
| 5243 return TransitionElements(object, new_kind, isolate); |
| 5244 } else { |
| 5245 return *object; |
| 5246 } |
| 5247 } |
| 5248 |
| 5249 |
| 5250 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsDoubleToObject) { |
| 5251 SealHandleScope shs(isolate); |
| 5252 RUNTIME_ASSERT(args.length() == 1); |
| 5253 Handle<Object> object = args.at<Object>(0); |
| 5254 if (object->IsJSObject()) { |
| 5255 Handle<JSObject> js_object(Handle<JSObject>::cast(object)); |
| 5256 ASSERT(!js_object->map()->is_observed()); |
| 5257 ElementsKind new_kind = js_object->HasFastHoleyElements() |
| 5258 ? FAST_HOLEY_ELEMENTS |
| 5259 : FAST_ELEMENTS; |
| 5260 return TransitionElements(object, new_kind, isolate); |
| 5261 } else { |
| 5262 return *object; |
| 5263 } |
| 5264 } |
| 5265 |
| 5266 |
5233 // Set the native flag on the function. | 5267 // Set the native flag on the function. |
5234 // This is used to decide if we should transform null and undefined | 5268 // This is used to decide if we should transform null and undefined |
5235 // into the global object when doing call and apply. | 5269 // into the global object when doing call and apply. |
5236 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) { | 5270 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) { |
5237 SealHandleScope shs(isolate); | 5271 SealHandleScope shs(isolate); |
5238 RUNTIME_ASSERT(args.length() == 1); | 5272 RUNTIME_ASSERT(args.length() == 1); |
5239 | 5273 |
5240 Handle<Object> object = args.at<Object>(0); | 5274 Handle<Object> object = args.at<Object>(0); |
5241 | 5275 |
5242 if (object->IsJSFunction()) { | 5276 if (object->IsJSFunction()) { |
(...skipping 7637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12880 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) { | 12914 RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugSetScriptSource) { |
12881 HandleScope scope(isolate); | 12915 HandleScope scope(isolate); |
12882 ASSERT(args.length() == 2); | 12916 ASSERT(args.length() == 2); |
12883 | 12917 |
12884 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); | 12918 CONVERT_ARG_HANDLE_CHECKED(JSValue, script_wrapper, 0); |
12885 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); | 12919 CONVERT_ARG_HANDLE_CHECKED(String, source, 1); |
12886 | 12920 |
12887 RUNTIME_ASSERT(script_wrapper->value()->IsScript()); | 12921 RUNTIME_ASSERT(script_wrapper->value()->IsScript()); |
12888 Handle<Script> script(Script::cast(script_wrapper->value())); | 12922 Handle<Script> script(Script::cast(script_wrapper->value())); |
12889 | 12923 |
12890 int compilation_state = script->compilation_state(); | 12924 int compilation_state = Smi::cast(script->compilation_state())->value(); |
12891 RUNTIME_ASSERT(compilation_state == Script::COMPILATION_STATE_INITIAL); | 12925 RUNTIME_ASSERT(compilation_state == Script::COMPILATION_STATE_INITIAL); |
12892 script->set_source(*source); | 12926 script->set_source(*source); |
12893 | 12927 |
12894 return isolate->heap()->undefined_value(); | 12928 return isolate->heap()->undefined_value(); |
12895 } | 12929 } |
12896 | 12930 |
12897 | 12931 |
12898 RUNTIME_FUNCTION(MaybeObject*, Runtime_SystemBreak) { | 12932 RUNTIME_FUNCTION(MaybeObject*, Runtime_SystemBreak) { |
12899 SealHandleScope shs(isolate); | 12933 SealHandleScope shs(isolate); |
12900 ASSERT(args.length() == 0); | 12934 ASSERT(args.length() == 0); |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13907 // Handle last resort GC and make sure to allow future allocations | 13941 // Handle last resort GC and make sure to allow future allocations |
13908 // to grow the heap without causing GCs (if possible). | 13942 // to grow the heap without causing GCs (if possible). |
13909 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13943 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13910 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13944 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13911 "Runtime::PerformGC"); | 13945 "Runtime::PerformGC"); |
13912 } | 13946 } |
13913 } | 13947 } |
13914 | 13948 |
13915 | 13949 |
13916 } } // namespace v8::internal | 13950 } } // namespace v8::internal |
OLD | NEW |