Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 | 6 |
| 7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/v8.h" | 10 #include "src/v8.h" |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 842 const char* const Isolate::kStackOverflowMessage = | 842 const char* const Isolate::kStackOverflowMessage = |
| 843 "Uncaught RangeError: Maximum call stack size exceeded"; | 843 "Uncaught RangeError: Maximum call stack size exceeded"; |
| 844 | 844 |
| 845 | 845 |
| 846 Object* Isolate::StackOverflow() { | 846 Object* Isolate::StackOverflow() { |
| 847 HandleScope scope(this); | 847 HandleScope scope(this); |
| 848 // At this point we cannot create an Error object using its javascript | 848 // At this point we cannot create an Error object using its javascript |
| 849 // constructor. Instead, we copy the pre-constructed boilerplate and | 849 // constructor. Instead, we copy the pre-constructed boilerplate and |
| 850 // attach the stack trace as a hidden property. | 850 // attach the stack trace as a hidden property. |
| 851 Handle<String> key = factory()->stack_overflow_string(); | 851 Handle<String> key = factory()->stack_overflow_string(); |
| 852 Handle<JSObject> boilerplate = Handle<JSObject>::cast( | 852 Handle<Object> boilerplate = |
| 853 Object::GetProperty(js_builtins_object(), key).ToHandleChecked()); | 853 Object::GetProperty(js_builtins_object(), key).ToHandleChecked(); |
| 854 Handle<JSObject> exception = factory()->CopyJSObject(boilerplate); | 854 if (boilerplate->IsUndefined()) { |
| 855 return Throw(heap()->undefined_value(), nullptr); | |
|
Igor Sheludko
2015/05/27 14:33:57
Maybe it is better to throw "stack overflow" inste
Yang
2015/05/29 11:04:52
When does this actually happen?
Igor Sheludko
2015/05/29 11:14:42
The test case attached calls %DebugGetLoadedScript
| |
| 856 } | |
| 857 Handle<JSObject> exception = | |
| 858 factory()->CopyJSObject(Handle<JSObject>::cast(boilerplate)); | |
| 855 Throw(*exception, nullptr); | 859 Throw(*exception, nullptr); |
| 856 | 860 |
| 857 CaptureAndSetSimpleStackTrace(exception, factory()->undefined_value()); | 861 CaptureAndSetSimpleStackTrace(exception, factory()->undefined_value()); |
| 858 #ifdef VERIFY_HEAP | 862 #ifdef VERIFY_HEAP |
| 859 if (FLAG_verify_heap && FLAG_stress_compaction) { | 863 if (FLAG_verify_heap && FLAG_stress_compaction) { |
| 860 heap()->CollectAllAvailableGarbage("trigger compaction"); | 864 heap()->CollectAllAvailableGarbage("trigger compaction"); |
| 861 } | 865 } |
| 862 #endif // VERIFY_HEAP | 866 #endif // VERIFY_HEAP |
| 863 | 867 |
| 864 return heap()->exception(); | 868 return heap()->exception(); |
| (...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2793 if (prev_ && prev_->Intercept(flag)) return true; | 2797 if (prev_ && prev_->Intercept(flag)) return true; |
| 2794 // Then check whether this scope intercepts. | 2798 // Then check whether this scope intercepts. |
| 2795 if ((flag & intercept_mask_)) { | 2799 if ((flag & intercept_mask_)) { |
| 2796 intercepted_flags_ |= flag; | 2800 intercepted_flags_ |= flag; |
| 2797 return true; | 2801 return true; |
| 2798 } | 2802 } |
| 2799 return false; | 2803 return false; |
| 2800 } | 2804 } |
| 2801 | 2805 |
| 2802 } } // namespace v8::internal | 2806 } } // namespace v8::internal |
| OLD | NEW |