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 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 const char* const Isolate::kStackOverflowMessage = | 843 const char* const Isolate::kStackOverflowMessage = |
844 "Uncaught RangeError: Maximum call stack size exceeded"; | 844 "Uncaught RangeError: Maximum call stack size exceeded"; |
845 | 845 |
846 | 846 |
847 Failure* Isolate::StackOverflow() { | 847 Failure* Isolate::StackOverflow() { |
848 HandleScope scope(this); | 848 HandleScope scope(this); |
849 // At this point we cannot create an Error object using its javascript | 849 // At this point we cannot create an Error object using its javascript |
850 // constructor. Instead, we copy the pre-constructed boilerplate and | 850 // constructor. Instead, we copy the pre-constructed boilerplate and |
851 // attach the stack trace as a hidden property. | 851 // attach the stack trace as a hidden property. |
852 Handle<String> key = factory()->stack_overflow_string(); | 852 Handle<String> key = factory()->stack_overflow_string(); |
853 Handle<JSObject> boilerplate = Handle<JSObject>::cast( | 853 Handle<JSObject> boilerplate = |
854 Object::GetProperty(js_builtins_object(), key).ToHandleChecked()); | 854 Handle<JSObject>::cast(Object::GetProperty(js_builtins_object(), key)); |
855 Handle<JSObject> exception = JSObject::Copy(boilerplate); | 855 Handle<JSObject> exception = JSObject::Copy(boilerplate); |
856 DoThrow(*exception, NULL); | 856 DoThrow(*exception, NULL); |
857 | 857 |
858 // Get stack trace limit. | 858 // Get stack trace limit. |
859 Handle<Object> error = | 859 Handle<Object> error = |
860 GetProperty(js_builtins_object(), "$Error").ToHandleChecked(); | 860 GetProperty(js_builtins_object(), "$Error").ToHandleChecked(); |
861 if (!error->IsJSObject()) return Failure::Exception(); | 861 if (!error->IsJSObject()) return Failure::Exception(); |
862 Handle<Object> stack_trace_limit = | 862 Handle<Object> stack_trace_limit = |
863 GetProperty( | 863 GetProperty( |
864 Handle<JSObject>::cast(error), "stackTraceLimit").ToHandleChecked(); | 864 Handle<JSObject>::cast(error), "stackTraceLimit").ToHandleChecked(); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 return handler == NULL; | 1043 return handler == NULL; |
1044 } | 1044 } |
1045 } | 1045 } |
1046 | 1046 |
1047 | 1047 |
1048 bool Isolate::IsErrorObject(Handle<Object> obj) { | 1048 bool Isolate::IsErrorObject(Handle<Object> obj) { |
1049 if (!obj->IsJSObject()) return false; | 1049 if (!obj->IsJSObject()) return false; |
1050 | 1050 |
1051 Handle<String> error_key = | 1051 Handle<String> error_key = |
1052 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$Error")); | 1052 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("$Error")); |
1053 Handle<Object> error_constructor = Object::GetProperty( | 1053 Handle<Object> error_constructor = GlobalObject::GetPropertyNoExceptionThrown( |
1054 js_builtins_object(), error_key).ToHandleChecked(); | 1054 js_builtins_object(), error_key); |
1055 | 1055 |
1056 DisallowHeapAllocation no_gc; | 1056 DisallowHeapAllocation no_gc; |
1057 for (Object* prototype = *obj; !prototype->IsNull(); | 1057 for (Object* prototype = *obj; !prototype->IsNull(); |
1058 prototype = prototype->GetPrototype(this)) { | 1058 prototype = prototype->GetPrototype(this)) { |
1059 if (!prototype->IsJSObject()) return false; | 1059 if (!prototype->IsJSObject()) return false; |
1060 if (JSObject::cast(prototype)->map()->constructor() == | 1060 if (JSObject::cast(prototype)->map()->constructor() == |
1061 *error_constructor) { | 1061 *error_constructor) { |
1062 return true; | 1062 return true; |
1063 } | 1063 } |
1064 } | 1064 } |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2287 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); | 2287 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); |
2288 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); | 2288 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); |
2289 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert(); | 2289 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert(); |
2290 } | 2290 } |
2291 } | 2291 } |
2292 return Handle<JSObject>::cast(factory()->symbol_registry()); | 2292 return Handle<JSObject>::cast(factory()->symbol_registry()); |
2293 } | 2293 } |
2294 | 2294 |
2295 | 2295 |
2296 } } // namespace v8::internal | 2296 } } // namespace v8::internal |
OLD | NEW |