| 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 3098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3109 ASSERT(args.length() == 3); | 3109 ASSERT(args.length() == 3); |
| 3110 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); | 3110 CONVERT_ARG_CHECKED(JSGeneratorObject, generator_object, 0); |
| 3111 CONVERT_ARG_CHECKED(Object, value, 1); | 3111 CONVERT_ARG_CHECKED(Object, value, 1); |
| 3112 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); | 3112 CONVERT_SMI_ARG_CHECKED(resume_mode_int, 2); |
| 3113 JavaScriptFrameIterator stack_iterator(isolate); | 3113 JavaScriptFrameIterator stack_iterator(isolate); |
| 3114 JavaScriptFrame* frame = stack_iterator.frame(); | 3114 JavaScriptFrame* frame = stack_iterator.frame(); |
| 3115 | 3115 |
| 3116 ASSERT_EQ(frame->function(), generator_object->function()); | 3116 ASSERT_EQ(frame->function(), generator_object->function()); |
| 3117 ASSERT(frame->function()->is_compiled()); | 3117 ASSERT(frame->function()->is_compiled()); |
| 3118 | 3118 |
| 3119 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting <= 0); | 3119 STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting < 0); |
| 3120 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed <= 0); | 3120 STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed == 0); |
| 3121 | 3121 |
| 3122 Address pc = generator_object->function()->code()->instruction_start(); | 3122 Address pc = generator_object->function()->code()->instruction_start(); |
| 3123 int offset = generator_object->continuation(); | 3123 int offset = generator_object->continuation(); |
| 3124 ASSERT(offset > 0); | 3124 ASSERT(offset > 0); |
| 3125 frame->set_pc(pc + offset); | 3125 frame->set_pc(pc + offset); |
| 3126 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); | 3126 generator_object->set_continuation(JSGeneratorObject::kGeneratorExecuting); |
| 3127 | 3127 |
| 3128 FixedArray* operand_stack = generator_object->operand_stack(); | 3128 FixedArray* operand_stack = generator_object->operand_stack(); |
| 3129 int operands_count = operand_stack->length(); | 3129 int operands_count = operand_stack->length(); |
| 3130 if (operands_count != 0) { | 3130 if (operands_count != 0) { |
| (...skipping 11190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14321 | 14321 |
| 14322 | 14322 |
| 14323 RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyContextDisposed) { | 14323 RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyContextDisposed) { |
| 14324 HandleScope scope(isolate); | 14324 HandleScope scope(isolate); |
| 14325 ASSERT(args.length() == 0); | 14325 ASSERT(args.length() == 0); |
| 14326 isolate->heap()->NotifyContextDisposed(); | 14326 isolate->heap()->NotifyContextDisposed(); |
| 14327 return isolate->heap()->undefined_value(); | 14327 return isolate->heap()->undefined_value(); |
| 14328 } | 14328 } |
| 14329 | 14329 |
| 14330 | 14330 |
| 14331 RUNTIME_FUNCTION(MaybeObject*, Runtime_MigrateInstance) { | 14331 RUNTIME_FUNCTION(MaybeObject*, Runtime_TryMigrateInstance) { |
| 14332 HandleScope scope(isolate); | 14332 HandleScope scope(isolate); |
| 14333 ASSERT(args.length() == 1); | 14333 ASSERT(args.length() == 1); |
| 14334 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 14334 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
| 14335 if (!object->IsJSObject()) return Smi::FromInt(0); | 14335 if (!object->IsJSObject()) return Smi::FromInt(0); |
| 14336 Handle<JSObject> js_object = Handle<JSObject>::cast(object); | 14336 Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
| 14337 if (!js_object->map()->is_deprecated()) return Smi::FromInt(0); | 14337 if (!js_object->map()->is_deprecated()) return Smi::FromInt(0); |
| 14338 JSObject::MigrateInstance(js_object); | 14338 // This call must not cause lazy deopts, because it's called from deferred |
| 14339 // code where we can't handle lazy deopts for lack of a suitable bailout |
| 14340 // ID. So we just try migration and signal failure if necessary, |
| 14341 // which will also trigger a deopt. |
| 14342 Handle<Object> result = JSObject::TryMigrateInstance(js_object); |
| 14343 if (result.is_null()) return Smi::FromInt(0); |
| 14339 return *object; | 14344 return *object; |
| 14340 } | 14345 } |
| 14341 | 14346 |
| 14342 | 14347 |
| 14343 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) { | 14348 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) { |
| 14344 SealHandleScope shs(isolate); | 14349 SealHandleScope shs(isolate); |
| 14345 // This is only called from codegen, so checks might be more lax. | 14350 // This is only called from codegen, so checks might be more lax. |
| 14346 CONVERT_ARG_CHECKED(JSFunctionResultCache, cache, 0); | 14351 CONVERT_ARG_CHECKED(JSFunctionResultCache, cache, 0); |
| 14347 Object* key = args[1]; | 14352 Object* key = args[1]; |
| 14348 | 14353 |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14883 // Handle last resort GC and make sure to allow future allocations | 14888 // Handle last resort GC and make sure to allow future allocations |
| 14884 // to grow the heap without causing GCs (if possible). | 14889 // to grow the heap without causing GCs (if possible). |
| 14885 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14890 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14886 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14891 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14887 "Runtime::PerformGC"); | 14892 "Runtime::PerformGC"); |
| 14888 } | 14893 } |
| 14889 } | 14894 } |
| 14890 | 14895 |
| 14891 | 14896 |
| 14892 } } // namespace v8::internal | 14897 } } // namespace v8::internal |
| OLD | NEW |