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 13080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13091 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]); | 13091 CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]); |
13092 | 13092 |
13093 HandleScope scope(isolate); | 13093 HandleScope scope(isolate); |
13094 // Optionally capture a more detailed stack trace for the message. | 13094 // Optionally capture a more detailed stack trace for the message. |
13095 isolate->CaptureAndSetDetailedStackTrace(error_object); | 13095 isolate->CaptureAndSetDetailedStackTrace(error_object); |
13096 // Capture a simple stack trace for the stack property. | 13096 // Capture a simple stack trace for the stack property. |
13097 return *isolate->CaptureSimpleStackTrace(error_object, caller, limit); | 13097 return *isolate->CaptureSimpleStackTrace(error_object, caller, limit); |
13098 } | 13098 } |
13099 | 13099 |
13100 | 13100 |
| 13101 // Mark a function to recognize when called after GC to format the stack trace. |
| 13102 RUNTIME_FUNCTION(MaybeObject*, Runtime_MarkOneShotGetter) { |
| 13103 ASSERT_EQ(args.length(), 1); |
| 13104 CONVERT_ARG_HANDLE_CHECKED(JSFunction, fun, 0); |
| 13105 HandleScope scope(isolate); |
| 13106 Handle<String> key = isolate->factory()->hidden_stack_trace_symbol(); |
| 13107 JSObject::SetHiddenProperty(fun, key, key); |
| 13108 return *fun; |
| 13109 } |
| 13110 |
| 13111 |
13101 // Retrieve the raw stack trace collected on stack overflow and delete | 13112 // Retrieve the raw stack trace collected on stack overflow and delete |
13102 // it since it is used only once to avoid keeping it alive. | 13113 // it since it is used only once to avoid keeping it alive. |
13103 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOverflowedRawStackTrace) { | 13114 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOverflowedRawStackTrace) { |
13104 ASSERT_EQ(args.length(), 1); | 13115 ASSERT_EQ(args.length(), 1); |
13105 CONVERT_ARG_CHECKED(JSObject, error_object, 0); | 13116 CONVERT_ARG_CHECKED(JSObject, error_object, 0); |
13106 String* key = isolate->heap()->hidden_stack_trace_symbol(); | 13117 String* key = isolate->heap()->hidden_stack_trace_symbol(); |
13107 Object* result = error_object->GetHiddenProperty(key); | 13118 Object* result = error_object->GetHiddenProperty(key); |
13108 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); | 13119 RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); |
13109 error_object->DeleteHiddenProperty(key); | 13120 error_object->DeleteHiddenProperty(key); |
13110 return result; | 13121 return result; |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13504 // Handle last resort GC and make sure to allow future allocations | 13515 // Handle last resort GC and make sure to allow future allocations |
13505 // to grow the heap without causing GCs (if possible). | 13516 // to grow the heap without causing GCs (if possible). |
13506 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13517 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13507 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13518 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13508 "Runtime::PerformGC"); | 13519 "Runtime::PerformGC"); |
13509 } | 13520 } |
13510 } | 13521 } |
13511 | 13522 |
13512 | 13523 |
13513 } } // namespace v8::internal | 13524 } } // namespace v8::internal |
OLD | NEW |