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 8216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8227 bound_function = Execution::TryGetConstructorDelegate(isolate, | 8227 bound_function = Execution::TryGetConstructorDelegate(isolate, |
8228 bound_function, | 8228 bound_function, |
8229 &exception_thrown); | 8229 &exception_thrown); |
8230 if (exception_thrown) return Failure::Exception(); | 8230 if (exception_thrown) return Failure::Exception(); |
8231 } | 8231 } |
8232 ASSERT(bound_function->IsJSFunction()); | 8232 ASSERT(bound_function->IsJSFunction()); |
8233 | 8233 |
8234 bool exception = false; | 8234 bool exception = false; |
8235 Handle<Object> result = | 8235 Handle<Object> result = |
8236 Execution::New(Handle<JSFunction>::cast(bound_function), | 8236 Execution::New(Handle<JSFunction>::cast(bound_function), |
8237 total_argc, *param_data, &exception); | 8237 total_argc, param_data.get(), &exception); |
8238 if (exception) { | 8238 if (exception) { |
8239 return Failure::Exception(); | 8239 return Failure::Exception(); |
8240 } | 8240 } |
8241 ASSERT(!result.is_null()); | 8241 ASSERT(!result.is_null()); |
8242 return *result; | 8242 return *result; |
8243 } | 8243 } |
8244 | 8244 |
8245 | 8245 |
8246 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) { | 8246 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewObject) { |
8247 HandleScope scope(isolate); | 8247 HandleScope scope(isolate); |
(...skipping 5305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13553 } | 13553 } |
13554 } | 13554 } |
13555 | 13555 |
13556 | 13556 |
13557 // Sets a v8 flag. | 13557 // Sets a v8 flag. |
13558 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFlags) { | 13558 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetFlags) { |
13559 SealHandleScope shs(isolate); | 13559 SealHandleScope shs(isolate); |
13560 CONVERT_ARG_CHECKED(String, arg, 0); | 13560 CONVERT_ARG_CHECKED(String, arg, 0); |
13561 SmartArrayPointer<char> flags = | 13561 SmartArrayPointer<char> flags = |
13562 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); | 13562 arg->ToCString(DISALLOW_NULLS, ROBUST_STRING_TRAVERSAL); |
13563 FlagList::SetFlagsFromString(*flags, StrLength(*flags)); | 13563 FlagList::SetFlagsFromString(flags.get(), StrLength(flags.get())); |
13564 return isolate->heap()->undefined_value(); | 13564 return isolate->heap()->undefined_value(); |
13565 } | 13565 } |
13566 | 13566 |
13567 | 13567 |
13568 // Performs a GC. | 13568 // Performs a GC. |
13569 // Presently, it only does a full GC. | 13569 // Presently, it only does a full GC. |
13570 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectGarbage) { | 13570 RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectGarbage) { |
13571 SealHandleScope shs(isolate); | 13571 SealHandleScope shs(isolate); |
13572 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "%CollectGarbage"); | 13572 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "%CollectGarbage"); |
13573 return isolate->heap()->undefined_value(); | 13573 return isolate->heap()->undefined_value(); |
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14328 OS::Abort(); | 14328 OS::Abort(); |
14329 UNREACHABLE(); | 14329 UNREACHABLE(); |
14330 return NULL; | 14330 return NULL; |
14331 } | 14331 } |
14332 | 14332 |
14333 | 14333 |
14334 RUNTIME_FUNCTION(MaybeObject*, Runtime_AbortJS) { | 14334 RUNTIME_FUNCTION(MaybeObject*, Runtime_AbortJS) { |
14335 HandleScope scope(isolate); | 14335 HandleScope scope(isolate); |
14336 ASSERT(args.length() == 1); | 14336 ASSERT(args.length() == 1); |
14337 CONVERT_ARG_HANDLE_CHECKED(String, message, 0); | 14337 CONVERT_ARG_HANDLE_CHECKED(String, message, 0); |
14338 OS::PrintError("abort: %s\n", *message->ToCString()); | 14338 OS::PrintError("abort: %s\n", message->ToCString().get()); |
14339 isolate->PrintStack(stderr); | 14339 isolate->PrintStack(stderr); |
14340 OS::Abort(); | 14340 OS::Abort(); |
14341 UNREACHABLE(); | 14341 UNREACHABLE(); |
14342 return NULL; | 14342 return NULL; |
14343 } | 14343 } |
14344 | 14344 |
14345 | 14345 |
14346 RUNTIME_FUNCTION(MaybeObject*, Runtime_FlattenString) { | 14346 RUNTIME_FUNCTION(MaybeObject*, Runtime_FlattenString) { |
14347 HandleScope scope(isolate); | 14347 HandleScope scope(isolate); |
14348 ASSERT(args.length() == 1); | 14348 ASSERT(args.length() == 1); |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14915 // Handle last resort GC and make sure to allow future allocations | 14915 // Handle last resort GC and make sure to allow future allocations |
14916 // to grow the heap without causing GCs (if possible). | 14916 // to grow the heap without causing GCs (if possible). |
14917 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14917 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14918 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14918 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14919 "Runtime::PerformGC"); | 14919 "Runtime::PerformGC"); |
14920 } | 14920 } |
14921 } | 14921 } |
14922 | 14922 |
14923 | 14923 |
14924 } } // namespace v8::internal | 14924 } } // namespace v8::internal |
OLD | NEW |