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 14 matching lines...) Expand all Loading... |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 | 29 |
30 #include "v8.h" | 30 #include "v8.h" |
31 | 31 |
32 #include "accessors.h" | 32 #include "accessors.h" |
33 #include "api.h" | 33 #include "api.h" |
34 #include "arguments.h" | 34 #include "arguments.h" |
| 35 #include "bootstrapper.h" |
35 #include "codegen.h" | 36 #include "codegen.h" |
36 #include "compilation-cache.h" | 37 #include "compilation-cache.h" |
37 #include "compiler.h" | 38 #include "compiler.h" |
38 #include "cpu.h" | 39 #include "cpu.h" |
39 #include "dateparser-inl.h" | 40 #include "dateparser-inl.h" |
40 #include "debug.h" | 41 #include "debug.h" |
41 #include "deoptimizer.h" | 42 #include "deoptimizer.h" |
42 #include "execution.h" | 43 #include "execution.h" |
43 #include "global-handles.h" | 44 #include "global-handles.h" |
44 #include "jsregexp.h" | 45 #include "jsregexp.h" |
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2140 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsBuiltin) { | 2141 RUNTIME_FUNCTION(MaybeObject*, Runtime_FunctionIsBuiltin) { |
2141 NoHandleAllocation ha; | 2142 NoHandleAllocation ha; |
2142 ASSERT(args.length() == 1); | 2143 ASSERT(args.length() == 1); |
2143 | 2144 |
2144 CONVERT_CHECKED(JSFunction, f, args[0]); | 2145 CONVERT_CHECKED(JSFunction, f, args[0]); |
2145 return isolate->heap()->ToBoolean(f->IsBuiltin()); | 2146 return isolate->heap()->ToBoolean(f->IsBuiltin()); |
2146 } | 2147 } |
2147 | 2148 |
2148 | 2149 |
2149 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) { | 2150 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetCode) { |
| 2151 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); |
2150 HandleScope scope(isolate); | 2152 HandleScope scope(isolate); |
2151 ASSERT(args.length() == 2); | 2153 ASSERT(args.length() == 2); |
2152 | 2154 |
2153 CONVERT_ARG_CHECKED(JSFunction, target, 0); | 2155 CONVERT_ARG_CHECKED(JSFunction, target, 0); |
2154 Handle<Object> code = args.at<Object>(1); | 2156 Handle<Object> code = args.at<Object>(1); |
2155 | 2157 |
2156 Handle<Context> context(target->context()); | 2158 Handle<Context> context(target->context()); |
2157 | 2159 |
2158 if (!code->IsNull()) { | 2160 if (!code->IsNull()) { |
2159 RUNTIME_ASSERT(code->IsJSFunction()); | 2161 RUNTIME_ASSERT(code->IsJSFunction()); |
(...skipping 6083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8243 return Smi::FromInt(ast_id); | 8245 return Smi::FromInt(ast_id); |
8244 } else { | 8246 } else { |
8245 if (function->IsMarkedForLazyRecompilation()) { | 8247 if (function->IsMarkedForLazyRecompilation()) { |
8246 function->ReplaceCode(function->shared()->code()); | 8248 function->ReplaceCode(function->shared()->code()); |
8247 } | 8249 } |
8248 return Smi::FromInt(-1); | 8250 return Smi::FromInt(-1); |
8249 } | 8251 } |
8250 } | 8252 } |
8251 | 8253 |
8252 | 8254 |
| 8255 RUNTIME_FUNCTION(MaybeObject*, Runtime_AssertIsBootstrapping) { |
| 8256 RUNTIME_ASSERT(isolate->bootstrapper()->IsActive()); |
| 8257 return isolate->heap()->undefined_value(); |
| 8258 } |
| 8259 |
| 8260 |
8253 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionDelegate) { | 8261 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFunctionDelegate) { |
8254 HandleScope scope(isolate); | 8262 HandleScope scope(isolate); |
8255 ASSERT(args.length() == 1); | 8263 ASSERT(args.length() == 1); |
8256 RUNTIME_ASSERT(!args[0]->IsJSFunction()); | 8264 RUNTIME_ASSERT(!args[0]->IsJSFunction()); |
8257 return *Execution::GetFunctionDelegate(args.at<Object>(0)); | 8265 return *Execution::GetFunctionDelegate(args.at<Object>(0)); |
8258 } | 8266 } |
8259 | 8267 |
8260 | 8268 |
8261 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructorDelegate) { | 8269 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetConstructorDelegate) { |
8262 HandleScope scope(isolate); | 8270 HandleScope scope(isolate); |
(...skipping 4724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12987 } else { | 12995 } else { |
12988 // Handle last resort GC and make sure to allow future allocations | 12996 // Handle last resort GC and make sure to allow future allocations |
12989 // to grow the heap without causing GCs (if possible). | 12997 // to grow the heap without causing GCs (if possible). |
12990 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12998 isolate->counters()->gc_last_resort_from_js()->Increment(); |
12991 isolate->heap()->CollectAllGarbage(false); | 12999 isolate->heap()->CollectAllGarbage(false); |
12992 } | 13000 } |
12993 } | 13001 } |
12994 | 13002 |
12995 | 13003 |
12996 } } // namespace v8::internal | 13004 } } // namespace v8::internal |
OLD | NEW |