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 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1848 NoHandleAllocation ha; | 1848 NoHandleAllocation ha; |
1849 ASSERT(args.length() == 2); | 1849 ASSERT(args.length() == 2); |
1850 | 1850 |
1851 CONVERT_CHECKED(JSFunction, f, args[0]); | 1851 CONVERT_CHECKED(JSFunction, f, args[0]); |
1852 CONVERT_CHECKED(String, name, args[1]); | 1852 CONVERT_CHECKED(String, name, args[1]); |
1853 f->shared()->set_name(name); | 1853 f->shared()->set_name(name); |
1854 return isolate->heap()->undefined_value(); | 1854 return isolate->heap()->undefined_value(); |
1855 } | 1855 } |
1856 | 1856 |
1857 | 1857 |
| 1858 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionSetBound) { |
| 1859 HandleScope scope(isolate); |
| 1860 ASSERT(args.length() == 1); |
| 1861 |
| 1862 CONVERT_CHECKED(JSFunction, fun, args[0]); |
| 1863 fun->shared()->set_bound(true); |
| 1864 return isolate->heap()->undefined_value(); |
| 1865 } |
| 1866 |
1858 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionRemovePrototype) { | 1867 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionRemovePrototype) { |
1859 NoHandleAllocation ha; | 1868 NoHandleAllocation ha; |
1860 ASSERT(args.length() == 1); | 1869 ASSERT(args.length() == 1); |
1861 | 1870 |
1862 CONVERT_CHECKED(JSFunction, f, args[0]); | 1871 CONVERT_CHECKED(JSFunction, f, args[0]); |
1863 Object* obj = f->RemovePrototype(); | 1872 Object* obj = f->RemovePrototype(); |
1864 if (obj->IsFailure()) return obj; | 1873 if (obj->IsFailure()) return obj; |
1865 | 1874 |
1866 return isolate->heap()->undefined_value(); | 1875 return isolate->heap()->undefined_value(); |
1867 } | 1876 } |
(...skipping 5624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7492 Vector< Handle<Object> > arguments = HandleVector(&constructor, 1); | 7501 Vector< Handle<Object> > arguments = HandleVector(&constructor, 1); |
7493 Handle<Object> type_error = | 7502 Handle<Object> type_error = |
7494 isolate->factory()->NewTypeError("not_constructor", arguments); | 7503 isolate->factory()->NewTypeError("not_constructor", arguments); |
7495 return isolate->Throw(*type_error); | 7504 return isolate->Throw(*type_error); |
7496 } | 7505 } |
7497 | 7506 |
7498 Handle<JSFunction> function = Handle<JSFunction>::cast(constructor); | 7507 Handle<JSFunction> function = Handle<JSFunction>::cast(constructor); |
7499 | 7508 |
7500 // If function should not have prototype, construction is not allowed. In this | 7509 // If function should not have prototype, construction is not allowed. In this |
7501 // case generated code bailouts here, since function has no initial_map. | 7510 // case generated code bailouts here, since function has no initial_map. |
7502 if (!function->should_have_prototype()) { | 7511 if (!function->should_have_prototype() && !function->shared()->bound()) { |
7503 Vector< Handle<Object> > arguments = HandleVector(&constructor, 1); | 7512 Vector< Handle<Object> > arguments = HandleVector(&constructor, 1); |
7504 Handle<Object> type_error = | 7513 Handle<Object> type_error = |
7505 isolate->factory()->NewTypeError("not_constructor", arguments); | 7514 isolate->factory()->NewTypeError("not_constructor", arguments); |
7506 return isolate->Throw(*type_error); | 7515 return isolate->Throw(*type_error); |
7507 } | 7516 } |
7508 | 7517 |
7509 #ifdef ENABLE_DEBUGGER_SUPPORT | 7518 #ifdef ENABLE_DEBUGGER_SUPPORT |
7510 Debug* debug = isolate->debug(); | 7519 Debug* debug = isolate->debug(); |
7511 // Handle stepping into constructors if step into is active. | 7520 // Handle stepping into constructors if step into is active. |
7512 if (debug->StepInActive()) { | 7521 if (debug->StepInActive()) { |
(...skipping 4862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12375 } else { | 12384 } else { |
12376 // Handle last resort GC and make sure to allow future allocations | 12385 // Handle last resort GC and make sure to allow future allocations |
12377 // to grow the heap without causing GCs (if possible). | 12386 // to grow the heap without causing GCs (if possible). |
12378 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12387 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12379 isolate->heap()->CollectAllGarbage(false); | 12388 isolate->heap()->CollectAllGarbage(false); |
12380 } | 12389 } |
12381 } | 12390 } |
12382 | 12391 |
12383 | 12392 |
12384 } } // namespace v8::internal | 12393 } } // namespace v8::internal |
OLD | NEW |