OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 4875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4886 } | 4886 } |
4887 } | 4887 } |
4888 | 4888 |
4889 Handle<FixedArray> call = Factory::NewFixedArray(2); | 4889 Handle<FixedArray> call = Factory::NewFixedArray(2); |
4890 call->set(0, *callee); | 4890 call->set(0, *callee); |
4891 call->set(1, *receiver); | 4891 call->set(1, *receiver); |
4892 return *call; | 4892 return *call; |
4893 } | 4893 } |
4894 | 4894 |
4895 | 4895 |
4896 static Object* Runtime_CompileScript(Arguments args) { | |
4897 HandleScope scope; | |
4898 ASSERT(args.length() == 4); | |
4899 | |
4900 CONVERT_ARG_CHECKED(String, source, 0); | |
4901 CONVERT_ARG_CHECKED(String, script, 1); | |
4902 CONVERT_CHECKED(Smi, line_attrs, args[2]); | |
4903 int line = line_attrs->value(); | |
4904 CONVERT_CHECKED(Smi, col_attrs, args[3]); | |
4905 int col = col_attrs->value(); | |
4906 Handle<JSFunction> boilerplate = | |
4907 Compiler::Compile(source, script, line, col, NULL, NULL); | |
4908 if (boilerplate.is_null()) return Failure::Exception(); | |
4909 Handle<JSFunction> fun = | |
4910 Factory::NewFunctionFromBoilerplate(boilerplate, | |
4911 Handle<Context>(Top::context())); | |
4912 return *fun; | |
4913 } | |
4914 | |
4915 | |
4916 static Object* Runtime_SetNewFunctionAttributes(Arguments args) { | 4896 static Object* Runtime_SetNewFunctionAttributes(Arguments args) { |
4917 // This utility adjusts the property attributes for newly created Function | 4897 // This utility adjusts the property attributes for newly created Function |
4918 // object ("new Function(...)") by changing the map. | 4898 // object ("new Function(...)") by changing the map. |
4919 // All it does is changing the prototype property to enumerable | 4899 // All it does is changing the prototype property to enumerable |
4920 // as specified in ECMA262, 15.3.5.2. | 4900 // as specified in ECMA262, 15.3.5.2. |
4921 HandleScope scope; | 4901 HandleScope scope; |
4922 ASSERT(args.length() == 1); | 4902 ASSERT(args.length() == 1); |
4923 CONVERT_ARG_CHECKED(JSFunction, func, 0); | 4903 CONVERT_ARG_CHECKED(JSFunction, func, 0); |
4924 ASSERT(func->map()->instance_type() == | 4904 ASSERT(func->map()->instance_type() == |
4925 Top::function_instance_map()->instance_type()); | 4905 Top::function_instance_map()->instance_type()); |
(...skipping 2027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6953 } else { | 6933 } else { |
6954 // Handle last resort GC and make sure to allow future allocations | 6934 // Handle last resort GC and make sure to allow future allocations |
6955 // to grow the heap without causing GCs (if possible). | 6935 // to grow the heap without causing GCs (if possible). |
6956 Counters::gc_last_resort_from_js.Increment(); | 6936 Counters::gc_last_resort_from_js.Increment(); |
6957 Heap::CollectAllGarbage(); | 6937 Heap::CollectAllGarbage(); |
6958 } | 6938 } |
6959 } | 6939 } |
6960 | 6940 |
6961 | 6941 |
6962 } } // namespace v8::internal | 6942 } } // namespace v8::internal |
OLD | NEW |